Evening All,
Go easy on me as I am very new to using iLogic. We currently use an Inventor Bolt on called Woodwoork For Inventor. It has a function in it called an iBox where an existing assembly is copied and resized based on a skeleton body in your assembly. Part of the process is also to uniquely name each part. I have created a framework which has a number of features that supress and un supress as required based on an ipt parameter. This parameter is linked to the iam and I have successfully written an ilogic code that checks the value of this parameter and changes the suppression of the parts within it. However because the names change this ilogic falls over quite quickly. What I am trying to achieve is an ilogic code that can be written into the parent iam file (which is then copied and renamed in in the ibox insertion process) and when the process is complete the child iam (which is the newly created one) will still be capable of running without error. I have created two model states that I want to be able to swap between but I do not have the knowledge to figure out how to ensure the relevant information is pulled to the newly created ilogic code
Any help would be greatly appreciated
This is what I am currently using to swap between state in the parent iam (the one that is then copied)
If Depth <= 250.001 Then ThisDoc.ActiveModelState = "Under 250mm" ElseIf Depth <= 600 Then ThisDoc.ActiveModelState = "Over 250mm" ElseIf Depth > 600.01 Then MessageBox.Show("PLEASE DISCUSS FRAMING WITH RYLAN!", "WARNING") End If
afternoon,
the first thing that comes to mind is to add a customer text parameter called "PartName" this will allow you to house the name of the newly created part there. then in your code reference to parameter("PartName") in theory this should allow you to use a generic code to run and retrieve the correct part number.
i hope i am understanding your need correctly.
essentially you can access the parts in the assembly find the part you are looking to manipulate then access that custom user parameter and have the name of the part.
One additional piece of advice would be, to be cautious about using parameters to drive changing ModelStates. This is usually not a great idea, and may create complications, or not work properly. Since the ModelStates govern the values of parameters, each ModelState may have the same value for that one parameter, or each ModelState may have a different value for that one parameter, or some mixture of same/different. Once you 'activate' a different ModelState, that newly active ModelState may have a different value for that parameter than the previously active ModelState. With this in mind, it will likely be important to keep the 'member edit scope' setting in mind when changing the value of that parameter. The member edit scope dictates whether your changes will be effecting the 'active member only' or 'all members / factory scope'.
Manually, this member edit scope can be seen in two different places. One is on the Manage tab, Author panel. The other is with the small checkboxes and/or pencil icons next to your ModelStates in the model browser tree. By Inventor API code, this setting is right under the main ModelStates collection object of a part or assembly ComponentDefinition (AssemblyComponentDefinition.ModelStates), through the ModelStates.MemberEditScope property. There are also simpler looking iLogic snippets for getting/setting this member edit scope that became available in 2024 (with the help of a system environment variable), but it sounds like they became fully functional in the 2025 version of Inventor, when they included them within the 'Snippets'.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.