CATIA v6 2013x(VBA) Add New Product file and add an existing part in it.
CATIA v6 2013x(VBA) Add New Product file and add an existing part in it.
(OP)
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.
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





RE: CATIA v6 2013x(VBA) Add New Product file and add an existing part in it.
Look in doc file for "Opening 3DShape" (hope I understood your problem, not so clear for what it means load - design mode ?).
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATIA v6 2013x(VBA) Add New Product file and add an existing part in it.
Scenario is like this (CATIA V62013x)
I need to create an assembly from opened 3DParts and i have 2 part files opened
I created a new product Product1 (Assembly - through program)
Now i need to add Part1 and Part2 to Product1 (New Product)
And then put a constraint (contact constraint) between Part1 and Part2
Hope it is clear now.
i'm facing error while instantiating Part1 (VPMReference) onto Product1's Root Reference
i followed the way API described (oProdRootReference.RepInstances.Add and oProdRootReference.Instances.Add) but not works.
Don't know where doing i'm wrong
Regards,
Maddy