I have been working on a rule for use with our title block that has been mostly successful. The last hurdle is the precision of the DIM values. The will not show the trailing zeros no matter what I do. I have tried changing the precision of the values, but still I have no luck getting them to show 3 decimal places including the trailing zeros. Looking at the picture below I would like the DIM. (FINISHED) field to read 5.000x5.000x12.500. Is there some code that I can use to force this output? I would also like to force the DIM. (INITIAL) value to use 3 decimal places.
I have attached my code as well. Please note that I'm driving by brail so to speak and have no idea what I'm doing, .
If anyone could shed some light on this I would really appreciate it.
Darek
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
I hope function FormatNumber() can be useful for you.
I created a simple part model with three model dimensions bL, bW, bH having integer values:
Then I’ve created an iLogic rule that updates custom text iProperty "DIM (Finished)":
Dim St As String = _
FormatNumber(CDbl(bL), 3) & "x" & _
FormatNumber(CDbl(bW), 3) & "x" & _
FormatNumber(CDbl(bH), 3)
iProperties.Value("Custom", "DIM (Finished)") = St
As a result I have string with 3 decimal digits for every dimension:
This custom property value can be put into any field in the TitleBlock.
Vladimir,
Thank you very much for your help with this. After incorporating this into my iLogic program, it opened my eyes to many other opportunities I had to improve my code. This rule was quickly becoming a "Moving Forward" only rule, but now I have managed to make it work for most of our previous drawings.
Thank you again for your help.
Darek
Good luck with iLogic rules!