Blog posts

Bio

by David Gate

When creating models in Inventor you probably spend a small amount of time adding in iProperties. Although this manual process doesn’t take very long, when doing this on hundreds of components that time adds up.

You can save yourself sometime by having a template file with some properties already filled in but this isn’t always ideal especially when working in a multi user office sharing templates.

I have quickly written some simple illogic code which looks at an excel spreadsheet and imports in the properties from a chosen row. This way you can easily change or add rows into the excel file to then import.

This is particularly useful when creating a BIM Model as you often need to add in lots of BIM related properties manually.

You can find and copy the code at the bottom of this blog.

I thought it might be best for me to break down the code for you as you will likely need to make changes.

The code first opens an excel file, mine is the following C:\iproperties.xlsx. If you want it named differently or in a different location or a different Sheet name then you will need to tweak the code slightly.

My Excel is simply setup with column title headers and then the rows beneath containing the iproperties I might want to add.

Next it prompts the user to type in which row of the excel they want to import. This allows you to store loads of standard ‘iproperty templates’ or you may find that you have an excel file already being generated by another process which has useful data you want to attach to the inventor file. The default is Row 2 this can be altered.

The code then uses a standard format to import in each cell into the iproperties of the model, drawing or assembly. If you want to add new properties or change the existing ones here’s how.

Try

iProperties.Value(doc, "A", "B") = GoExcel.CellValue("C" & MyRow)

Catch 'catch error when cell is blank

End Try

Take the code above, Reference A is the Tab in the iProperties you want to add to. B is the property field. C is the column taken from the excel file above.

 

So for the above example, if I want to fill in the author, I would edit the code to be iProperties.Value(doc,"Summary", "Author") = GoExcel.CellValue("A" & MyRow)

If you want to add custom properties instead of the standard ones then use the following instead.

Try

iProperties.Value(doc, "Custom", GoExcel.CellValue("F" & "1")) = GoExcel.CellValue("F" &MyRow)

Catch 'catch error when cell is blank

End Try

 

Note the “Custom” for the tab in iProperties and then it names the custom iproperty to match the first cell in column F. It then populates that new custom iproperty with the cell of your chosen row in the F column. So if you want a new custom property add a column

 

Please test and use carefully, it will overwrite a property if it already exists in the inventor file. Please download the full code below