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
Hi Jay,
look at DRAWORDERCTL SysVar, sometimes when set to 0, can speed up some processes...just a thought...
HTH
Henrique
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
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.