Inventor Customization

Inventor Customization

Reply
Contributor
20 Posts
Post 1 of 4
Accepted Solution

iLogic and Title Blocks

337 Views, 3 Replies
11-19-2012 08:46 AM

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

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.

Autodesk Support
783 Posts
117 Kudos
157 Solutions
Post 2 of 4

Re: iLogic and Title Blocks

11-26-2012 05:26 AM 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

Contributor
20 Posts
Post 3 of 4

Re: iLogic and Title Blocks

11-26-2012 09:29 AM 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

Autodesk Support
783 Posts
117 Kudos
157 Solutions
Post 4 of 4

Re: iLogic and Title Blocks

11-26-2012 10:50 PM in reply to: ddavis

Good luck with iLogic rules!


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Community Alert

The Autodesk Community Forums, Blogs, and Idea Boards will be in read only mode starting on 2/12 at 9PM PST through 12PM PST on 2/13. Please see the following for more information: Site Maintenance Notification

Announcements
Community Alert | The Autodesk Community Forums, Blogs, and Idea Boards will be in read only mode starting on 2/12 at 9PM PST through 12PM PST on 2/13. Please see the following for more information: Site Maintenance Notification