- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wrote a program that inserts blocks at midpoints of lines, and it works great. However, some of these lines have blocks inserted at one end of them. I am looking for a way to check if there is a block inserted at either end of each line in my selection set. If there is, then that line is skipped. I've put together some code, and it works, but it has to process a lot of information and has taken a program that executed in less than a second and now takes up to 30 seconds (or likely more if there were more objects in the selection set) to run.
This is the code I used to collect the insertion points of all the blocks:
(defun GetCaps ( / cpss cplst cpt i) (setq i 0 cplst nil) (if (setq cpss (ssget "A" (list (cons 0 "insert")(cons 2 "CAP")(cons 410 "Model")))) (while (not (= i (sslength cpss))) (setq cpt (cdr (assoc 10 (entget (ssname cpss i))))) (setq cplst (append cplst (list cpt))) (setq i (1+ i)) ) nil) cplst )
Then I put this into my existing code to evaluate against that list:
(setq mch 0) (foreach x (GetCaps)(if (or (equal x p1)(equal x p2))(setq mch 1))) (if (= mch 0) (progn .... ) )
This works. But it takes so long it isn't tenable. Any help that would make this run quick is much appreciated!
Solved! Go to Solution.