Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Register Log in

Instantiate a powercopy

gart08

New member
Hi


does anybody knows ohw i ca n instantiate a powercopy from VB. I don't want to do the example find in the help (instaniate directly parameters in VB), i juste want to start the command with a spcecific file which contains the powercopy.


Thanks
 

TribalDragon

New member
Here is a code example for instatiation of a power copy from a Macro.

You will need to adapt it to your needs

Sub CATMain

Dim PartDocumentDest As PartDocument
Set PartDocumentDest = CATIA.ActiveDocument

Dim PartDest As Part
Set PartDest = PartDocumentDest.Part

Dim factory As InstanceFactory
Set factory = PartDest.GetCustomerFactory("InstanceFactory")

factory.BeginInstanceFactory Pc_Name, Pc_Path 'Power Copy Name and File Location on hard drive
factory.BeginInstantiate

Dim ISArr As Object
Set ISArr = PartDest.FindObjectByName("ISArr") 'Name of object here
Dim ISTemp As Object
Set ISTemp = PartDest.FindObjectByName("ISTemp") 'Name of object here

factory.PutInputData "ISArr", ISArr 'Name of Power Copy input linked to object
factory.PutInputData "ISTemp", ISTemp 'Name of Power Copy input linked to object

Dim Instance As ShapeInstance
Set Instance = factory.Instantiate

factory.EndInstantiate
factory.EndInstanceFactory

PartDest.Update

End Sub
 

Sponsor

Top