Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Moving Objects to a Different Layer is Too Slow

6 REPLIES 6
Reply
Message 1 of 7
JC_BL
562 Views, 6 Replies

Moving Objects to a Different Layer is Too Slow

I find that the command to move objects to a different layers runs very slow in one of the drawing.  I want to find out what wrong with the drawing and how to speed things up.

 

I have a LISP program that batch processes a large number of drawings.  One of the step to process each drawing is to change the colors of some objects according to the status of the objects.  I do this by moving the objects to a later that has the right color.  So far the program only takes 2 to 4 minutes to process each drawing.  But the program takes close to 90 minutes to process one specific drawing.  I track down the problem has to do with the command that moves the objects to the right layer, like this:

 

(vl-cmdf "_.chprop" (ssget) "" "_layer" "ABC-Prod-Good-Pcs" "")

 This command takes a very long time to finish, like 40 minutes each time it runs (to move 1200+ objects), and the program needs to run it twice for a total of approximately 80 minutes.

 

Please note that the drawing itself is not the largest drawing, and it doesn't have the largest number of objects to be moved either.  It is close to the top-5 drawings in term of drawing size and the number of objects to be moved.  Anyway, I cannot say that the drawing size or the number of objects to be moved are the cause of the problem.

 

I tried to "speed up" by moving 200 objects incrementally.  That didn't help.

 

I tried to "speed up" by moving 100 objects incrementally and saving the drawing after each 100 objects are moved.  That didn't help either; actually the speed is slightly slower than simply moving 1200+ objects all at once.

 

I don't know what to do.  I believe there may be something unusual about that drawing.  But I cannot tell.

 

By the way, the reason why I choose to change color by moving objects to a different layer has to do with the fact that I have found this is the best way so far. I tried to change the color of the objects directly.  But I find that the color of some sub-parts of the objects are not changed (because their color is by-layer). That's why I choose to change color by moving objects to a different layer.

 

Please help by telling me how I can check the drawing to see what is wrong with it, or telling me if there is a different way to change color that is better. Thanks.

 

 

Jay Chan

6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: JC_BL

Hi Jay,

 

look at DRAWORDERCTL SysVar, sometimes when set to 0, can speed up some processes...just a thought...

 

HTH

Henrique

EESignature

Message 3 of 7
JC_BL
in reply to: hmsilva

Thanks for the suggestion. Unfortunately, that doesn't make any difference. Finally a draftsman told me that the specific drawing has a lot number of something called "Cross Section View" (that shows objects in sideway) that may slow everything down. Surely enough, I manually removed all the "Cross Section Views", and the process is speed up down to 1/3 of the original time. Unfortunately, 1/3 the time is still 1/2 hour. I have tried purging all the deleted objects. But that doesn't help either. Seem like I need to keep deleting something until I figure out what is still slowing down the process. Jay Chan
Message 4 of 7
aqdam1978
in reply to: JC_BL

Hi Jay,

 

there is something wrong in your drawing files.

I tried your command in a drawing with more than 2000 objects, it done in less than 0.5 sec!

I think you should inspect your drawing files.

 

try "command" instead of "vl-cmdf" too.

 

Abbas

Message 5 of 7
_gile
in reply to: aqdam1978

Hi,

 

If you're looking for performance, avoid using command. Use entmod or vla-put-Layer instead.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 6 of 7
dgorsman
in reply to: _gile

I don't think this may help much, at least not from only a "few" thousand entities.  From one of the other comments by the OP it seems the objects are intelligent, and making changes is triggering a rebuild of some sort which is where the delays are coming from.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 7 of 7
JC_BL
in reply to: dgorsman

Yes, you are right. Those objects are intelligent objects created using a third party software. The problem mentioned in this message thread is just one of the problem that I am having related to those intelligent objects. Currently I am discussing this with the third party vendor to see if there is a way to fix the problem. Thanks for sharing your thought.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost