Valued Contributor
70 Posts
1 Kudo
Registered: ‎02-03-2012
Post 1 of 3

Speed Up my command / function

169 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.



ADN Support Specialist
433 Posts
67 Kudos
Registered: ‎05-22-2006
Post 2 of 3

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*
753 Posts
54 Kudos
Registered: ‎02-13-2008
Post 3 of 3

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!