Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instantiate a powercopy

  • Thread starter Thread starter gart08
  • Start date Start date
G

gart08

Guest
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
 
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
 

Part and Inventory Search

Sponsor

Back
Top