atom0007 Posted June 21, 2011 Share Posted June 21, 2011 Hello, My terminology may be a bit off, I'm quite new to AutoCAD. Here's what I'd like to do: I have an nxn rectangular array of blocks. I'd like to "mask" that with a circle. Any blocks that are inside the circle, I wish to retain. Any blocks that are cut by the circle perimeter, or are outside, I wish to delete completely. Is there an easy way to do this without resorting to programming? Thanks for any help! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 22, 2011 Share Posted June 22, 2011 try extrim Quote Link to comment Share on other sites More sharing options...
atom0007 Posted June 22, 2011 Author Share Posted June 22, 2011 BigAl, thanks, I'll try that later today Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 Any blocks that are cut by the circle perimeter, or are outside, I wish to delete completely EXTRIM won't do this, will it? the only way i know to do this is using a lisp routine, which i am sure i have seen written by lee mac which enables you to select everything inside an ellipse (i think....) Quote Link to comment Share on other sites More sharing options...
atom0007 Posted June 22, 2011 Author Share Posted June 22, 2011 DesignerStuart, I agree - I think it will trim the block to the edge rather than delete completely. I'll try it! Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 okay so i i found select within a curve, by alan j t. found at AUGI forum but was sure i saw it here a while back. it actually does the opposite of what you want, but it's a start? (defun c:SWC (/ _pac add ss i temp i2) ;; Select Within Curve ;; Alan J. Thompson, 03.31.11 / 05.11.11 (vl-load-com) (defun _pac (e / l v d lst) (setq d (- (setq v (/ (setq l (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))) 100.)))) (while (< (setq d (+ d v)) l) (setq lst (cons (trans (vlax-curve-getPointAtDist e d) 0 1) lst)) ) ) (princ "\nSelect closed curves to select object(s) within: ") (if (setq add (ssadd) ss (ssget '((-4 . "<OR") (0 . "CIRCLE,ELLIPSE") (-4 . "<AND") (0 . "*POLYLINE") (-4 . "&=") (70 . 1) (-4 . "AND>") (-4 . "OR>") ) ) ) (progn (repeat (setq i (sslength ss)) (if (setq temp (ssget "_WP" (_pac (ssname ss (setq i (1- i)))))) (repeat (setq i2 (sslength temp)) (ssadd (ssname temp (setq i2 (1- i2))) add)) ) ) (sssetfirst nil add) (ssget "_I") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
atom0007 Posted June 22, 2011 Author Share Posted June 22, 2011 Great, I'll try to get my head around that. I've not programmed AutoCAD in many a year....! Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 it's easy - copy contents into a notepad file and rename it "SWC.lsp" then drag and drop into a drawing. now the command SWC should select everything wholly inside your circle. then i guess you have to hide this stuff, and delete everything else. not beautiful, but it will work. Quote Link to comment Share on other sites More sharing options...
atom0007 Posted June 22, 2011 Author Share Posted June 22, 2011 Great, thanks! Time to lubricate the brain. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 22, 2011 Share Posted June 22, 2011 Otherwise give these a go, quickly written but should work: ([color=BLUE]defun[/color] SelectInside ( entity acc [color=BLUE]/[/color] i j l ) ([color=BLUE]cond[/color] ( ([color=BLUE]vlax-curve-isclosed[/color] entity) ([color=BLUE]setq[/color] i ([color=BLUE]/[/color] ([color=BLUE]vlax-curve-getdistatparam[/color] entity ([color=BLUE]vlax-curve-getendparam[/color] entity)) acc) j ([color=BLUE]-[/color] i)) ([color=BLUE]repeat[/color] ([color=BLUE]fix[/color] acc) ([color=BLUE]setq[/color] l ([color=BLUE]cons[/color] ([color=BLUE]trans[/color] ([color=BLUE]vlax-curve-getpointatdist[/color] entity ([color=BLUE]setq[/color] j ([color=BLUE]+[/color] j i))) 0 1) l)) ) ([color=BLUE]ssget[/color] [color=MAROON]"_WP"[/color] l) ) ) ) ([color=BLUE]defun[/color] c:SelIn ( [color=BLUE]/[/color] s ) ([color=BLUE]princ[/color] [color=MAROON]"\nSelect Boundary Object: "[/color]) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] [color=MAROON]"_+.:E:S"[/color] '( (-4 . [color=MAROON]"<OR"[/color]) (0 . [color=MAROON]"CIRCLE,ELLIPSE"[/color]) (-4 . [color=MAROON]"<AND"[/color]) (0 . [color=MAROON]"*POLYLINE,SPLINE"[/color]) (-4 . [color=MAROON]"&="[/color]) (70 . 1) (-4 . [color=MAROON]"AND>"[/color]) (-4 . [color=MAROON]"OR>"[/color]) ) ) ) ([color=BLUE]sssetfirst[/color] [color=BLUE]nil[/color] (SelectInside ([color=BLUE]ssname[/color] s 0) 100)) ) ([color=BLUE]princ[/color]) ) ([color=BLUE]defun[/color] c:SelOut ( [color=BLUE]/[/color] a e i s ) ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]princ[/color] [color=MAROON]"Select Exterior Set <All>: "[/color]) ([color=BLUE]setq[/color] a ([color=BLUE]cond[/color] ( ([color=BLUE]ssget[/color] ([color=BLUE]list[/color] ([color=BLUE]cons[/color] 410 ([color=BLUE]getvar[/color] 'CTAB)))) ) ( ([color=BLUE]ssget[/color] [color=MAROON]"_X"[/color] ([color=BLUE]list[/color] ([color=BLUE]cons[/color] 410 ([color=BLUE]getvar[/color] 'CTAB)))) ) ) ) ([color=BLUE]princ[/color] [color=MAROON]"\nSelect Boundary Object: "[/color]) ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] [color=MAROON]"_+.:E:S"[/color] '( (-4 . [color=MAROON]"<OR"[/color]) (0 . [color=MAROON]"CIRCLE,ELLIPSE"[/color]) (-4 . [color=MAROON]"<AND"[/color]) (0 . [color=MAROON]"*POLYLINE,SPLINE"[/color]) (-4 . [color=MAROON]"&="[/color]) (70 . 1) (-4 . [color=MAROON]"AND>"[/color]) (-4 . [color=MAROON]"OR>"[/color]) ) ) ) ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s (SelectInside ([color=BLUE]ssname[/color] s 0) 100)) ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] a)) ([color=BLUE]if[/color] ([color=BLUE]ssmemb[/color] ([color=BLUE]setq[/color] e ([color=BLUE]ssname[/color] a ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i)))) s) ([color=BLUE]ssdel[/color] e a) ) ) ) ) ([color=BLUE]sssetfirst[/color] [color=BLUE]nil[/color] a) ([color=BLUE]princ[/color]) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) Commands: SelIn and SelOut Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 legend, lee, nice one. although the SELOUT doesn't seem to work? i select the set of objects, fine, then click my circle and nothing happens. am i doing it wrong? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 22, 2011 Share Posted June 22, 2011 legend, lee, nice one.although the SELOUT doesn't seem to work? i select the set of objects, fine, then click my circle and nothing happens. am i doing it wrong? Cheers mate For SelOut there are two prompts - one for the Exterior Set and one for the Boundary Object. EDIT: I should learn to read - I'll do some testing. Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 it works with a rectangle, but not a circle Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 22, 2011 Share Posted June 22, 2011 For the WP Selection to work the boundary object needs to be completely on screen, but other than that, it seems to work for me. Quote Link to comment Share on other sites More sharing options...
designerstuart Posted June 22, 2011 Share Posted June 22, 2011 yes it is working well for me too. must have been my error. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 22, 2011 Share Posted June 22, 2011 Thanks for testing, glad it works 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.