I’m getting close to what I need but I’m falling a little short. I’m trying to make everything show to the 3rd decimal place. My code is rounding everything to the 3rd decimal place but not always showing decimal to the 3rd place.
My Code so Far:
'Rounding Strap
inc = .0625 ' rounding increment ( .125, .25, .5, etc)
Strap = (WearPlateIR + WearPlateOR)*3.14
Strap_Rounded = Round(Round(Round(Strap,4) / inc) * inc,3)
'Rounding OD AND THICKNESS
Round_OD = WearPlateOR*2
Round_THICK = WearPlateOR-WearPlateIR
FINISHED_OD = Round(Round(Round(Round_OD,4) / inc) * inc,3)
FINISHED_THICK = Round(Round(Round(Round_THICK,4) / inc) * inc,3)
'TF Bom (Description)
iProperties.Value("Custom", "TF BOM")="=SLEEVE " & FINISHED_OD & " OD x " & FINISHED_THICK & " WALL x <WearPlateWidth> LG, STRAP=" & Strap_Rounded & " (CUT INTO TWO HALVES)"
What I’m getting Example:
SHELL 20.75 OD x 0.375 WALL x 9.000 LG, STRAP=64 (CUT INTO TWO HALVES)
What I want Example:
SHELL 20.750 OD x 0.375 WALL x 9.000 LG, STRAP=64.000 (CUT INTO TWO HALVES)
I know I could go thru the user parameters and do it that way (it would have been easier that way but there are several hundred already done). The easiest thing for me to do now is paste some code into each one and be done with them.
I would appreciate any help that you might be able to give me.
Thank you
Solved! Go to Solution.
Solved by jddickson. Go to Solution.
I figured it out. If anyone would like to know how I did it (doesn’t mean that it’s right) the fixed code is below.
New Code:
'Rounding inc
inc = .0625 ' rounding increment ( .125, .25, .5, etc)
'Rounding OD AND THICKNESS
FINISHED_THICK = Format(Round(Round(Round(Thickness,4) / inc) * inc,3),".000")
FINISHED_WIDTH = Format(Round(Round(Round(Width,4) / inc) * inc,3),".000")
FINISHED_LENGTH = Format(Round(Round(Round(Length,4) / inc) * inc,3),".000")
'TF Bom (Description)
iProperties.Value("Custom", "TF BOM")="=PLATE "& FINISHED_THICK &" X "& FINISHED_WIDTH &" X "& FINISHED_LENGTH &""
'Rounding Mass
iProperties.Value("Custom", "Mass")=Round(iProperties.Mass)
iProperties.Value("Custom", "Masskg")=Round(iProperties.Mass*0.45359237)