App::PropertyAngle

Need help, or want to share a macro? Post here!
keithsloan52
Posts: 799
Joined: Mon Feb 27, 2012 5:31 pm

App::PropertyAngle

Postby keithsloan52 » Fri Mar 15, 2019 7:06 am

If I specify a property as PropertyAngle what python sees is a string "30 deg"

Is there a way to set it to either radians or degrees?
User avatar
Chris_G
Posts: 992
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: App::PropertyAngle

Postby Chris_G » Fri Mar 15, 2019 8:13 am

Hi,
I don't know if you can change the internal unit of the property, but you can set the property with the unit of your choice :

Code: Select all

fp = App.ActiveDocument.addObject("Part::FeaturePython","fp")
fp.addProperty("App::PropertyAngle","angle")

fp.angle = 30
fp.angle
>>> 30 deg

fp.angle = "pi rad"
fp.angle
>>> 180 deg