Inventor iProperty Helper

Autodesk Inventor iProperties Helper iLogic

Over the years I have written several iLogic utilities for various customers, primarily to force users to fill in iProperties and ensure that model materials are correctly set.

The “iProperty Helper”, is different, it’s a simple dialogue that displays the current iProperties of the model, clicking on a specific iProperty in the list (eg. Part Number), will bring up a dialogue allowing the user to edit the current value.

@ClintBrown3D Autodesk Inventor 96 iproperties ilogic
@ClintBrown3D Autodesk Inventor 98

Clicking on the Material option, the user is presented with a list of all of the materials available in the part file. In part files, all of the materials are written to a multi-value parameter called “MaterialType”.

If” iProperty Helper” is run in as Assembly or a drawing file, the material is ignored.

@ClintBrown3D Autodesk Inventor iproperties ilogic

Once all of the iProperties are filled in, the “iProperies Helper” panel will look something like this:

@ClintBrown3D Autodesk Inventor 95 ilogic parameters

Below is an animated GIF showing the tool in action (some sequences have been shortened)

iproperties helper low res
Click me for higher res version

While I think that a form could nicely capture any missing properties and let a user make any updates, there is something quite elegant and lightweight in the use of input list boxes, as they are essentially only a few lines of code, making them easy to share!

Here is the iLogic code:

'Code by @ClintBrown3D
'Originally posted at https://clintbrown.co.uk/inventor-iproperties-helper

'Create values based on iProperties
xPartNumber = "Part Number = " & iProperties.Value("Project", "Part Number")
xDescription = "Description = " & iProperties.Value("Project", "Description")
xTitle = "Title = " & iProperties.Value("Summary", "Title")
xSubject = "Subject = " & iProperties.Value("Summary", "Subject")
xMaterial = "Material = " & iProperties.Material
xMass = iProperties.Mass
xVolume = iProperties.Volume
xSurfaceArea = iProperties.Area

'Add values above to an Array
Dim ClintBrown3D As New ArrayList
ClintBrown3D.Add(xPartNumber)
ClintBrown3D.Add(xDescription)
ClintBrown3D.Add(xTitle)
ClintBrown3D.Add(xSubject)
ClintBrown3D.Add(xMaterial)

'Select a value from the Array
xClintBrown3D = InputListBox("Set your iProperties", ClintBrown3D, ClintBrown3D, Title := "iProperty Helper", ListName := "UNOFFICIAL INVENTOR")

'Update iProperties based on selection
If xClintBrown3D = xPartNumber Then
iProperties.Value("Project", "Part Number") = InputBox("Part Number", "Unofficial Inventor: Part Number", iProperties.Value("Project", "Part Number"))
ElseIf xClintBrown3D = xDescription Then
iProperties.Value("Project", "Description") = InputBox("Description", "Unofficial Inventor: Description", iProperties.Value("Project", "Description"))
ElseIf xClintBrown3D = xTitle Then
iProperties.Value("Summary", "Title") = InputBox("Title", "Unofficial Inventor: Title", iProperties.Value("Summary", "Title"))
ElseIf xClintBrown3D = xSubject Then
iProperties.Value("Summary", "Subject") = InputBox("Subject", "Unofficial Inventor: Subject", iProperties.Value("Summary", "Subject"))

'Materials are a bit more involved, we only want to set a material if we are in a part file
'We are creating a multi vaule user Parameter called "MateriaType", which will store all of the material options
ElseIf xClintBrown3D = xMaterial Then
Try
If ThisDoc.ModelDocument.DocumentType <> kPartDocumentObject Then 'Check to see if this is a part file
Return 'Exit the rule if this is not a part file
End If
'Check to see if "MaterialType" exists, set it to equal iProperties.Materials
MultiValue.List("MaterialType") = iProperties.Materials
iProperties.Material = InputListBox("Select a Material", MultiValue.List("MaterialType"), parameter("MaterialType"), Title := "iProperty Helper", ListName := "UNOFFICIAL INVENTOR")
parameter("MaterialType") = iProperties.Material
InventorVb.DocumentUpdate(False)
Catch
'If "MaterialType" does not exist, create it and set up as above
oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
oParameter = oMyParameter.AddByValue("MaterialType", iProperties.Material, UnitsTypeEnum.kTextUnits)
MultiValue.List("MaterialType") = iProperties.Materials
InventorVb.DocumentUpdate(False)
iProperties.Material = InputListBox("Select a Material", MultiValue.List("MaterialType"), parameter("MaterialType"), Title := "iProperty Helper", ListName := "UNOFFICIAL INVENTOR")
parameter("MaterialType") = iProperties.Material
End Try
End If

This version of the code was briefly tested with Inventor 2020.2

Please note that I cannot offer any additional support, this blog post is offered as-is, and is aimed at the more advanced user.

As always, please test all iLogic code extensively on non-production files. Do not use any code in a production environment until YOU have thoroughly tested it and have verified that it works as expected. Always back up any data before running any experimental code. You are ultimately responsible for any iLogic code that you run, so make sure you test it thoroughly!

This site takes absolutely no responsibility for how you use this code in production (see disclaimer).