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 to Change BOM Structure of Virtual Component During Creation

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
estringer
354 Views, 5 Replies

iLogic to Change BOM Structure of Virtual Component During Creation

We have created some iLogic to make virtual components and populate the iProperties of the virtual component at the same time. I was wondering if anyone has or has seen iLogic that we could add that could look at the Excel we are using to populate the iProperties and change the BOM structure of the virtual component? We would like to be able to change some of the virtual components to Purchased instead of Normal.

5 REPLIES 5
Message 2 of 6
A.Acheson
in reply to: estringer

Hi @estringer 

Once you have the definition the virtual part will behave similar to a regular definition.

See API help here.

 

And here is a vba sample to set all virtual part iproperties so you will need to filter for specific ones by name.

 

Please attach your code version if your having trouble implementing.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 6
estringer
in reply to: A.Acheson

Hi @A.Acheson ,

I have attached a copy of the code we are using to create the Virtual Components. Based on my limited understanding of iLogic and your referenced resources, it seems like it is for items that have already been created? I was hoping to have a column in the spreadsheet, that we are using to populate our iProperties, indicate whether the Virtual Component should be Normal or Purchased and then possibly have code that could change that for each Virtual Component as it is created.

Message 4 of 6
A.Acheson
in reply to: estringer

Hi @estringer 

Well once it is created you can change the structure see syntax here. You just need to tab into the componentdefinition the right time to do so is when you set the iproperties. 

Syntax

VirtualComponentDefinition.BOMStructure() As BOMStructureEnum

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 6
Q_Visser
in reply to: estringer

Hi @estringer

You could definitely have another column in your spreadsheet simply stating if the virtual component is purchased and then add another lookup line within your rule. Based on your posted code, I will use "oProp8" as the variable to hold that lookup value and will assume that the value will return either a "Yes" or "No", but feel free to use whatever you like. Then in the section where you are updating the properties for your virtual component, you should just be able to add the following:

 

If oProp8 = "Yes" Then
virtocc.Definition.BOMStructure = kPurchasedBOMStructure
End If

 

 You could always add the above block within a Try/Catch block, but as long as "oProp8" (or whatever name you assign the variable) exists in the rule, I don't believe this will error out, as if the condition isn't met, it will just skip that part of the code and leave the virtual component with a BOM Structure of "Normal".

 

It's a pretty simple addition, but I don't believe it needs to be more complicated.

Hope that helps!

Message 6 of 6
estringer
in reply to: Q_Visser

Thank you, that worked and was simple to implement!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report