I'm developing on a W7 64bit machine using VS2010 and AutoCAD 2010. Using COM, I've converted a VBA application into an .exe that runs but it is very slow (much slower then the 32bit VBA code used to run). Since we produce a lot of DXFs out of our 3D application, we want the conversion to be automated (hence, no more running inside of AutoCAD).
The current version just references the AutoCAD 2010 Type Library and the AutoCADObjectdbx COMs.
For each DXF, the code does the following:
1. Adds new layers
2. Loops thru all entites (currently using a selectionset)
a. Changes the entity's layer based on a collection key and it's linetype to "bylayer"
b. For PolyLines and LWPolyLines, sets the constantwidth to 0
c. For all Text, changes the style to "SIMPLEX", the Scalefactor to 0.7 and looks for a special text value which
indicates the drawing scale ("dscale").
3. Sets the drawing's DIMSCALE and LTSCALE to a multiple of the "dscale"
4. Scales all entities by "dscale"
5. Purges All
6. Zoomextents()
7. Saves the drawing as a *.dwg file
8. Closes the drawing
9. Logs some statistics on each file converted.
It seems as most of the time is spent in Step 2. I can obviously do steps 2,3 & 4 by reading/modifying the DXF as a text file very fast. But I would rather keep all the processing inside of AutoCAD.
So here are my questions(based on using COM) and trying to speed the process up:
1. What additional references do I need work directly with the drawing's database?
2. Are the NET transaction examples under this category valid when going through COM?
I've zipped and attached the current project (VS2010 project) for possible reference
Thanks,
Eric