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 parameter identification

1 REPLY 1
Reply
Message 1 of 2
andyflorence6444
742 Views, 1 Reply

ilogic parameter identification

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?

1 REPLY 1
Message 2 of 2

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

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

Post to forums  

Autodesk Design & Make Report