Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
a81383
315 Views, 1 Reply

API converting to centimeters, how do I retrieve inches

Hello,

 

I'm retrieving a parameter value using "userparams("S1GW").Value". This method automatically converts my inch value to cm. How do I retrieve my original inch value without the conversion to cm? 

 

	Dim userparams As UserParameters = oADef.Parameters.UserParameters
	For Each Param In userparams

			Dim oTotalDict As New Dictionary(Of String, String)
			oTotalDict.Add(userparams("S1GW").Name, userparams("S1GW").Value)

 

JelteDeJong
in reply to: a81383

The most simple example looks like this:

Dim doc As PartDocument = ThisDoc.Document
Dim param As [Parameter] = doc.ComponentDefinition.Parameters.Item("TestParameter")

Dim uom = doc.UnitsOfMeasure
uom.ConvertUnits(param.Value, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits)

But you can find more information about converting units here:

http://www.hjalte.nl/46-parameter-document-database-units

There you will also find a method to convert to fractional strings .

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com