09-28-2022
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-28-2022
04:18 AM
Hi @18154093. This is what I had in mind for your challenge. Inventor's built-in UnitsOfMeasure object has many useful tools for things like this. Also, I just assumed you were working with inches, but if that is not the case, you can change those aspects within the code. The database units for length are centimeters, and it seems like very few people actually use that as their default document units.
Dim oStVal As String = "1/12"
Dim UOM As UnitsOfMeasure = ThisDoc.Document.UnitsOfMeasure
Dim oDblVal As Double = UOM.GetValueFromExpression(oStVal, "in")
oDblVal = UOM.ConvertUnits(oDblVal, "cm", "in")
MsgBox("oDblVal = " & oDblVal,,"")
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS)
.
Wesley Crihfield
(Not an Autodesk Employee)