MACRO LIBRARY

Get loft pick points

Free public access. No account or subscription required.

Files

Get loft pick points

Code

Module:

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swPart As SldWorks.PartDoc
Dim swFeat As SldWorks.Feature
Dim swData As SldWorks.LoftFeatureData
Dim vPts As Variant
Dim vSubPts As Variant
Dim swMathPt As SldWorks.MathPoint
Dim vArr As Variant
    
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swPart = swModel
    Set swFeat = swPart.FeatureByName("Loft1")
    Set swData = swFeat.GetDefinition
    swData.AccessSelections swModel, Nothing
    vPts = swData.PickPoints
    
    Dim i As Integer, j As Integer
    
    For i = 0 To UBound(vPts)
        vSubPts = vPts(i)
            
        Debug.Print "Chain " & i
            
        For j = 0 To UBound(vSubPts)
            Set swMathPt = vSubPts(j)
            vArr = swMathPt.ArrayData
            Debug.Print vbTab & Round(vArr(0), 5), Round(vArr(1), 5), Round(vArr(2), 5)
        Next j
        
    Next i
    
    swData.ReleaseSelectionAccess
End Sub