UnitsOfMeasure.GetTypeFromString Method Error

UnitsOfMeasure.GetTypeFromString Method Error

Genicee
Advocate Advocate
366 Views
2 Replies
Message 1 of 3

UnitsOfMeasure.GetTypeFromString Method Error

Genicee
Advocate
Advocate

I don't know If I missing something, but UnitsOfMeasure.GetTypeFromString Method throws an exception when the Parameter Unit I enter is a "Text" 

 

For Eample In a part of my Function to determine what kind of Unit I am working with I have a Case for "Text", but it seems to throw an error when the Part Parameter I enter Unit Type is a "Text"

Select Case oUOM.GetTypeFromString(Parameter.Units)
    Case 11346
       Return Parameter.Value
End Select

 

0 Likes
367 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni

The GetTypeFromString function is designed to fail if the input string is not represented by one of the types in UnitTypesEnum.  However, Text and Boolean types are supported and should return the correct type and currently do not.  I've filed a change request so the issue can be addressed.  For the current time you'll need to special case and look specificially for Text and Boolean types.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 3

Genicee
Advocate
Advocate

Thank you,

 

That is what I ended up doing. I was just wanted to check to make sure it wasn't a bug of some sort.

0 Likes