Hickoz_bro Posted June 30, 2011 Share Posted June 30, 2011 Hi all, I've got a problem selecting items by window in my LISP code. If you take a look at the image below I've got a label who's bottom left corner is at Point 0,0, and the top right corner is at some other point (say 1000,250). I want my LISP to select and hatch all items WITHIN the boundary box of this label, i.e. I don't want the boundary box selected. The problem is that if my label is too big (say 5000,1250) then the selection method I've used will also select the boundary box. As you can see in the code below, I'm selecting using a window from 1,1 (just inside bottom left corner) to 9999,9999 (way outside the top right corner of the label). This works fine if the label is smaller, but it doesn't work on very large labels. (command "-hatch" "a" "h" "y" "a" "y" "" "s" "w" "1,1" "9999,9999" "" "") Is there a way to ignore the zoom factor when selecting by a window, or is there another selection method that will give me the result I want? Cheers Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 30, 2011 Share Posted June 30, 2011 Start here: (command "-hatch" "a" "h" "y" "a" "y" "" "s" "w" [color=blue]pause pause[/color] "" "") Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 30, 2011 Share Posted June 30, 2011 Perhaps use the ssget function with a selection filter to exclude the boundary object. However, this assumes the boundary object has some distinguishing characteristics to tell it apart from the other objects. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 30, 2011 Share Posted June 30, 2011 Maybe this way .... (vl-load-com) (defun c:Test (/ ss l sset) ; Tharwat 01. 07. 2011 (if (setq ss (ssget "_w" '(1.0 1.0) '(9999.0 9999.0) '((0 . "*POLYLINE")) ) ) (repeat (setq l (sslength ss)) (setq sset (ssname ss (setq l (1- l)))) (if (vlax-curve-isclosed sset) (command "_.-hatch" "_s" sset "" "_p" "_solid" "") ) ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 30, 2011 Share Posted June 30, 2011 Perhaps this one is better than the first one , it has a very odd option and I think it is used by anyone (vl-load-com) (defun c:Test (/ ss i l sset) ; Tharwat 01. 07. 2011 (if (setq ss (ssget "_w" '(1.0 1.0) '(9999.0 9999.0) '((0 . "*POLYLINE")) ) ) (progn (setq i (sslength ss)) (repeat (setq l (sslength ss)) (setq sset (ssname ss (setq l (1- l)))) (if (vlax-curve-isclosed sset) (command "_.-hatch" "_s" sset "" "_p" "_solid" "") ) (if (eq i (+ l 1)) (entdel (entlast)) ) ) ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
Hickoz_bro Posted July 1, 2011 Author Share Posted July 1, 2011 Thanks for the suggestions guys... We ended up selecting the border only, changing the layer (we were going to do this later anyway), then turning that layer off and selecting the rest (the text items), and hatching that, then turning the border layer back on... Nice and simple, and it seems to work quite well. The geometry will change with each label, but it's predictable as it is the output of an Inventor VBA Macro, so I'm happy enough with this solution. Thanks again. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 1, 2011 Share Posted July 1, 2011 Nice and simple, and it seems to work quite well. The geometry will change with each label, but it's predictable as it is the output of an Inventor VBA Macro, so I'm happy enough with this solution. Thanks again. You're welcome Gerrard . I am also happy that you got it work with that manipulating idea with Hatch entity . Regards. Tharwat 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.