Programatically create Virtual Component

Programatically create Virtual Component

Anonymous
Not applicable
1,342 Views
3 Replies
Message 1 of 4

Programatically create Virtual Component

Anonymous
Not applicable

Hello All,

 

I am trying to use iLogic to programatically create virtual components in an assembly. These components will by used as iProperty "buckets" to hold Machine Center specific information to be exported to production planning software. This information is hierarchical in nature and cannot be (conveniently) stored in the assembly iproperties directly. I cannot find any info on doing this, so maybe one of the guru's here will come to the rescue. This would be a huge jump for our organization, so all help or sugestions will be appreciated!

 

Regards,

Tom

0 Likes
Accepted solutions (1)
1,343 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

I've created something similar, here's an example :

 

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix

Dim oOcc As ComponentOccurrence
oOcc = oAsm.ComponentDefinition.Occurrences.AddVirtual("EXAMPLE", oMatrix)

Dim oCompDefVirtual As VirtualComponentDefinition = oOcc.Definition

'CREATE AND SET THE IPROP
Dim oPropertySet As PropertySet = oCompDefVirtual.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}") oProperty = oPropertySet.Add("EXAMPLE VALUE", "EXAMPLE_PROPERTY")

 

That shows how to create the virtual component called EXAMPLE and add an iProperty (EXAMPLE to it.

 

Hopefully it should do what you want.

 

Cheers,

Tom

Message 3 of 4

Anonymous
Not applicable

Thanks! I gave this a try and it works as advertised! This will be incredibly helpful, now for the work to begin....

 

Regards,

Thomas Ruscher

0 Likes
Message 4 of 4

Anonymous
Not applicable

Tom, as you have mentioned you have done something similar, do you know how to access virtual components iproperties through a Global Form? I have been able to access them by getting the occurance name of the user selected virtual compent and using an inputbox, but this only allows for one property to be edited at a time. I would like to edit as many as 10 iproperties from a single dialog as they all relate to each other and it would be inconvenient to say the least for the user to enter them 1 at a time. Is there a way to have a multiple entry input box? The forms I have tried only find iproperties of the parent assembly.

 

Regards,

Thomas Ruscher

0 Likes