Juergen Posted April 26, 2021 Posted April 26, 2021 Hi, How can I select all the rectangles in the drawing with no content? Thx for a tip. example.dwg Quote
ronjonp Posted April 26, 2021 Posted April 26, 2021 (edited) Here's one way: (defun c:foo (/ a b s) ;; RJP » 2021-04-26 (if (setq s (ssget '((0 . "LWPOLYLINE") (90 . 4)))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (vla-getboundingbox (vlax-ename->vla-object e) 'a 'b) (or (= 1 (sslength (ssget "_C" (vlax-safearray->list a) (vlax-safearray->list b)))) (ssdel e s) ) ) ) (sssetfirst nil s) (princ) ) Edited April 26, 2021 by ronjonp Quote
mhupp Posted April 26, 2021 Posted April 26, 2021 if I'm understanding this - Make selection set of polylines that are selected by user & have 4 vertices. - for each of those selected polylines find the bounding box points - create a temp 2nd selection set using those points - if only the polyline is selected keep else delete that polyline from the selection set. - Select everything thing that is left in the selection set. That is crazy simple! When i saw this problem i didn't know how to go about to solve this. Quote
ronjonp Posted April 26, 2021 Posted April 26, 2021 3 hours ago, mhupp said: if I'm understanding this - Make selection set of polylines that are selected by user & have 4 vertices. - for each of those selected polylines find the bounding box points - create a temp 2nd selection set using those points - if only the polyline is selected keep else delete that polyline from the selection set. - Select everything thing that is left in the selection set. That is crazy simple! When i saw this problem i didn't know how to go about to solve this. Very simple Quote
Juergen Posted April 27, 2021 Author Posted April 27, 2021 Hi ronjonp, Thank you for resolving my issue. Quote
mhupp Posted April 27, 2021 Posted April 27, 2021 12 hours ago, ronjonp said: Very simple I hope your not taking what i said as an insult. The word I should have used is elegant. The one thing I try to do when coding is to find the most efficient way to do things. That usually turns out to be the most simplistic way to doing things. I thought it was going to take alot more code to get what Juergen wanted. That's why I come to this forum to find stuff like this. Quote
ronjonp Posted April 27, 2021 Posted April 27, 2021 7 hours ago, mhupp said: I hope your not taking what i said as an insult. The word I should have used is elegant. The one thing I try to do when coding is to find the most efficient way to do things. That usually turns out to be the most simplistic way to doing things. I thought it was going to take alot more code to get what Juergen wanted. That's why I come to this forum to find stuff like this. Not at all .. glad you are studying the code and figuring out what it does. I like simplicity as well! Quote
BIGAL Posted April 29, 2021 Posted April 29, 2021 It is better to use the co-ordinates of the pline rather than bounding box, compare a rectang at 45 angle may get stuff outside of rectang. Still use "WP" co-ords Quote
ronjonp Posted April 29, 2021 Posted April 29, 2021 1 hour ago, BIGAL said: It is better to use the co-ordinates of the pline rather than bounding box, compare a rectang at 45 angle may get stuff outside of rectang. Still use "WP" co-ords Sure. But sometimes you have to look at the example drawing. Quote
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.