Select Lines Based on X Value Only

Select Lines Based on X Value Only

kpennell
Collaborator Collaborator
784 Views
3 Replies
Message 1 of 4

Select Lines Based on X Value Only

kpennell
Collaborator
Collaborator

Is there a way to select lines based on a known X value?

 

Something like....

 

(setq LinesAt300 (ssget "X" '((10 300.00 ? ?))))

 

There are lots of other entities in the way, so "WP" and sorting through all the entities is not that preferable.

0 Likes
785 Views
3 Replies
Replies (3)
Message 2 of 4

Ranjit_Singh
Advisor
Advisor

Use -4 dxf code

(ssget "_x" '((0 . "line") (-4 . "=") (10 300 0 0)))

The zeroes in (10 300 0 0) are only for syntax, doesn't mean you are finding lines with a starting point of 300,0,0. You use 0 or any other number but cannot use ?  If you want to also test for y and z values then do something line (-4 . "=,>,*") The function of >, * should be pretty obvious. There are also binary operators that can be used in -4 dxf code.

 

Message 3 of 4

SeeMSixty7
Advisor
Advisor

@Ranjit_Singh I did not know about the 0's on the other values of the point. That's great. You have taught me something twice today! SCORE!

 

@kpennell Since lines can have either end point at the xpoint I expanded on Ranjit's code to include the 11 code.

 

(setq myss (ssget "X" (list (cons 0 "LINE") (cons -4 "<OR")
			              (cons -4 "=") (cons 10 (list 10.0 0 0))
			              (cons -4 "=") (cons 11 (list 10.0 0 0))
			              (cons -4 "OR>")
)))

Good Luck,

 

0 Likes
Message 4 of 4

john.uhden
Mentor
Mentor

If I recall correctly, you can specify both x and y or even x, y, and z in one filter, as in

'(-4 . "=,=,=") '(10 10.0 30.0 0.0)

including mixing in >, <, >=, etc.

John F. Uhden

0 Likes