.NET

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

Speed Up my command / function

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

Hello!

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)

 transaction.Commit();

 

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.

 

Thanks.

ADN Support Specialist
Posts: 349
Registered: ‎05-22-2006
Message 2 of 3 (145 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.

 

 

Cheers,

Stephen Preston
Autodesk Developer Network
*Expert Elite*
chiefbraincloud
Posts: 750
Registered: ‎02-13-2008
Message 3 of 3 (95 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community