Isaac26a Posted 16 hours ago Posted 16 hours ago (edited) Hello again, I had this task that I usually have from time to time and wondered if there is a way to select only the vertical lines that are in the drawing to delete them, some are slightly to one side left or right. I was wondering if something like select the lines and sort them by a difference of the x coordinate of the start point less the x coordinate of the end point plus a fuzz distance equals zero or maybe there is something much more simple to do, here is the image and the sample dwg file Thanks to all for your kind help. sample01.dwg Edited 16 hours ago by Isaac26a Quote
mhupp Posted 14 hours ago Posted 14 hours ago (edited) ssget lines check endpoints to get angle tho not so vertical. vert.mp4 SVL.lsp Edited 14 hours ago by mhupp 1 Quote
Isaac26a Posted 14 hours ago Author Posted 14 hours ago Thank you Mhupp, it works like charm, I didn't know that '(equal )' would work like that, I thought that would return nil everytime, something new to learn, thank you again for your help. 1 Quote
mhupp Posted 7 hours ago Posted 7 hours ago Its using the fuzz option. looking for lines that have an angle that doesn't match 90° or 270° +/- the fuzz and removing them from the selection. So if you used 5 it would remove any line that outside of 85-95 and 265-275 You have to check both angles because of how the lines are drawn. Quote fuzz Type: Integer or Real A real number defining the maximum amount by which expr1 and expr2 can differ and still be considered equal. https://help.autodesk.com/view/ACAD_E/2026/ENU/?guid=GUID-7E85CB8F-B4DA-42F3-ABD3-89342A11EF9B Quote
Lee Mac Posted 7 hours ago Posted 7 hours ago Another - (defun c:test ( / e i s x ) (if (setq s (ssget "_X" '((0 . "LINE")))) (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) x (entget e) ) (if (not (equal (cadr (assoc 10 x)) (cadr (assoc 11 x)) 1e-8)) (ssdel e s) ) ) ) (sssetfirst nil s) (princ) ) 2 Quote
marko_ribar Posted 3 hours ago Posted 3 hours ago (edited) It is unclear what should routine do with angled lines that are neither horizontal, nor vertical... Lee's example is removing from sel. set all horizontal lines and thus all angled and verticals are remained for (sssetfirst) deletion upon routine finish... Edited 3 hours ago by marko_ribar Quote
Isaac26a Posted 3 hours ago Author Posted 3 hours ago (edited) 4 hours ago, mhupp said: You have to check both angles because of how the lines are drawn. Quote fuzz Type: Integer or Real A real number defining the maximum amount by which expr1 and expr2 can differ and still be considered equal. https://help.autodesk.com/view/ACAD_E/2026/ENU/?guid=GUID-7E85CB8F-B4DA-42F3-ABD3-89342A11EF9B Thank you, with this information is easy to understand how it works, in the information that I had of the command didn't had the fuzz use, guess I have to check on the online site more about the commands again, there might be some things I'm missing Edited 2 hours ago by Isaac26a Quote
Isaac26a Posted 3 hours ago Author Posted 3 hours ago (edited) 4 hours ago, Lee Mac said: Another Thank you Lee, you did what I was thinking about, you used the difference in 'x' with a fuzz, also used '(equal )' with the fuzz, thanks as all of your work in the most simple way and in few lines. Amazing all your work, thank you. Edited 2 hours ago by Isaac26a Quote
Isaac26a Posted 3 hours ago Author Posted 3 hours ago 12 minutes ago, marko_ribar said: It is unclear what should routine do with angled lines that are neither horizontal, nor vertical... Lee's example is removing from sel. set all horizontal lines and thus all angled and verticals are remained for (sssetfirst) deletion upon routine finish... My apologies if I'm not clear in the things I want to be realized, sometimes I think is best that the images make it clear but I'll try to elaborate more on my following posts. thanks for your interest Quote
Lee Mac Posted 35 minutes ago Posted 35 minutes ago 3 hours ago, marko_ribar said: It is unclear what should routine do with angled lines that are neither horizontal, nor vertical... Lee's example is removing from sel. set all horizontal lines and thus all angled and verticals are remained for (sssetfirst) deletion upon routine finish... That's incorrect; my code is only retaining vertical lines (to within a tolerance of 1e-8) - any line for which the x-coordinate of the start point does not match the x-coordinate of the end point (up to the tolerance stated) will be removed from the set. Quote
Lee Mac Posted 35 minutes ago Posted 35 minutes ago 2 hours ago, Isaac26a said: Thank you Lee, you did what I was thinking about, you used the difference in 'x' with a fuzz, also used '(equal )' with the fuzz, thanks as all of your work in the most simple way and in few lines. Amazing all your work, thank you. You're welcome! I'm glad it helps. 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.