bigd632 Posted February 24, 2015 Share Posted February 24, 2015 I found a LISP someone created that allows you to select a polyline and the program creates a selection set of all the elements inside the polyline. How can I get the program to include the polyline in the SS as well? I tried to create an "en2" variable that is equal to the entity name of "pSS", then do (ssadd en2 ss) to add it onto the current selection set, but haven't gotten it to work. Any suggestions? (vl-load-com) ;; Select window poly (defun c:SelWP (/) (SelPoly "_WP") (princ) ) ;; Select objects inside a polyline (defun SelPoly (WC / pSS ss ss1 n m en) (if (and (progn (prompt "\nSelect polylines to form WPoly borders: ") (setq pSS (ssget '((0 . "LWPOLYLINE")))) ) (setq n (sslength pSS)) ;number of polylines selected (setq ss (ssadd)) ) (while (> (setq n (1- n)) -1) (if (and (setq ss1 (ssget WC (mapcar 'cdr (vl-remove-if-not '(lambda (item) (= (car item) 10)) (entget (ssname pSS n)))))) (setq m (sslength ss1)) ;number of objects inside of polyline ) (while (> (setq m (1- m)) -1) (setq en (ssname ss1 m)) ;en = list of entity names inside of polyline (ssadd en ss) ) ) (setq ss1 nil) (gc) ) ) (if (and ss (> (sslength ss) 0)) (sssetfirst nil ss) ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 24, 2015 Share Posted February 24, 2015 Replace the following into your posted routine . (sssetfirst nil (ssadd ss (ssname pSS 0))) Quote Link to comment Share on other sites More sharing options...
bigd632 Posted February 24, 2015 Author Share Posted February 24, 2015 Thanks for your help. I replaced (sssetfirst nil (ssadd ss (ssname pSS 0))) for (sssetfirst nil ss) but I am getting "error: bad argument type: lentitype ". Was I supposed to replace somewhere else? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 24, 2015 Share Posted February 24, 2015 Sorry I posted the reply without testing it Replace / add the following . (and (progn (prompt "\nSelect polylines to form WPoly borders: ") (setq pSS (ssget '((0 . "LWPOLYLINE")))) ) (setq n (sslength pSS)) ;number of polylines selected (setq ss (ssadd) [color=red]ss (ssadd (ssname pSS 0) ss ))[/color] ) Replace this ... (if (and ss (> (sslength ss) 0)) (sssetfirst nil ss) ) With this ... (if (> (sslength ss) 1) (sssetfirst nil ss) ) Quote Link to comment Share on other sites More sharing options...
bigd632 Posted February 24, 2015 Author Share Posted February 24, 2015 Great, works like a charm. Thanks! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 24, 2015 Share Posted February 24, 2015 Great, works like a charm. Thanks! Excellent , you're welcome. 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.