Macro for point coordinates according to a defined system

Hello
I have a personal coordinate system
I have stitches in the assembly
I can measure these points manually to get the X/Y/Z coordinates

I develop a macro to automate this task and send me the list of points and their coordinates.
I can measure the points but it does it according to the default coordinate system, and not with the one I want

Here is the snippet of my code that reads the coordinates in a folder called "connections":

If (typeName = "FtrFolder" And swFeature.Name = "Connexions") Then

            Debug.Print swFeature.Name
            Debug.Print "  Current coordinate system = " & swModel.GetUserPreferenceStringValue(swFileSaveAsCoordinateSystem)
            
            Set swFeatFolder = swFeature.GetSpecificFeature2
            Features = swFeatFolder.GetFeatures
            Debug.Print "    Number of Features: " & swFeatFolder.GetFeatureCount
            For i = 0 To (swFeatFolder.GetFeatureCount - 1)
                Set swFtrFolder = Features(i)
                Debug.Print "     Name of feature: " & swFtrFolder.Name
                Debug.Print "     Type of feature: " & swFtrFolder.GetTypeName2
                 
                 
                Set swRefPt = swFtrFolder.GetSpecificFeature2
                Set swRefPtData = swFtrFolder.GetDefinition
                Set swMathPt = swRefPt.GetRefPoint
                'Debug.Print "File = " & swModel.GetPathName
                'Debug.Print "  " & swFeat.Name
                Debug.Print "    Pt = (" & swMathPt.ArrayData(0) * 1000# & ", " & swMathPt.ArrayData(1) * 1000# & ", " & swMathPt.ArrayData(2) * 1000# & ") mm"
                Debug.Print "    AlongCurveOption   = " & swRefPtData.AlongCurveOption
                Debug.Print "    Distance           = " & swRefPtData.Distance * 1000# & " mm"
                Debug.Print "    Type               = " & swRefPtData.Type
    
            Next i

    End If

Thank you in advance for your help
Cédric

Hello @cedric_keiflin ,

All you were missing was the few lines that allow you to change your bearings...
The macro and test document (SW2021 assembly) are attached.

Kind regards.

CoordPoints.zip (90.0 KB)

Thank you! only downside I'm still in SW 2020 ... he doesn't want to open the file for me
I look at the macro and I keep you up to date

It will be easier with the test assembly in the 2020 version...

CoordPoints2020.SLDASM (84.9 KB)

1 Like

super! I managed to do what I wanted and adapt it to my needs. Awesome :slight_smile: