Valued Contributor
Posts: 67
Registered: ‎02-03-2012
Message 1 of 3 (165 Views)

Speed Up my command / function

165 Views, 2 Replies
08-09-2012 03:12 PM


My function is very complicated. After enter command user must select objects. He select the whole drawing space. After that I'm do my job - storing specified blocks and curves into my collection, doing calculations and updating blocks.


Number of all elements that I'm modifying could raise to few thousands.


I've made some tests and (even that I'm removing objects from my collection while loop) function is faster at begin and slower at the end.


I thought I can do something like this:


if (counter = 100)



but I'm getting fatal error :smileytongue:


Maybe someone know a way to increase speed up, so I can clean memory while calculating selected objects in my function.



Board Manager
Posts: 380
Registered: ‎05-22-2006
Message 2 of 3 (156 Views)

Re: Speed Up my command / function

08-09-2012 10:36 PM in reply to: GrzesiekGP

Its very hard to make suggestions on optimizing performance without seeing any code. If you're opening objects in a transaction to check their type is one you're interested in, then using ObjectId.ObjectClass to make the comparison could speed up processing a large drawing, and make sure you open an object for read to query it and ugradeopen when you decide to edit it, rather than opening everything fro write. You could also read through Fenton's ongoing series of blogs about API performance, starting here - http://adndevblog.typepad.com/autocad/2012/07/the-right-tools-for-the-job-autocad-part-1.html.




Stephen Preston
Autodesk Developer Network
*Expert Elite*
Posts: 753
Registered: ‎02-13-2008
Message 3 of 3 (106 Views)

Re: Speed Up my command / function

08-13-2012 03:05 PM in reply to: GrzesiekGP

You weren't very descriptive, but I believe your fatal error is because you are trying to commit the transaction and then keep using it and commit it over and over again.  You can't do that.  Once a transaction has been committed, the only thing you can do with it is dispose it.



Dave O.                                                                  Sig-Logos32.png
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.