Macro Convert Lines to Curves

Hi,

I'm struggling with creating a macro to convert the lines of the selected object into curves. This is the process I have been using:

1: Create a simple triangle made up of lines

2: Select the shape

3: Start macro recording

4 : Select shape tool

5: Select all nodes

6: Convert line to curves

7:stop recording.

When ever I run this macro it will change my new shape back to the original triangle shape I created in step 1,  any ideas what I'm doing wrong?!

Thanks

David

Parents
No Data
Reply
  • Some things in CorelDRAW do not record the way that one might imagine they would - or record at all in some cases - as VBA code.

    Here's something quick-and-dirty to try to do that task. It doesn't have any niceties in it such as checking if an object is selected, if it's a single object, if it's a curve shape, etc.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    Sub line_segs_to_curve_segs()
    
    Dim s As Shape
    Dim ThisSeg As Segment
    Dim lngLineCounter As Long
    
        Set s = ActiveShape
        For Each ThisSeg In s.Curve.Segments
            If ThisSeg.Type = cdrLineSegment Then
                ThisSeg.Type = cdrCurveSegment
                lngLineCounter = lngLineCounter + 1
            End If
        Next ThisSeg
        MsgBox "Number of segments converted from line to curve: " & lngLineCounter
    End Sub
    
Children