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!

Catia CAA/VBA Automation API- Adding HybridBody as a child of UserSurface

arct2

Mechanical
Joined
Jul 1, 2025
Messages
1
Hi Everyone!

This is my first post here, so nice to meet you finally ;)

In my company, we have standard for creating 3D annotations. One of rules for this standard states, that if someone clicks on annotation (for ex. text with leader), it should mark whole body to which the annotation applies.

So we should get something like this:
1751399609724.png

The problem is, that if we go to Geometry Connection Management, and try to add whole surface (Volume Extrude.1) instead of a face of this surface, Catia will automatically select random surface instead:
1751400249740.png

And we end up with single face marked in 3D viewer instead of whole body.
Maybe workaround would be to add all faces to the User Surface, but this is time consuming especially when surface is complex.

So the workaround for this situation is to replace face of this element with geometrical set:
1751400397856.png



I tried to recreate this using VBA:
Rich (BB code):
Sub CATMain()

    Dim editor1 As Editor
    Set editor1 = CATIA.ActiveEditor
   
    Dim part1 As part
    Set part1 = editor1.ActiveObject
   
    Dim annSet As AnnotationSet
    Set annSet = part1.AnnotationSets.GetItem("Annotation Set.1")
   
    Dim geoset As hybridBody
    Set geoset = part1.HybridBodies.Item(1)
   
    Dim geosetRef As Reference
    Set geosetRef = part1.CreateReferenceFromObject(geoset)
   
    Dim uSurfs As UserSurfaces
    Set uSurfs = part1.UserSurfaces
   
    Dim uSurf As UserSurface
    Set uSurf = uSurfs.Generate(part1.CreateReferenceFromObject(geoset))
   
    Debug.Print ""

End Sub

But I get an error:
1751401353125.png

Do you have an idea how to make UserSurface out of HybridBody? Or is such operation not possible with Automation API, but only with CAA?
 

Attachments

  • 1751401305729.png
    1751401305729.png
    41.1 KB · Views: 0
actually, my 3DX inserts ALL 6 faces (automatically) of the cube. I attached the text-note to the Volume Extrude
 

Part and Inventory Search

Sponsor

Back
Top