Catia Users

Created by Ananth Narayan on 8 March, 2018

Hello, Do you know how to extract a surface using publication in catia macro ?

I tried to extract a surface of a catia piece using the name of a publication thanks to a macro.

I'm doing this :

Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim partProduct As Product
Set partProduct = partDocument1.Product

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim Surface_principale_pub As Publication
Set Surface_principale_pub = product1.Publications.Item("Surface_principale") ' Surface_principale is the name of my publication

Dim reference_surf_principale As Reference
Set reference_surf_principale = Surface_principale_pub.Valuation

Set surface_principale = hybridShapeFactory1.AddNewExtract(reference_surf_principale)
surface_principale.PropagationType = 3 ' Extraction sans propagation, donc juste la surface selectionnée
surface_principale.ComplementaryExtract = False
surface_principale.IsFederated = False
hybridBody1.AppendHybridShape surface_principale
part1.InWorkObject = surface_principale
part1.Update

End Sub

I have an error saying that the method of extraction failed

1 Answer

I think you'll have better success finding an answer to your macro question on the Eng-Tips forum.

https://www.eng-tips.com/threadminder.cfm?pid=560