Re: [comtypes-users] Problem with AutoCAD

2009-01-08 Thread Thomas Heller
Kelie schrieb: Ronan, There is a cast function. But the syntax isn't much shorter. import comtypes import comtypes.gen.AutoCAD as ACAD app = comtypes.client.GetActiveObject(AutoCAD.Application) obj = app.ActiveDocument.ModelSpace(1) #Assume this obj is a block block =

Re: [comtypes-users] Problem with AutoCAD

2009-01-08 Thread Thomas Heller
Ronan Paixão schrieb: Also, I'm had some problems with type coercion. In the VB examples, the variable types are declared before using, which coerce return types. The comtypes documentation is terrible and I didn't find anything to do similar. The problem is that ms.Item(number), where ms is

Re: [comtypes-users] Problem with AutoCAD

2009-01-08 Thread Kelie
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