<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1053641198063307&amp;ev=PageView&amp;noscript=1">
Manufacturing Business & Technology Consultants.
Autodesk Platinum Partner


  • Blog
  • Inventor Tips and Tricks – Using iLogic to Automatically Place Components in Assembly Folders

I had a customer recently ask me if there was a way to automatically place components in relevant assembly folders, as they try to keep the assembly browser as organized as possible. Unfortunately, there is no out-of-the-box tool that will accomplish this, but thanks to iLogic, it absolutely can be done! This post will walk through one possible approach.

Before we get into things, a special thanks goes out to my colleague, Curtis Waguespack, who really helped me when I was really stuck in a particular portion of my initial code! He is awesome!!!

The first step in the process is to determine how to categorize each component, so that it can eventually be placed into the proper assembly browser folder. I decided to use iProperties, as those are readily accessible, can be included in file templates and can be mapped to Content Center tables. As you can see in the graphic below, I am using a custom iProperty called “Assembly_Folder” to define this value.

Important Note: It is critically important to ensure that the iProperty name is IDENTICAL in every component, otherwise the iLogic code will NOT work.


Sample component with the Custom iProperty “Assembly_Folder”

After ensuring that the components have the required Custom iProperty, simply build or open an assembly that contains the components. To verify the desired functionality, I have made several copies of the components in this assembly.


Sample assembly with multiple component copies

The final step is to implement some iLogic code that will determine which folders need to be created, create those folders, and then place the components into the corresponding folder, all of which is based on the components’ Custom iProperty values. I am including the text of the rule below, as well as a YouTube video link that demonstrates the functionality in real time, but I want to list some important items to consider.

  1. While this rule is being run local to the assembly in this example, it can and SHOULD be run as an external rule.
  2. There are multiple “Browsers” in Inventor and you must make sure that you’re looking at the correct Browser. In the code we force it to the “Model” browser.
  3. Each entry that appears in the Model browser is a “Browser Node”, so the API must be used to ensure that we are looking at the correct objects, whether we’re trying to modify the Browser Folders or components.


Execute the iLogic rule


The components have now been reorganized into assembly folders that were generated “on-the-fly”

As you can see, the iLogic rule will organize the components automatically into the folders designated by and generated from the components’ Custom iProperties. This gives the end users maximum flexibility to organize components as desired, without having to create the folders ahead of time. I hope you find this tip helpful and please a let me know if you have any questions or comments. Hope all is well and happy blogging! Pete Strycharske

Link to YouTube Video:


iLogic Code:

Dim oDoc As AssemblyDocument

oDoc = ThisApplication.ActiveDocument


If ThisApplication.ActiveDocument.DocumentType <> _

DocumentTypeEnum.kAssemblyDocumentObject Then Return


Dim oDef As ComponentDefinition

oDef = oDoc.ComponentDefinition


'Define the Model Browser pane to ensure folders are created in the proper location

Dim oPane As BrowserPane

oPane = oDoc.BrowserPanes.Item("Model")


Dim oTopNode As BrowserNode

oTopNode = oPane.TopNode


Dim oTargetNode As BrowserNode

Dim oFolder As BrowserFolder


oTargetNode = oTopNode


Dim oList As New ArrayList


'create a list of the folders to make based on the custom iProperties in each component

'This will allow folders to be created on the fly

For Each oOcc In oDef.Occurrences


               sFolder = iProperties.Value(oOcc.name, "Custom", "Assembly_Folder")


               If oList.Contains(sFolder) = False Then


               End If

        Catch 'error when iprop doesn't exist

        End Try



'Sorts the list alphabetically



'compare list to existing folders

For Each oFolder In oTargetNode.BrowserFolders

        If oList.Contains(oFolder.Name) Then

               'remove from list if it exists


        End If



'create folders that don't exist

If oList.Count > 0

        For Each sFolder In oList

               oFolder = oPane.AddBrowserFolder(sFolder)

               oFolder.AllowReorder = True

               oFolder.AllowDelete = True


End If


'Check each folder and populate it with components that have the corresponding custom iProperty value

For Each oFolder In oTargetNode.BrowserFolders

        For Each oOcc In oDef.Occurrences

               Dim oNode As BrowserNode

               oNode = oPane.GetBrowserNodeFromObject(oOcc)


                       If oFolder.Name = iProperties.Value(oOcc.Name, "Custom", "Assembly_Folder") Then


                               'Optional verification message

                               MessageBox.Show(oOcc.Name & " has been added to the folder: " & oFolder.Name, "Component Added to Folder")

                       End If


               End Try



Do you use any of these tips and tricks in your daily workflow? Feel free to brag about your success in the comments!

Like what you’ve read? Subscribe to our blog! 

Feel free to share on Twitter or Facebook!

Looking for Affordable Training?

Stay Competitive with the flexibility to take any scheduled D3 courses as often as you need.

Learn about an Evolve360 Training subscription.