Hi,
i'm new to v6 automation and have worked in v5 automation.
Can any one help/post some sample reference code to create new product in V62013x and then add an existing 3D part in to the newly created product.
i was able to create a new product and fetch the existing (opened part), but could not able to load the existing part into the new product's root collection.
here is my code:
Please let me know how to proceed.
Regards,
Maddy
i'm new to v6 automation and have worked in v5 automation.
Can any one help/post some sample reference code to create new product in V62013x and then add an existing 3D part in to the newly created product.
i was able to create a new product and fetch the existing (opened part), but could not able to load the existing part into the new product's root collection.
here is my code:
Code:
Dim oPart As Part
Dim oPartVPMRepRef As VPMRepReference
Dim oPartVPMRef As VPMReference
Dim oProdVPMRef As VPMReference
Dim oProdRootReference As VPMReference
Dim oProdRootOccurrence As Object
Set oPart = CATIA.ActiveEditor.ActiveObject
Set oPartVPMRepRef = oPart.Parent
Set oPartVPMRef = oPartVPMRepRef.Father
Call CATIA.GetSessionService("PLMNewService").PLMCreate("Product", oProductEditor )
Set oProdRootReference = oProductEditor.GetService("PLMProductService").RootOccurrence.ReferenceRootOccurrenceOf
'Tried this
Dim oVPMRepInstsOnRepInstColln As VPMRepInstances
Dim oNewProdRepInst As VPMRepInstance
Dim cListRepInstancesColln As VPMRepInstances
Dim sRepInstanceName As String
Set cListRepInstancesColln = oProdRootReference.RepInstances
sRepInstanceName = "I_" & oProdRepRefToInstantiate.Name & "." & cListRepInstancesColln.Count + 1
Set cListRepInstancesColln =cListRepInstancesColln.Add(sRepInstanceName, oProdRepRefToInstantiate.Parent, oNewProdRepInst) ' -- Not Works
' Error : Add Method of VPMRepInstances Failed
' And also This
Dim oVPMInstancesOnInstColln As VPMInstances
Dim oNewProdInstance As VPMInstance
Set oVPMInstancesOnInstColln = oProdRootReference.Instances
Call oVPMInstancesOnInstColln.Add(oPartVPMRef, oNewProdInstance) ' -- Not Works
' Error : Add Method of VPMInstances Failed
Please let me know how to proceed.
Regards,
Maddy