Need to Remove Decimal Precision from Custom Drawing Properties

Need to Remove Decimal Precision from Custom Drawing Properties

Anonymous
Not applicable
1,990 Views
2 Replies
Message 1 of 3

Need to Remove Decimal Precision from Custom Drawing Properties

Anonymous
Not applicable

Hello,

 

So I've created an iLogic template that controls the width of an assembly using custom parameters.  BUT, volume is an important factor in our drawings, so i was able to get iLogic to retrieve the volumes of the individual foams using the following code.

 

Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 32268 StartFragment: 314 EndFragment: 32236 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet

If Pax_Width_Center = "16.3" Then
Parameter("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam.Pax_Width") = "16.3"
iLogicVb.RunRule("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam", "Pax_Width")
iProperties.Value("Custom", "Assembly Volume")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Total")
iProperties.Value("Custom", "Foam Volume-Ethafoam")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Ethafoam")
iProperties.Value("Custom", "Foam Volume-FPI21ST")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI21ST")
iProperties.Value("Custom", "Foam Volume-FPI55")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI55")
iLogicVb.UpdateWhenDone = True

ElseIf Pax_Width_Center = "16.8" Then
Parameter("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam.Pax_Width") = "16.8"
iLogicVb.RunRule("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam", "Pax_Width")
iProperties.Value("Custom", "Assembly Volume")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Total")
iProperties.Value("Custom", "Foam Volume-Ethafoam")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Ethafoam")
iProperties.Value("Custom", "Foam Volume-FPI21ST")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI21ST")
iProperties.Value("Custom", "Foam Volume-FPI55")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI55")
iLogicVb.UpdateWhenDone = True

ElseIf Pax_Width_Center = "17.3" Then
Parameter("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam.Pax_Width") = "17.3"
iLogicVb.RunRule("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam", "Pax_Width")
iProperties.Value("Custom", "Assembly Volume")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Total")
iProperties.Value("Custom", "Foam Volume-Ethafoam")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Ethafoam")
iProperties.Value("Custom", "Foam Volume-FPI21ST")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI21ST")
iProperties.Value("Custom", "Foam Volume-FPI55")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI55")
iLogicVb.UpdateWhenDone = True

ElseIf Pax_Width_Center = "17.8" Then
Parameter("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam.Pax_Width") = "17.8"
iLogicVb.RunRule("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam", "Pax_Width")
iProperties.Value("Custom", "Assembly Volume")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Total")
iProperties.Value("Custom", "Foam Volume-Ethafoam")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-Ethafoam")
iProperties.Value("Custom", "Foam Volume-FPI21ST")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI21ST")
iProperties.Value("Custom", "Foam Volume-FPI55")=iProperties.Value("SPECTRUM BOTTOM CUSHION ASSEMBLY-RECONFIGURED.iam","Custom","Foam Volume-FPI55")
iLogicVb.UpdateWhenDone = True

End If

 

The code works and the iProperties were able to be imported into my notes block, but the amount of trailing decimal places is way too high; these volumes should be rounded to the nearest cubic inch.  How can I get these volumes to successfully round to the nearest cubic inch, and completly eliminate the trailing decimal places from the paremeters?

0 Likes
1,991 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant

Hi t.desrosiers,

 

See these links for examples of setting the custom property format (assuming the custom iProperty is exported from a parameter):

http://forums.autodesk.com/t5/inventor-general-discussion/ilogic-adding-user-parameters-with-custom-...

http://forums.autodesk.com/t5/inventor-customization/custom-property-format-in-ilogic/td-p/3166376

 

 

If the custom iProperty does not come from a parameter, I don't think there is a way to set the precision (hope I'm remembering that wrong), so you might just create a custom parameter and export it to the custom iProperty, and set the precision and formatting.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

For reference:

CustomPropertyPrecisionEnum Enumerator

Description

Enum specifying the precision for custom property.

Methods

Name Value Description
kDegreesAnglePrecision 85522 Degrees Precision.
kEightDecimalPlacesPrecision 85513 Eight Decimal Places Precision.
kEighthsFractionalLengthPrecision 85517 Eighths Fractional Precision.
kFiveDecimalPlacesPrecision 85510 Five Decimal Places Precision.
kFourDecimalPlacesPrecision 85509 Four Decimal Places Precision.
kHalfFractionalLengthPrecision 85515 Half Fractional Precision.
kMinutesAnglePrecision 85523 Minutes Precision.
kOneDecimalPlacePrecision 85506 One Decimal Place Precision.
kOneTwentyEighthsFractionalLengthPrecision 85521 OneTwentyEighths Fractional Precision.
kQuarterFractionalLengthPrecision 85516 Quarter Fractional Precision.
kSecondsAnglePrecision 85524 Seconds Precision.
kSecondsFourDecimalPlaceAnglePrecision 85528 Seconds Four Decimal Place Precision.
kSecondsOneDecimalPlaceAnglePrecision 85525 Seconds One Decimal Place Precision.
kSecondsThreeDecimalPlaceAnglePrecision 85527 Seconds Three Decimal Place Precision.
kSecondsTwoDecimalPlaceAnglePrecision 85526 Seconds Two Decimal Place Precision.
kSevenDecimalPlacesPrecision 85512 Seven Decimal Places Precision.
kSixDecimalPlacesPrecision 85511 Six Decimal Places Precision.
kSixteenthsFractionalLengthPrecision 85518 Sixteenths Fractional Precision.
kSixtyFourthsFractionalLengthPrecision 85520 SixtyFourths Fractional Precision.
kThirtySecondsFractionalLengthPrecision 85519 ThirtySeconds Fractional Precision.
kThreeDecimalPlacesPrecision 85508 Three Decimal Places Precision.
kTwoDecimalPlacesPrecision 85507 Two Decimal Places Precision.
kZeroDecimalPlacePrecision 85505 Zero Decimal Place Precision.
kZeroFractionalLengthPrecision 85514 Zero Fractional Precision.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks for the prompt reply, but the iLogic code takes the value from the iProperties themselves, which in turn are derived from the model I'm working with. How ever, the ref chart you supplied is a step in the right direction.
0 Likes