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: 

iLogic and Title Blocks

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ddavis
561 Views, 3 Replies

iLogic and Title Blocks

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

3 REPLIES 3
Message 2 of 4
Vladimir.Ananyev
in reply to: ddavis

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
in reply to: Vladimir.Ananyev

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

Message 4 of 4
Vladimir.Ananyev
in reply to: ddavis

Good luck with iLogic rules!


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

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

Post to forums