Export nodes

Hello,

I'm a complete newcomer to VBA scripts. I work with CorelDraw X6, I use it for graphic work in technical practice. So far, I've made do with simple macros.
What I need now - to export the coordinates of all nodes from one layer. There are only curves in the layer.
My knowledge of VBA for CorelDraw does not allow me to master this task. Can someone help me please.

Thanks.

Petr

Parents
  • Here is an example to get you started. If you have questions just ask. 

    Sub ExportNodePositions()
        Dim s As Shape, n As Node
        Dim srActiveLayer As ShapeRange
        Dim x As Double, y As Double
        Dim strNodePositions As String
        
        'Get all the curve shapes on the Active Layer
        Set srActiveLayer = ActiveLayer.Shapes.FindShapes(Query:="@type='curve'")
        'This is another way you can get only the curve shapes
        'Set srActiveLayer = ActiveLayer.Shapes.FindShapes.FindAnyOfType(cdrCurveShape)
        
        'Loop through each curve
        For Each s In srActiveLayer.Shapes
            'Loop though each node in the curve and get the position
            For Each n In s.Curve.Nodes
                n.GetPosition x, y
                strNodePositions = strNodePositions & "x: " & x & " y: " & y & vbCrLf
            Next n
        Next s
        
        'Save the node positions to a file
        Open "C:\Temp\NodePositions.txt" For Output As #1
            Print #1, strNodePositions
        Close #1
    End Sub
    

    Happy Coding, 

    -Shelby

Reply Children
No Data