elmundo777
Automotive
Hi all. Is it possible to use a macro to copy the entire contents of an open active Product and, using a special paste, paste it into a new Part or Product as a result and ONE body/Solid?
I tried to run the following code in two versions:
but I get the same error:
I tried to run the following code in two versions:
Code:
Dim activeDocument As ProductDocument = Catia.ActiveDocument
Dim rootProduct As Product = activeDocument.Product
Catia.ActiveWindow.ActiveViewer.Reframe()
Catia.ActiveDocument.Selection.Search("Name=*,all")
Catia.ActiveDocument.Selection.Copy()
Dim newProductDocument As ProductStructureTypeLib.ProductDocument = Catia.Documents.Add("Product")
newProductDocument.Selection.PasteSpecial("CATPrtResultWithOutLink")
Code:
Dim productDocument As ProductStructureTypeLib.ProductDocument = Catia.ActiveDocument
Dim product As ProductStructureTypeLib.Product = productDocument.Product
Dim selection As INFITF.Selection = Catia.ActiveDocument.Selection
selection.Clear()
For Each product In product.Products
selection.Add(product)
Next
selection.Copy()
Dim partDocument As PartDocument = Catia.Documents.Add("Part")
partDocument.Selection.PasteSpecial("CATPrtResultWithOutLink")
but I get the same error:
Code:
System.Runtime.InteropServices.COMException
HResult=0x80004005
Message=Empty CSO element. Operation cannot be performed PasteSpecial.