Thomas Heller <thel...@...> writes:
> 
> Anyway, you should NOT use 'cast' with COM object pointers. Last,
> but not least, 'cast' doesn't handle the COM reference count correctly.
> 
> Please use 'QueryInterface' with them, like so:
> 
> block = obj.QueryInterface(ACAD.IAcadBlockReference)
> 

Thanks Thomas. I'm getting an error using QueryInterface.

> "C:\Python25\pythonw.exe"  "C:\Python25\codes\autocad\temp\cast_test.py" 
Traceback (most recent call last):
  File "C:\Python25\codes\autocad\temp\cast_test.py", line 9, in <module>
    block = obj.QueryInterface(ACAD.IAcadBlockReference)
  File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 1069, in
QueryInterface
    self.__com_QueryInterface(byref(iid), byref(p))
_ctypes.COMError: (-2147467262, 'No such interface supported', (None, None,
None, 0, None))

This is what I got from shell:
>>> import comtypes.gen.AutoCAD as ACAD
>>> ACAD.IAcadBlockReference
<class
'comtypes.gen._851A4561_F4EC_4631_9B0C_E7DC407512C9_0_1_0.IAcadBlockReference'>



------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to