Set Precision of Custom Properties using Ilogic

A customer recently asked how they could set the precision of custom properties.

Using ilogic the customer was extracting model dimensions to custom iproperties in a drawing however, the decimal precision wasn't following through to the drawing.

Fortunately I was able to utilise the Graitec programming team in assisting with this query and two sets of code for alternative scenarios were created.

2015-02-20 11-30-26

In the first scenario we want to set the precision for all custom properties to 0.

DimodrawdocAsDrawingDocument

 

odrawdoc = ThisApplication.ActiveDocument

 

DimpropsetsAsInventor.PropertySet

       DimpropAsInventor.Property

       ForEachpropsetsInodrawdoc.PropertySets

           ForEachpropInpropsets

               Try

  If (prop.Name = "OpenHeight")

                   prop.Value = Convert.ToInt32(prop.Value)

  EndIf

  If (prop.Name = "OpenWidth")

                   prop.Value = Convert.ToInt32(prop.Value)

  EndIf

               Catch

 

               EndTry

           Next

 

 

       Next

In the second example we want to set the precision for two specific custom properties to 0.

DimodrawdocAsDrawingDocument

 

odrawdoc = ThisApplication.ActiveDocument

 

DimpropsetsAsInventor.PropertySet

       DimpropAsInventor.Property

       ForEachpropsetsInodrawdoc.PropertySets

           ForEachpropInpropsets

               Try

                   If (prop.Name = "OpenHeight")

                   prop.Value = Convert.ToInt32(prop.Value)

                   EndIf

                   If (prop.Name = "OpenWidth")

                   prop.Value = Convert.ToInt32(prop.Value)

                   EndIf

               Catch

 

               EndTry

           Next

image-2

Keep an eye out for my next blog post where I will be going through how to delete suppressed components in iLogic.

If you have any questions on this process then please leave a comment in the comment box below.

Alternatively if you want to find out about Autodesk software, support or training then contact your local office today or request a quote and we will get back to you as soon as possible.

Request More Information

0
Autodesk Licensing Hotfix For Poodle
Access component drawings straight from Inventor u...

Related Posts

Autodesk reseller uk logo2
 
qms microsoft logo