[python-win32] By-reference COM method arguments not being treated as outputs

Mike Graham mikegraham at gmail.com
Tue Jul 28 23:30:25 CEST 2009


Upon some further investigation, I have come to understand the method
a bit better

def PickObject(self,
       obj=defaultNamedNotOptArg,
       x=defaultNamedNotOptArg,
       y=defaultNamedNotOptArg,
       z=defaultNamedNotOptArg,
       obj_num=defaultNamedNotOptArg,
       entity_num=defaultNamedNotOptArg,
       tolerance=9.9999997473787516e-06,
       PType=0):
       """Retrieve an object ID and face or edge number by giving an object
          type and global coordinates"""
       return self._ApplyTypes_(76,
                        1,
                        (24, 0),
                        (
                            (16387, 3),
                            (12, 1),
                            (12, 1),
                            (12, 1),
                            (16387, 3),
                            (16387, 3),
                            (5, 49),
                            (3, 49)
                        ),
                        u'PickObject',
                        None,
                        obj, x, y, z, obj_num, entity_num, tolerance, PType)


The tuple of tuples in the _ApplyTypes_ call is of flags for each obj,
x, y,...PType. For example,
    (type, input_or_output_flag) = (16387, 3)
where 3 I believe indicates an input/output parameter. I can change
these to 1 (for input) and 2 (for output for obj_num and entity_num),
but it still does not work. I suspect there might have to be other
changes in order (obj_num and entity_num shouldn't
==defaultNamedNotOptArg, for example, and I am not sure if they should
be passed to _ApplyTypes_ at all).

I think this is the basis of the problem, but I still cannot solve it.
Nowhere else in my generated file can I find an example of this
working right to follow. I am really hoping to get this working.

Thanks,
Mike

On Tue, Jul 28, 2009 at 9:00 AM, Mike Graham<mikegraham at gmail.com> wrote:
> Hi Greg,
>
> Thanks for your reply. I went back through the mailing list archives
> to try to find someone else who had the same problem I did and found
> your posts, but I couldn't quite understand your and Hammond's
> solutions well enough to apply it. Perhaps you or someone else can
> help me understand what's going on better.
>
> You present what looks like an item from a dict:
> "feSelector": (10349, 2, (9, 0), (), "feSelector", None)
> and explain that the None in the tuple should be replaced by the CLSID
> of the class to which "feSelector" belongs.
>
> The method I posted as an example's name does not occur in any dicts.
> It occurs in two places in the generated source. The first is the
> method definition I posted, in which it is part of a class
> _IDualModelItem(DispatchBaseClass) with the member
> CLSID=IID('{976FAFC8-96FD-11D4-A09D-0050DA1AC1A8}'). I am not aware of
> any particular python class from which this should be associated with.
>
> In my definition, I have a tuple that appears to be laid out the same
> as yours, so I tried replacing None with
> '{976FAFC8-96FD-11D4-A09D-0050DA1AC1A8}', but this didn't change
> anything.
>
> The other occurrence is in the list _IDualModelItem_vtables_, where one item is:
>    (( u'PickObject' , u'obj' , u'x' , u'y' , u'z' , u'obj_num' ,
> u'entity_num' , u'tolerance' , u'PType' , ),
>       76,
>       (76, (),
>       [(16387, 3, None, None), (12, 1, None, None), (12, 1, None, None),
>        (12, 1, None, None), (16387, 3, None, None), (16387, 3, None, None),
>        (5, 49, '9.9999997473787516e-06', None), (3, 49, '0', None)],
>       1,
>       1,
>       4,
>       0,
>       332,
>       (3, 0, None, None),
>       0)
>    )
>
> To tell the truth, I have no idea what _IDualModelItem_vtables_ does.
> I think I've examined these as close as I can without disecting the
> win32com.client module itself or finding some documentation (if there
> is documentation of any depth somewhere, I would love a link; I was
> unable to find any.)
>
> Can anyone provide any further insight?
>
> Mike
>


More information about the python-win32 mailing list