Inventor Customization

Inventor Customization

Reply
Active Member
andyflorence6444
Posts: 7
Registered: ‎03-06-2012
Message 1 of 2 (362 Views)

ilogic parameter identification

362 Views, 1 Replies
12-31-2012 09:37 AM

I have several part models that are very simple and are basically long cylinders. I want to create an external ilogic rule that i can run in each part file that can identify the largest sketch parameter dimension. So basically it will find the Length of the cylinder due to it being a larger dimension and then rename the parameter.

 

I could just name the cylinder length sketch parameter the same in each part file, but I wanted to attempt to make it more universal for all users. So if a new user forgets to properly label his part parameters, the ilogic program can identify what parameter it should be looking for and rename it properly.

 

Does anyone have any ideas/tricks to how this can be done?

ADN Support Specialist
Vladimir.Ananyev
Posts: 497
Registered: ‎08-14-2012
Message 2 of 2 (331 Views)

Re: ilogic parameter identification

01-11-2013 05:50 AM in reply to: andyflorence6444

Hope it is better and more reliable to have a rule that automatically finds the parameter which controls the length of the first extrusion in this model.  In this case you do not have to know the exact parameter name and its value can be less than the diameter.

 

Sample iLogic code is similar to the following:

 

'reference to this part document

Dim oDoc As PartDocument = ThisDoc.Document

Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

Dim oFeatures As ExtrudeFeatures = oDef.Features.ExtrudeFeatures

 

'reference to the first extrusion

Dim oExtr As ExtrudeFeature = oFeatures.Item(1)

 

If oExtr.Definition.ExtentType = PartFeatureExtentEnum.kDistanceExtent Then

     'extrusion length is controlled by model parameter

     Dim oPar As Inventor.Parameter = oExtr.Definition.Extent.Distance

     'model parameter name   

     Dim ParName As String = oPar.Name 

     MsgBox( ParName & " (mm):  " & FormatNumber(10 * oPar.Value, 2))

Else

     MsgBox( "Extrusion type is not Distance Extent")

End If

 

Is it works for you?


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.