Re: [python-win32] speed up win32com.client

2012-05-13 Thread DANIEL POSE
Sorry!!! my mistake!!! really there are a speed up, the timing using late-binding is: M_dimension= 512 R_dimension= 262144 t_block1= 3.00059867944 t_block2= 12.2370913063 t_block3= 0.488927223991 t_total= 15.7266172097 Then it is about half time using early-binding for my example. It is wonderfull

Re: [python-win32] speed up win32com.client

2012-05-13 Thread DANIEL POSE
Just for conclude the discusion, the solution is win32.client.CastTo() as Mark said. However, this modification doesn't speed up the code (at least in my case). Then, perhaps I need to learn C++ in order to embed python inside AutoCAD as Dan Glassman said. But, not now... Here I post the code using

Re: [python-win32] speed up win32com.client

2012-05-13 Thread DANIEL POSE
Thank you Mark, I will try to use win32com.client.CastTo() because InsertionPoint attribute is not inside IAcadEntity. Opss, you are right, the problem was TEMP\gen_py folder. Thank you! 2012/5/13 Mark Hammond > On 13/05/2012 5:00 AM, DANIEL POSE wrote: > >> I had tried to change attribute na

Re: [python-win32] speed up win32com.client

2012-05-13 Thread DANIEL POSE
Thank you Dan, by now it is clear for me. Unfortunately I haven't C++ knowledge but don't worry, for me it is enought to know that the problem is not in python or in my code. Now I am occasionaly programmer in Python or VBA, then it would be too complicated for me to learn C++, but perhaps I will c

Re: [python-win32] speed up win32com.client

2012-05-12 Thread Mark Hammond
On 13/05/2012 5:00 AM, DANIEL POSE wrote: I had tried to change attribute name in several ways (InsertionPoint, insertionPoint, insertionpoint,...) but I obtained the same error: Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\spyderlib\widgets\e

Re: [python-win32] speed up win32com.client

2012-05-12 Thread Dan Glassman
VBA is faster because it's running in-process inside AutoCAD (everything is loaded into acad.exe). Python runs out-of-process (AutoCAD objects need to be passed back and forth between acad.exe and python.exe). You can use AutoCAD's ObjectARX API to embed python inside AutoCAD and make python in-p

Re: [python-win32] speed up win32com.client

2012-05-12 Thread DANIEL POSE
I had tried to change attribute name in several ways (InsertionPoint, insertionPoint, insertionpoint,...) but I obtained the same error: Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\startup.py", line 128, in runfile

Re: [python-win32] speed up win32com.client

2012-05-11 Thread Mark Hammond
On 10/05/2012 6:38 AM, DANIEL POSE wrote: I have read about Early Binding but I hadn't tested the line that you reference: acad= win32com.client.gencache.EnsureDispatch("AutoCAD.Application") For my surprise, if I replace line: acad= win32com.client.Dispatch("AutoCAD.Application") for the line

Re: [python-win32] speed up win32com.client

2012-05-11 Thread Mark Hammond
On 10/05/2012 12:33 AM, Tom wrote: Sorry to interject here but I have a question along the same vein: If I have a script (in this case that interacts with Word through win32com.client) with statements like this: doc.ActiveWindow.Selection.BoldRun() doc.ActiveWindow.Selection.TypeText(_type) doc.A

Re: [python-win32] speed up win32com.client

2012-05-09 Thread DANIEL POSE
I have read about Early Binding but I hadn't tested the line that you reference: acad= win32com.client.gencache.EnsureDispatch("AutoCAD.Application") For my surprise, if I replace line: acad= win32com.client.Dispatch("AutoCAD.Application") for the line: acad= win32com.client.gencache.EnsureDisp

Re: [python-win32] speed up win32com.client

2012-05-09 Thread Tom
Sorry to interject here but I have a question along the same vein: If I have a script (in this case that interacts with Word through win32com.client) with statements like this: doc.ActiveWindow.Selection.BoldRun() doc.ActiveWindow.Selection.TypeText(_type) doc.ActiveWindow.Selection.BoldRun() Does

Re: [python-win32] speed up win32com.client

2012-05-08 Thread Tim Roberts
DANIEL POSE wrote: > Hello, > > I am writing code to program AutoCAD access from Python using pywin32. > When I need to work with a high number of AutoCAD objects, it is > faster to use vba than python. > Are there some way to speed up python code in order to work faster > with AutoCAD elements? >