Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Angle indicator?

9 REPLIES 9
Reply
Message 1 of 10
BillZ
189 Views, 9 Replies

Angle indicator?

R14 Autolisp;;;;;;;
I'm trying to find a way to determine if an angle that I need to set (ang3), falls between two given angles that are determmined by a center point and the endpoints of a line (ang 1 & ang2). I can't say if the angle I need to set is larger than ang1 but smaller than ang2 because sometimes ang1 is smaller than ang2 and sometimes not.
Any ideas?
Thanks
BillZ
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: BillZ

Then the first chore would be to compare ang1 and ang2 to determine which is
the larger ... *then* do your "betweenness" determination. You may run into
another problem where one of the lines is at, say -10 degrees (350), and the
other is at +10 degrees; if you want the "betweenness" on the acute side of
this angle, you'll have to make special accommodation, otherwise you'll get
a calculation with respect to the obtuse side.
___

"BillZ" wrote in message
news:f0846cd.-1@WebX.maYIadrTaRb...
> sometimes ang1 is smaller than ang2 and sometimes not.
Message 3 of 10
BillZ
in reply to: BillZ

Thanks ,
I'll go from there, but hang tight, I'll probably be back on this one.
BillZ
Message 4 of 10
Anonymous
in reply to: BillZ

;;-------------------------------------------------------
;; Function to determine if an angle is within the sector
;; defined by two other angles.
;; Returns the delta angle from the first angle.
;;
(defun @insect (|ang |ba |ea)
(cond
((equal |ang |ba |fuzz)(setq |ang |ba))
((equal |ang |ea |fuzz)(setq |ang |ea))
)
(if (> |ba |ea)
(cond
((>= |ang |ba)(- |ang |ba))
((<= |ang |ea)(+ |ang (- 2pi |ba)))
(1 nil)
)
(if (and (>= |ang |ba)(<= |ang |ea))
(- |ang |ba)
nil
)
)
)

BTW, 2pi is assumed as a global... (setq 2pi (* pi 2))

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"BillZ" wrote in message
news:f0846cd.-1@WebX.maYIadrTaRb...
> R14 Autolisp;;;;;;;
> I'm trying to find a way to determine if an angle that I need to set
(ang3), falls between two given angles that are determmined by a center
point and the endpoints of a line (ang 1 & ang2). I can't say if the angle I
need to set is larger than ang1 but smaller than ang2 because sometimes ang1
is smaller than ang2 and sometimes not.
> Any ideas?
> Thanks
> BillZ
>
Message 5 of 10
BillZ
in reply to: BillZ

I'lol give it a try!
Thanks
BillZ
Message 6 of 10
BillZ
in reply to: BillZ

I don't understand the part of the code.
(1 nil) or (- ang ba), shouldn't I be setting a variable after the conditions?
BillZ
Message 7 of 10
BillZ
in reply to: BillZ

I don't seem to be getting any result. The angles I feed it don't change any.
Help!
BillZ
Message 8 of 10
Anonymous
in reply to: BillZ

The function was written to determine if 'ang falls between 'ba (beginning
angle) and 'ea (ending angle) as we would find in an ARC's entity data
(always CCW). So it would make a big difference which angles you fed as 'ba
and 'ea. For instance, if 'ba were pi/5 and 'ea were pi/3 and 'ang were
pi/4, it would return the difference of pi/20, but if 'ba and 'ea were
switched it would return nil.

BTW, all values are in radians.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"BillZ" wrote in message
news:f0846cd.5@WebX.maYIadrTaRb...
> I don't seem to be getting any result. The angles I feed it don't change
any.
> Help!
> BillZ
>
Message 9 of 10
BillZ
in reply to: BillZ

Yes, I understand what the program is supposed to do. but even if I feed it a value for ang that I know is between ba and ea, the only result I get is nil.
I'm looking things over to see if it's something I did but I've tested it several times with the same result.
BillZ
Message 10 of 10
BillZ
in reply to: BillZ

Sorry,
It's been a long day and I've only been here a half hour.
The angle I was looking for was not between the 2 angles like I thought originally. The program works fine.
Thank again.
BillZ

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost