vbacatia

how to get the supporting points of flexible curve in catia vba


I am trying to create macro that can pull the information of supporting points listreference image of flexible curve. and I have no idea how to proceed with.

Dim oDoc As Document
Set oDoc = CATIA.ActiveDocument

Dim oProds 'As item
Set oProds = oDoc.Product.Products.Item(1).ReferenceProduct.Parent.part.hybridBodies

Dim my1
Set my1 = oPro.Item(5).HybridShapes

Dim my2    
Set my2 = my1.Item(1).refernce

for i = 1 to my2.count

debug.print my2.name

next 

any suggestions would be appreciative.


Solution

  • The following example shows how to loop over the control points of a spline

    Sub CATMain()
    
    Dim oPartDoc As PartDocument
    Dim oPart As Part
    Dim oHybridBody As HybridBody
    Dim oSpline As HybridShapeSpline
    Dim i As Integer
    
    Set oPartDoc = CATIA.ActiveDocument
    Set oPart = oPartDoc.Part
    Set oHybridBody = oPart.HybridBodies.Item(1)
    Set oSpline = oHybridBody.HybridShapes.Item("Spline.1")
    
    For i = 1 To oSpline.GetNbControlPoint
        Debug.Print oSpline.GetPoint(i).DisplayName
    Next
    
    End Sub