# Filter to line list angle 90

## Recommended Posts

```(setq lineset (ssget"C"pt1 pt2  '((0 . "LINE") (8 . "Layer1")))); lines on laye1
```

How can filter lines in layer1 and angle 90

##### Share on other sites

Hi,

You need to iterate through each line entity name from the selection set then get the start and end coordinates and assign them to variable names 'p1' and 'p2' and the following codes would return T if the angle of line is equal to 90.0 Degs.

```(vl-some '(lambda (ang)
(equal ang (* pi 0.5) 1e-4)
)
(list (angle p1 p2) (angle p2 p1))
)```

Good luck.

##### Share on other sites
Hi,

You need to iterate through each line entity name from the selection set then get the start and end coordinates and assign them to variable names 'p1' and 'p2' and the following codes would return T if the angle of line is equal to 90.0 Degs.

```(vl-some '(lambda (ang)
(equal ang (* pi 0.5) 1e-4)
)
(list (angle p1 p2) (angle p2 p1))
)```

Good luck.

Thanks Mr. Tharwat.

##### Share on other sites
Thanks Mr. Tharwat.

You're welcome anytime wimal.

##### Share on other sites
Hi,

You need to iterate through each line entity name from the selection set then get the start and end coordinates and assign them to variable names 'p1' and 'p2' and the following codes would return T if the angle of line is equal to 90.0 Degs.

```(vl-some '(lambda (ang)
(equal ang (* pi 0.5) 1e-4)
)
(list (angle p1 p2) (angle p2 p1))
)```

Good luck.

FWIW .. you could simplify to this:

`(eq (rem angle pi) (/ pi 2.))`

##### Share on other sites
FWIW .. you could simplify to this:

`(eq (rem angle pi) (/ pi 2.))`

Nice approach ronjonp.

##### Share on other sites
Nice approach ronjonp.

Cheers!!

##### Share on other sites

Not sure whether OP wants to test for +/- pi/2 or multiples of pi/2, but for the former you could use:

`(equal 0 (cos <angle>) 1e-`

And for the latter:

`(or (equal 0 (cos <angle>) 1e- (equal 1 (cos <angle>) 1e-)`