Alex_Miller Posted December 9, 2018 Share Posted December 9, 2018 I have a theoretical question. When I create a single object, I can use it and then delete it. (setq object (entlast)) (entdel object) If there are the several objects I can create the set. For work I use a new layer, then delete it. I'm not sure if I am doing the right thing. How do you control multiple objects at the same time? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 9, 2018 Share Posted December 9, 2018 I don't fully understand your question - what are you trying to do with the multiple objects? Quote Link to comment Share on other sites More sharing options...
Alex_Miller Posted December 9, 2018 Author Share Posted December 9, 2018 Suppose I have a few lines. I want to create a set. But there are still other lines in the project. I want form a set of only the correct lines. There are many more steps. Objects are created and deleted during work. Then I create a new layer for my objects. Is it possible to do differently, not to create a layer? Quote Link to comment Share on other sites More sharing options...
Alex_Miller Posted December 9, 2018 Author Share Posted December 9, 2018 ;;; the excess lines of project, being on layer "0" ((lambda (/ c pt1 pt2) (setq c 20 pt1 (list c 0) pt2 (list c 10)) (repeat 5 (command "_.line" pt1 pt2 "") (setq c (+ 10 c) pt1 (list c 0) pt2 (list c 10)) ))) ;;; my objects (command "'_.layer" "_new" "new.layer" "_s" "new.layer" "") (command "_.rectangle" "0,0" "10,10") (setq object (entlast)) (command "_.explode" object) (setq lines (ssget "_X" '((0 . "LINE") (8 . "new.layer")))) do something ((lambda (/ c) (setq c 0) (repeat (sslength lines) (entdel (ssname lines c)) (setq c (+ 1 c))))) Quote Link to comment Share on other sites More sharing options...
Grrr Posted December 9, 2018 Share Posted December 9, 2018 With vanilla LISP, you can obtain the set using entlast / entnext functions (without having the need to group them in a separate layer) : (setq ListOfLineEnames ( (lambda ( / object tmp eL ) (command "_.rectangle" "0,0" "10,10") (command "_.explode" (setq object (entlast))) (setq tmp object) (while (setq tmp (entnext tmp)) (setq eL (cons tmp eL)) ) eL ) ) ) (foreach line ListOfLineEnames (entdel line) ; or do whatever you want here ) Also you can create these objects "programatically", meaning wihtout any command calls. So you can store them instantly while creating. 1 Quote Link to comment Share on other sites More sharing options...
Alex_Miller Posted December 9, 2018 Author Share Posted December 9, 2018 Grrr Thank you! I will improve my skills. Quote Link to comment Share on other sites More sharing options...
Grrr Posted December 9, 2018 Share Posted December 9, 2018 4 minutes ago, Alex_Miller said: Grrr Thank you! I will improve my skills. No problem, in addition check out Lee's entmake functions, where you supply the arguments and the entity name is returned, so you can store it or manipulate it further. Also the basic structures in LISP are lists and atoms, so its acceptable to work with a list of enames, rather than a selection set. 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2018 Share Posted December 10, 2018 You can also use SSADD which adds objects to a selection set. If you want to save the 4 lines of the rectang individually. I would suggest you write a little defun that does just that makes 4 lines from the two corner points if you use ssadd then the lines would be 4 items in the selection set and you can get at each one for further action. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.