Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: 18154093

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) :thumbs_up:.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)