Search code examples
vbacatia

Catia V5 macro to access axis-system inside a geometric set


enter image description here

Using a Catia V5 macro I want to save axis system and other geometric elements inside a geometic set to a txt file. I'm able to access the geometric elements like points and lines but not the axis system(Shown in image) .

'Procedure to access the geometic elements inside a geometric set    
Dim prtDoc  As Part
Dim hbds As HybridBodies
Dim hbs As HybridShapes
Set hbs = hbds.GetItem(objSel.Item2(1).Value.Name).HybridShapes

To access a geometric element and get its type

MsgBox TypeName(hbs.Item(i))

But how to access the axis system?


Solution

  • Axis Systems can't be found inside a Geometrical Set by looping through child items via the CATIA API. A hybridBody (Geometrical Set) only contains HybridShapes, HybridBodies and Sketches.

    You can see Lines, Points, and such other items because they are all HybridShapes.

    As far as I know, the only way of getting the Axis System object inside a Geometrical Set is through the Selection.Search method.

    Assuming you have the CSYS Geometrical Set in your selection, you can do the following:

    Dim Selection as INFITF.Selection
    Dim AxisSystem as INFITF.AxisSystem
    'Initialize Selection and other code here
    Selection.Search("'Part Design'.'Axis System';sel")
    for i = 1 to Selection.Count2
        set AxisSystem = Selection.Item2(i).Value
        '...
    Next