ilogic/api passing local variable from part to assembly to create virtual part

ilogic/api passing local variable from part to assembly to create virtual part

DJFore
Advocate Advocate
338 Views
1 Reply
Message 1 of 2

ilogic/api passing local variable from part to assembly to create virtual part

DJFore
Advocate
Advocate

I need some assistance with passing a local variable from a part up to an assembly and creating a virtual part and setting the part number, description, qty and units of the virtual part. 

I have built a part that mimics an assembly of custom manufactured raw material components that are cut drilled etc.. so what I am looking to do is take the BOM from the part that I have created in ilogic code (example is if the user selects 2.5" pipe from the drop down it updates the model and it will return our part number for pipe and based on the sketch it will return a length value. Both the length value and the part number are set to a local variable such as Frame_PN= "P10-2.5-304" and Frame_Qty=26 both Frame_PN and Frame_Qty are only local to the code I have not created actual parameters for these (there are several)). Step two is that I want to push this information into an assembly this part lives in and create virtual parts to be able to push to vault and then to our ERP software.

What I want is to run a rule in the assembly that will get the local variable value and create a virtual part in the assembly and pull in the part number and additional properties.

As a side note I have the values being pulled from the part to the assembly using custom properties but not directly to the local variables. If this is the best way to push/pull the values then I just need help creating the virtual parts with the custom properties values.

 

The part and the assembly will have the same file name.

I have multiple parts that need pulled in.

 

0 Likes
339 Views
1 Reply
Reply (1)
Message 2 of 2

philip1009
Advisor
Advisor

The method for adding a virtual part is:

oVirtOcc = ThisDoc.Document.ComponentDefinition.Occurrences.AddVirtual(Name As String, Position As Matrix)

 

This will add a virtual part and give you oVirtOcc as an Occurrence in the Assembly to write all of your iProperties to.

0 Likes