wimal Posted May 14, 2018 Share Posted May 14, 2018 (setq lineset (ssget"C"pt1 pt2 '((0 . "LINE") (8 . "Layer1")))); lines on laye1 How can filter lines in layer1 and angle 90 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 14, 2018 Share Posted May 14, 2018 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. Quote Link to comment Share on other sites More sharing options...
wimal Posted May 14, 2018 Author Share Posted May 14, 2018 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 14, 2018 Share Posted May 14, 2018 Thanks Mr. Tharwat. You're welcome anytime wimal. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 14, 2018 Share Posted May 14, 2018 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.)) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 14, 2018 Share Posted May 14, 2018 FWIW .. you could simplify to this: (eq (rem angle pi) (/ pi 2.)) Nice approach ronjonp. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 14, 2018 Share Posted May 14, 2018 Nice approach ronjonp. Cheers!! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 14, 2018 Share Posted May 14, 2018 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-) Quote Link to comment Share on other sites More sharing options...
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.