[comtypes-users] DynamicPolicy?

2009-06-26 Thread Kelie
In Chapter 12 of Mark Hammond's book Python Programming on Win32, there is an example DynamicPolicy.py which demonstrates how to implement a COM server that exposes the entire Python string module. Can such a thing be done in comtypes? If so, is there an example? Thanks!

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

Re: [comtypes-users] Problem with AutoCAD

2009-01-06 Thread Kelie
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 = comtypes.cast(obj,

Re: [comtypes-users] Problem with AutoCAD

2009-01-05 Thread Kelie
Ronan, Thanks for taking time to explain what you're after. Here is an ugly way of achieving what you're trying to do. If you know AutoLisp/VisualLisp, this would be quite easy to follow. I'm not aware that there is a COM/ActiveX function equivalent to the ssgetfirst function. HTH. import

Re: [comtypes-users] Problem with AutoCAD

2009-01-03 Thread Kelie
Ronan, I'm not sure what the answer is to your question. But I'm curious why you're trying to use Python to execute the measure command. Do you know any AutoLisp/VisualLisp or VBA? Both of them would be much easier to use in this case. What I'm finding is Python (win32com or comtypes) has its

Re: [comtypes-users] argument order in an event handler

2008-09-05 Thread Kelie
Thomas Heller [EMAIL PROTECTED] writes: I finally found the bug - the arguments are passed as 'named' arguments by Thomas, Thanks for the update! - This SF.Net email is sponsored by the Moblin Your Move Developer's

Re: [comtypes-users] No such interface supported?

2008-08-20 Thread Kelie
Anthony Tuininga [EMAIL PROTECTED] writes: I've tried and app.ActiveDocument returns something but any attempt to reference ModelSpace or anything else that looks like an object doesn't appear to work. What did you get for the ActiveDocument? Something like this? POINTER(IAcadDocument)

Re: [comtypes-users] How to create array of variants?

2008-07-22 Thread Kelie
Thomas, Please see if the following snippet would be enough. Thanks. Sampe to demonstrate how to use comtypes to automate AutoCAD: adding a point , a line to the drawing; and attaching xdata of different types to them. The objective is to actually show how to create variants of different types

Re: [comtypes-users] How to explain the speed difference?

2008-07-19 Thread Kelie
Mark McMahon [EMAIL PROTECTED] writes: I would suggest trying a simple test with Word for example, automate AutoCAD through the VBA in word - and see if it is much faster than Python. Thanks Mark! I followed your suggestion. My limited tests show using VBA in Word to automate AutoCAD is

Re: [comtypes-users] How to create array of variants?

2008-07-15 Thread Kelie
Suraj Barkale [EMAIL PROTECTED] writes: OK here is a longer version: Array_of_2_VAR = comtypes.ARRAY(VARIANT, 2) XData = Array_of_2_VAR(VARIANT('Test_Application'), VARIANT(600)) I hope this will create a true Array of variants. If this fails; only Thomas would be able to help you.