- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello! I'm building a simple python script and I'm having trouble getting it to output with the correct units.
Code and pictures below. Any quick ideas about where I've gone wrong?
Thank you!
Mike
import adsk.core, adsk.fusion
app = adsk.core.Application.get()
ui = app.userInterface
design = app.activeProduct
distance = "2 m"
input = distance
createInput = ui.inputBox('Enter distance', 'Distance', input)
if createInput[0]:
(input, isCancelled) = createInput
distance = input
ui.messageBox('Distance: ' + distance)
#This is where I'm having trouble getting the units to be correct
unitsMgr = design.unitsManager
realValue = unitsMgr.evaluateExpression(distance, unitsMgr.defaultLengthUnits)
isValid = True
ui.messageBox('real value: ' + str(realValue))
Autodesk Fusion 360 Evangelist
Solved! Go to Solution.