Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

user parameter ,number of decimal places

2 REPLIES 2
Reply
Message 1 of 3
swordmaster
400 Views, 2 Replies

user parameter ,number of decimal places

Hi,

I have two user parameters to which i assign the values of the flat pattern extents. All good until the extents value is a whole number

ie if the extents value is 24.000 the user parameter value is 24

I need the user parameter to  3 decimal places .

Should be easy, but not seeing this right now, any ideas?

 

thanks 

Inventor 2010 Certified Professional
2 REPLIES 2
Message 2 of 3
2paul
in reply to: swordmaster

Maybe ??

Dim test As String
test = Format ("5","0.000")
MsgBox test

Message 3 of 3
M
Contributor
in reply to: swordmaster

If this post is not dead, and You are still using Inventor 2010 You might try this code, wchich changes the precision and trailing zeros display for user parameters. the below code works for inventor 2013, I'm not sure if it works for earlier versions.

 

Dim oDoc As PartDocument
oDoc=ThisApplication.ActiveDocument
Dim oParameter As Parameter
Dim oFormat As CustomPropertyFormat

For Each oParameter In oDoc.ComponentDefinition.Parameters.UserParameters
   oFormat=oParameter.CustomPropertyFormat
   oParameter.ExposedAsProperty=True
   
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision

   oFormat.ShowUnitsString=False
   oFormat.ShowLeadingZeros=True
   oFormat.ShowTrailingZeros=True
Next oParameter

APDSU 2015-2021
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report