Jump to content

Recommended Posts

Posted (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.jpg

sample01.dwg

Edited by Isaac26a
Posted (edited)

 ssget lines check endpoints to get angle tho not so vertical.

 

 

 

 

SVL.lsp

Edited by mhupp
  • Like 1
Posted

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.

  • Like 1
Posted

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

Posted

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)
)

 

  • Like 2
Posted (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 by marko_ribar
Posted (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 by Isaac26a
Posted (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 by Isaac26a
Posted
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

Posted
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.

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...