Search the Community
Showing results for tags 'iteration ssget database'.
-
Lisp iterative routine in a large drawing takes for ever!
MJLM posted a topic in AutoLISP, Visual LISP & DCL
I m working on a model which has already around 30000 elements which some of them are 9000 lines, some 4000 block definitions (actually 4, 5 individual blocks repeated) and a lot of text labels etc. When I run the following routine on the model at a given point which some lines start or end at it, it takes around 40 sec for 1000 repetitions on my system to finish. When I take a small portion of the system, say 100 lines, copy and paste them to a new empty drawing which contains the same lines of the point clicked, and run it again on this point, it finishes instantly, practically in 0 time. Since the 'ssget' searches for elements on a given point, I never thought the database size would really make a difference but, unfortunately, it seems it does. Also the filters used, such as 60, 62 and layer names do not seem to affect process time, that is 40 sec. So, the bottom line, is there a way to alleviate this issue? Is there a way to reduce the time of repetitive processes in a large database? My routines rely extensively on the ssget command on every node checking for topology, orientation, data etc. (defun c:test (/) (setq fp (getpoint)) (setq i 0) (repeat 1000 (setq ss (ssget "_X" (list (cons 0 "LINE") (cons 10 fp) (cons -4 "<NOT") (cons -4 "<OR") (cons 60 1) (cons 62 250) (cons -4 "OR>") (cons -4 "NOT>") (cons -4 "<OR") (cons 8 "MainA") (cons 8 "MainB") (cons 8 "BLines") (cons -4 "OR>")))) (prompt (strcat "\nPass: " (itoa (setq i (1+ i))))) ) (alert "Done!") (princ) )