If you're using 64 bit VBA, you will take a massive performance hit if your VBA code handles events.
It doesn't matter if you're handling only one event (like for example, BeginSave or whatever its called), or several, you will still suffer a massive hit if you use WithEvents on an AcadDocument or an AcadApplication variable.
The reason for that is related to how ActiveX events work. An ActiveX server doesn't know what specific events a client is handling. It only knows that the client wants all events for a given interface.
So, when you declare an AcadDocument using the WithEvents keyword, you are telling AutoCAD that it should fire *all* document events, not only those you wrote handlers for, and that's exactly it does.
For the events that you do not have handlers for in your code, VBA generates 'empty' or 'do-nothing' event handlers to handle those events.
The three events which are major contributors to slowing down everything you do, are these:
ObjectModified
ObjectAdded
ObjectErased
These events fire at a very high frequency, because they are object-specific. For example, if you draw a circle, the ObjectAdded event fires for the circle, then the ObjectModified event fires for the circle, and then the ObjectModified event fires for the circle's owner (the block that the circle was added to, like AcadModelSpace). So for each object added to a drawing you will have three inter-process ActiveX calls, which sends performance right through the floor.
So, if you're using 64 bit VBA and are seeing significant, across-the-board performance degredation, the odds are that it's a result of handling AcadDocument and/or AcadApplication events.
I'm afraid there's no solution for that.
My advice is to start learning .NET. The good thing about it is that you can continue to use ActiveX in .NET (similar to using VBA), until you're comfortable with the managed API.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
wrote in message news:5794218@discussion.autodesk.com...
Hello,
I bring back an old thread because I'm having problems with this issue in these days and you could help me.
I have noticed too a different speed of execution of the routines under 2008-x64 because of the x64VbaServer external process.
My problem, though, is not exactly in the routines: they are pretty simple and there's not a big difference of speed in executing them. My biggest problem is that when the external process is loaded, normal commands like copy&paste, or mirror, or erase, takes much more time than usual (i.e. 5 seconds on 2007, more than one minute on 2008).
I guess that the problem relies in the events handling of VBA process: also if nothing is written in the AcadDocument events subroutines, it always check them. But being so slow in doing them, when you work on many objects it takes an unbelievable amount of time.
Anyone else has the same problem?