Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

iLogic to Change BOM Structure of Virtual Component During Creation

estringer
Advocate

iLogic to Change BOM Structure of Virtual Component During Creation

estringer
Advocate
Advocate

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.

0 Likes
Reply
Accepted solutions (1)
589 Views
5 Replies
Replies (5)

A.Acheson
Mentor
Mentor

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
0 Likes

estringer
Advocate
Advocate

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.

0 Likes

A.Acheson
Mentor
Mentor

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
0 Likes

Q_Visser
Contributor
Contributor
Accepted solution

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!

Cheers,
Q Visser

Current Software:
Inventor Professional 2024.2 & Vault Professional 2024.2

estringer
Advocate
Advocate

Thank you, that worked and was simple to implement!

0 Likes