I am using this
(setq DL(ssget "W" P1 P2 (list (cons 0 "line")(cons 8 "C-ROAD-PROF-GRID-MAJR"))))
to select the line on the layer c-road-prof-grid-majr but i would like to know how to add an additional filter so that it will select the lines on the layer c-road-prof-grid-majr that are at the angle of 90. I do know know the group number.
I use this
(setq info (entget (car (entsel "\nSelect Object: "))))
to list the common groups but it does not list all off them is there another string that will list more or is there a document some where that list them?
I have some vertical lines (more that 2) and i would would like the code to pick the 2 outer lines and draw a line between them ignoring the lines in the middle. Imagine vertical lines and you want to connect the most outer lines with a horizontal line making a U.
The code will seach the file for lines on the layer c-temp and then draw another line connecting the two outer horizontal lines. Can anyone help with this
Thanks
There is no dxf code for line angle. You will need to select the lines and filter the selection programmatically.
@rphillips wrote:.... i would like to ... select the lines ... that are at the angle of 90. ....
....
I have some vertical lines (more that 2) and i would would like the code to pick the 2 outer lines and draw a line between them ignoring the lines in the middle. Imagine vertical lines and you want to connect the most outer lines with a horizontal line making a U.
....
Some questions for you: Would all the vertical Lines always be drawn from the bottom up, that is, truly be at an angle of 90 degrees by AutoCAD's definition of that, or might some of them be at an angle of 270 degrees? It would make a difference to how you would determine where to draw the horizontal Line. And would their ends always align horizontally? If they might not, would you want a not-necessarily-horizontal Line to connect their bottom ends, or a horizontal Line regardless? If the latter, should it meet the bottom end of one of the vertical Lines, or average their Y coordinates, or be positioned by some other determination?
DFX 10 for a line is the start point.
DFX 11 is the end point.
Using (angle (dfx 10) (dfx 11)) will return the value in radians.
I do not think we can set up a boolean equation inside the filter list to cover this.
See Relational Tests and Logical Grouping of Filter Test sections in the AutoLISP reference.
What you will be looking for is
(= (angle (dfx 10) (dfx 11)) (/ pi 2.0)) or
(= (angle (dfx 10) (dfx 11)) (* 3.0 (/ pi 2.0)))
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
@scot-65 wrote:....
What you will be looking for is
(= (angle (dfx 10) (dfx 11)) (/ pi 2.0)) or
(= (angle (dfx 10) (dfx 11)) (* 3.0 (/ pi 2.0)))
....
If it doesn't matter whether vertical is upward or downward, you could cover both possibilities with one check, not for the angle but for whether the X coordinates of the endpoints are the same [within whatever precision you want]:
(equal (cadr (assoc 10 edata)) (cadr (assoc 11 edata)) 1e-8)