3dwannab Posted March 3, 2017 Share Posted March 3, 2017 Sorry to annoy you guys again but I managed to get it to work (sort of). But it's not selecting the correct boundary in some cases. See attached drawing. If you select the hatch for plaster in that, it'll select the adjacent boundary too. Any help here would be greatly appreciated. (defun c:Test (/ _2dpt ss1 ss2 ss3 a b i1 i2 ) (vl-load-com) (setq ss3 (ssadd)) (defun _2dpt (pt) (list (car pt) (cadr pt) 0.)) (if (setq ss1 (ssget '((0 . "HATCH")))) (repeat (setq i1 (sslength ss1)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss1 (setq i1 (1- i1)))) 'a 'b) (if (setq ss2 (apply 'ssget (append (list "_W") (mapcar '(lambda (x) (trans (_2dpt (vlax-safearray->list x)) 0 1)) (list a b)) '(((0 . "~HATCH,ARC,CIRCLE,LINE,LWPOLYLINE"))) ) ) ) (repeat (setq i2 (sslength ss2)) (ssadd (ssname ss2 (setq i2 (1- i2))) ss3) ) ) ) ) (sssetfirst nil ss3) (princ (strcat "\nNumber of found hatch boundaries : < " (itoa (sslength ss3)) " >")) (command "._regen")(princ) ) Selection problem.dwg Quote Link to comment Share on other sites More sharing options...
3dwannab Posted Friday at 11:44 PM Share Posted Friday at 11:44 PM This works for hatches that are associated with the objects. Lee Mac working his magic once again. 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.