Emily_83 Posted September 10, 2012 Share Posted September 10, 2012 Good Afternoon All, i was wondering if someone here could help me, i have done a search on the web and here trying to find what i am after but have had no luck. I need to erase a whole heap of lines ranging from about 1.25 to 3 in length, i need to do this in multiple xrefs, just realised you can't use QSELECT in script, and the SSX command does not do the trick either, does anyone out there have a script/lisp routine that erases the specified length of lines in multiple drawings? i hope this enough information. cheers Emily Quote Link to comment Share on other sites More sharing options...
Dadgad Posted September 10, 2012 Share Posted September 10, 2012 Are you able to use the FILTER command instead? Once you have described it sufficiently, make sure you SAVE the filter for subsequent use. Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 Are you able to use the FILTER command instead?Once you have described it sufficiently, make sure you SAVE the filter for subsequent use. hi Dadgad, i have not really used the Filter command before, i tried using it earlier, but when i select one of the lines to add in the filter, it does not list it's length, and stince i am unfamiliar with the filter command, i am unsure weather it's going to work or not. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 10, 2012 Share Posted September 10, 2012 Try this ... (defun c:Test (/ ss i sn l) (if (setq ss (ssget "_:L" '((0 . "LINE")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq l (distance (cdr (assoc 10 (entget sn))) (cdr (assoc 11 (entget sn))))) (if (or (eq l 1.25) (eq l 3.0) (and (> l 1.25) (< l 3.0))) (entdel sn) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 Hi Tharwat, when i run the lisp, prompts me to select objects, and when i click on the line, it does not find it, i even windowed everything in my drawing and it still doesn't select anything, could it have something to do with the lines being polylines? Quote Link to comment Share on other sites More sharing options...
Dadgad Posted September 10, 2012 Share Posted September 10, 2012 It is a great tool, very helpful, unfortunately I have been trying to set it up for you too, and failed. It sounds like a very simple lisp, no doubt someone will soon help you sort it out. Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 Polylines don't have LENGTH.If you explode a few of them, into LINES, as a test, no doubt Tharwat's lisp will work. thanks Dadgad, the lisp works, however now that i have to explode the Plines, they explode into tiny lines, and also the routine erases other lines that are now the same length since exploding that i don't want erased, if it helps, i really only need all vertical lines erased of the length i specify. Quote Link to comment Share on other sites More sharing options...
Dadgad Posted September 10, 2012 Share Posted September 10, 2012 Emily I made a huge mistake in my earlier post POLYLINES do have length. I am guessing (I do not write lisp) that you need to change the "LINE" in Tharwat's code to "PLINE" . Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 hehe thanks Dadgad, i had a look before using QSELECT, then selecting polyline and saw that it does have the length, i thought it did as i usually use the QSELECT this way i also changed the "LINE" part of the lisp to "PLINE" but it did not work, might try "PL" thankyou for helping me i greatly appreciate it. Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 just changed it to "PL" and that does not work either:unsure: Quote Link to comment Share on other sites More sharing options...
Dadgad Posted September 10, 2012 Share Posted September 10, 2012 You're welcome, Tharwat is offline now, but I'm sure he will be back, or else one of the other lisperati will pick up on your thread and help you sort it out. Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 Thanks heaps Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 10, 2012 Share Posted September 10, 2012 You have mentioned into your first post that the objects are lines , and that 's why I included lines entities only . Anyway try this updated one to include Polylines as well . (defun c:Test (/ ss i sn l) (vl-load-com) (if (setq ss (ssget "_:L" '((0 . "LINE,*POLYLINE")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (eq (cdr (assoc 0 (entget sn))) "LINE") (setq l (distance (cdr (assoc 10 (entget sn))) (cdr (assoc 11 (entget sn))) ) ) (setq l (vlax-curve-getdistatparam sn (fix (vlax-curve-getendparam sn)) ) ) ) (if (or (eq l 1.25) (eq l 3.0) (and (> l 1.25) (< l 3.0))) (entdel sn) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 10, 2012 Share Posted September 10, 2012 Another variation: (defun c:eraselines ( / s ) (if (ssget "_:L" '((0 . "LINE,*POLYLINE"))) (progn (vlax-for o (setq s (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (if (<= 1.25 (vla-get-length o) 3.0) (vla-delete o)) ) (vla-delete s) ) ) (princ) ) (vl-load-com) (princ) Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 10, 2012 Author Share Posted September 10, 2012 Good morning Tharwat and Lee Mac, sorry Tharwat about giving you the wrong information both those routines work now .......however is there any chance to modify anyone of those Lips to erase strictly only 0.5, 1.25, 1.5 and 3 length PLINES?? hopefully if the image is clear enough below, the lines i need deleted are those of the viertical lines you see in the image, which are the specified lengths i have listed above. thankyou both very much for you help. Emily Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 11, 2012 Share Posted September 11, 2012 however is there any chance to modify anyone of those Lips to erase strictly only 0.5, 1.25, 1.5 and 3 length PLINES?? (defun c:Test (/ ss i sn l) (vl-load-com) (if (setq ss (ssget "_:L" '((0 . "LINE,*POLYLINE")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (eq (cdr (assoc 0 (entget sn))) "LINE") (setq l (distance (cdr (assoc 10 (entget sn))) (cdr (assoc 11 (entget sn))))) (setq l (vlax-curve-getdistatparam sn (fix (vlax-curve-getendparam sn)))) ) (if (or (eq l 0.5) (eq l 1.25) (eq l 1.5) (eq l 3.0)) (entdel sn) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 11, 2012 Share Posted September 11, 2012 (defun c:eraselines ( / l s ) (if (ssget "_:L" '((0 . "LINE,*POLYLINE"))) (progn (vlax-for o (setq s (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (setq l (vla-get-length o)) (if (vl-some '(lambda ( x ) (equal l x 1e-) '(0.5 1.25 1.5 3.0)) (vla-delete o) ) ) (vla-delete s) ) ) (princ) ) (vl-load-com) (princ) Quote Link to comment Share on other sites More sharing options...
Emily_83 Posted September 12, 2012 Author Share Posted September 12, 2012 (edited) Tharwat, Lee Mac, your both brilliant, thankyou so much both routines work perfectly, ........however!!!....i know i am sorry i have one more problem, in the image attached, the lisps do not erase these lines.....they are the 3.0 length but seem to be an un-closed/joined polyline type of ellipse looking thing, with an area, it does not matter if i close them and disable linetype, the lisp still does not erase these polylines (when i select the objects it does tell me they are polylines in the properties box). would you have any idea why that is? if not, not to worry you both and Dadgad, have been more than helpful. Cheers Emily [ATTACH=CONFIG]37068[/ATTACH] Edited September 12, 2012 by Emily_83 added the image Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 12, 2012 Share Posted September 12, 2012 I can't view the image for some reason Emily, I receive the following message when clicking on your attachment: Are you able to attach a sample drawing? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 12, 2012 Share Posted September 12, 2012 I can't view the image for some reason Emily, I receive the following message when clicking on your attachment: Same thing here . 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.