Inventor Customization

Inventor Customization

Reply
Valued Contributor
GavoGarmo
Posts: 81
Registered: ‎10-10-2012
Message 1 of 7 (423 Views)
Accepted Solution

iLogic equation answers in radians. I need degrees. (Probably a Noob question)

423 Views, 6 Replies
03-04-2013 09:24 AM

Hi,

 

I'm trying to do a simple Trig equation in iLogic, but it's returning the value in radians even though the parameter is set to Degrees. (Please see attached)

 

Is there something I need to add to my code to make it return an answer in degrees.

 

Thanks in advance.

 

GavoGarmo

or try this..

 

t1 = (SpecialBevelDim1 / SpecialBevelDim2)
i1 = Atan(t1) * (180 / PI) 'Rad to Deg
t1 = (SpecialBevelDim2 / SpecialBevelDim1)
i2 = Atan(t2) * (180 / PI) 'Rad to Deg

 

Valued Contributor
wowens63
Posts: 98
Registered: ‎06-22-2007
Message 2 of 7 (418 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-04-2013 09:42 AM in reply to: GavoGarmo

Public Function RToD(passnum As Double) As Double
    Return passnum * (180 / PI)
End Function

Public Function DToR(passnum As Double) As Double
    Return  passnum * (PI / 180)
End Function

 

Valued Contributor
GavoGarmo
Posts: 81
Registered: ‎10-10-2012
Message 3 of 7 (413 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-04-2013 09:47 AM in reply to: wowens63

Thanks for the fast reply, but how does that code fit around my existing iLogic code?

 

I've tried it in a few differnt positions but it's just spitting up errors.

 

 

Valued Contributor
wowens63
Posts: 98
Registered: ‎06-22-2007
Message 4 of 7 (391 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-04-2013 10:35 AM in reply to: GavoGarmo

see if this helps...

 

Sub Main
	Dim dNumber As Double = 45
	MsgBox(dNumber & " Deg")
	
	Dim dNumber1 as Double = DToR(dNumber)
	MsgBox(dNumber1 & " Rad")
	
	Dim dNumber2 as Double = RToD(dNumber1)
	MsgBox(dNumber2 & " Deg")

End Sub

Public Function RToD(passnum As Double) As Double
    Return passnum * (180 / PI)
End Function

Public Function DToR(passnum As Double) As Double
    Return  passnum * (PI / 180)
End Function

 

Valued Contributor
wowens63
Posts: 98
Registered: ‎06-22-2007
Message 5 of 7 (390 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-04-2013 10:38 AM in reply to: GavoGarmo

if that did not help try this..

 

Dim dNumber As Double = 45
	MsgBox(dNumber & " Deg")
	
	Dim dNumber1 as Double = dNumber * (PI / 180) 'Deg to Rad
	MsgBox(dNumber1 & " Rad")
	
	Dim dNumber2 as Double = dNumber1 * (180 / PI) 'Rad to Deg
	MsgBox(dNumber2 & " Deg")

 

Valued Contributor
wowens63
Posts: 98
Registered: ‎06-22-2007
Message 6 of 7 (383 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-04-2013 10:48 AM in reply to: GavoGarmo

or try this..

 

t1 = (SpecialBevelDim1 / SpecialBevelDim2)
i1 = Atan(t1) * (180 / PI) 'Rad to Deg


t1 = (SpecialBevelDim2 / SpecialBevelDim1)
i2 = Atan(t2) * (180 / PI) 'Rad to Deg

 

Valued Contributor
GavoGarmo
Posts: 81
Registered: ‎10-10-2012
Message 7 of 7 (369 Views)

Re: iLogic equation answers in radians. I need degrees. (Probably a Noob questio

03-05-2013 12:50 AM in reply to: wowens63

Hi,

 

I'd put in a mathmatical solution earlier in the day, but it seemed like a bit of a fudge through, so was hoping there was a way to just flip the units from one to the other.

 

The VB stuff is still a bit of a mystery to me at the moment, so I think the mathmatical solution is probably best for people at my level of programming.

 

Thanks again for your help.

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!