iLogic and Title Blocks

iLogic and Title Blocks

ddavis
Enthusiast Enthusiast
725 Views
3 Replies
Message 1 of 4

iLogic and Title Blocks

ddavis
Enthusiast
Enthusiast

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.

 

Capture.PNG

 

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

0 Likes
Accepted solutions (1)
726 Views
3 Replies
Replies (3)
Message 2 of 4

Vladimir.Ananyev
Alumni
Alumni
Accepted 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:

2.PNG

 

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:

1.PNG

 

This custom property value can be put into any field in the TitleBlock.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

ddavis
Enthusiast
Enthusiast

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

0 Likes
Message 4 of 4

Vladimir.Ananyev
Alumni
Alumni

Good luck with iLogic rules!


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes