Trim parameter values for trailing zeros

Trim parameter values for trailing zeros

Skadborg.NTI
Advocate Advocate
438 Views
2 Replies
Message 1 of 3

Trim parameter values for trailing zeros

Skadborg.NTI
Advocate
Advocate

If I set the value of a numerical parameter with this code:

SyntaxEditor Code Snippet

ThisDoc.Document.ComponentDefinition.Parameters.Item("test").Value=100

then the parameter actually gets the value 1000,00000000 mm. Of course it has no impact on my model, but the visual presentation of my input forms are cluttered by all these trailing zeros.

Any suggestion on how to trim the trailing zeros?

439 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni

What do you mean by "input forms"?  Do you mean Inventor dialogs or your custom dialogs?


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

Skadborg.NTI
Advocate
Advocate

If I make an iLogic form, and then expose the parameter on that form:

 

Forms.png

 

 

 

 

 

 

 

 

 

 

 

 

The first is when the value is entered through build-in Inventor dialogs. like fx.

The second is after changing the value through the API with this:

ThisDoc.Document.ComponentDefinition.Parameters.Item("test").Value=100
0 Likes