Displaying k-Factor on an Inventor drawing

One of our customers recently asked us how they could display the k-factor for a sheet-metal part on a drawing. This is not as easy as pulling a parameter through to the drawing as the k-factor value is embedded in the sheet-metal style of the component. Using iLogic to access the inventor API, we created a custom iProperty and pushed the k-factor from the current sheet-metal style through to it. The iLogic rule code is shown below: 

oCompDef = ThisDoc.Document.ComponentDefinition

      kFac = oCompDef.UnfoldMethod.kFactor
            iProperties.Value(“Custom”, “kFac”) = kFac
This writes the k-factor value through to a custom iProperty called “kFac.”
For those new to iLogic, to use this rule code you will first need to display the iLogic browser inside Inventor by clicking the “iLogic Browser” button on the “iLogic” panel of the “Manage” tab. It should appear on the left of the screen below your model browser. 
Display iLogic Rule Browser
Click the “Rules” tab and right-click in the panel and select “Add Rule.” Give the new rule a name. The rules editor will open and you can simply copy-paste the above code into the code window and click “Ok.” The rule will fire immediately and create a new custom iproperty and populate it with the k-Factor value.
Custom iProperty created and populated by rule

From there, to put the k-Factor into a drawing you can place a text box from the “Annotate” tab and bring in the custom “kFac” property. You can also add a text label eg. “k-Factor” as normal text.

Insert custom iProperty in Text Box

And that’s it.


Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.