Tag Archives: coreldraw

Determining the length of a curve in Corel Draw 11

2012-06-21

When designing in Corel Draw, it can be very useful to know the total length of a curve. Since the curve may consist of straight and curved sections, this is not trivial, and unfortunately the user interface doesn’t help you here – it only tells you the width and height of an object.

So in order to get that length, use this Visual Basic macro:

Sub getLineLen()
 Dim sel As Shape
 Set sel = Application.ActiveDocument.ActiveShape
 Dim l, sl As Double
 Dim seg As Segment
 Dim prevu As cdrUnit

 prevu = Application.ActiveDocument.Unit
 Application.ActiveDocument.Unit = cdrMillimeter

 For Each seg In sel.Curve.Segments
 sl = seg.Length
 l = l + sl
 Next seg
 MsgBox ("Length: " & l)

 Application.ActiveDocument.Unit = prevu
End Sub

This should work in other versions of Corel Draw, too, but I could verify that for version 11 only. In order to make this work, go to the menu item “Tools -> Visual Basic -> Visual Basic editor…”. Click on “GlobalMacros”, then on “Module” and “CorelMacros”. Paste the code at the bottom of this text file. Then click on File -> Save.

To use the macro, select the relevant curve, then click on “Tools -> Visual Basic -> Execute…”. Select the macro from the list (select “Macros in” “all standard projects”) and click on “Execute”. The length of the curve will appear in a small message box.

Converting CorelDraw to GSD files

2011-02-19

Craft Robo’s aptly named control software Robo Master uses a proprietary file format ‘GSD’. I work with CorelDraw, and while CDR is perfect for cutting directly (and in my opinion much better suited for complex Craft Robo projects than Robo Master), there is no way around the GSD format if you want to pass on designs to other people.

The way I do the conversion is as follows:

First, I split the art to be printed and the cutting outlines. The art to be printed goes into a PDF file, and the cutting outlines into a GSD. The reason behind this is that complex artwork does not convert correctly to GSD – only very simple shapes do.

Now, in order for this to work we need to make sure that the registration marks are included in the PDF and that they align with the registration marks used by Robo Master.

I have prepared a Corel Draw file with registration marks at the exact same positions as the default positions in Robo Master.

Using this file, these are the steps I follow:

  1. Position the artwork and cutting outlines inside the registration marks
  2. Move the cutting outlines to an invisible layer or delete them temporarily
  3. Export the document as a PDF
  4. Make the cutting outlines visible again or restore them. Delete everything else (make sure that the cutting outlines are ungrouped and are all in a single layer. This should be the only layer in the document)
  5. Due to a bizarre behaviour of Robo Master, where imported DXF files have their center at the lower left corner of the page, we need to add an offset to the outlines. Go to ‘Arrange-> Transformation -> Position’, and enter 148.5 and 105 mm (half the page size for an A4 page). I have prepared a macro included in the template mentioned above you can use for that: Go to “Tools -> Visual Basic -> Play” and select RecordedMacros.dxfoffset
  6. Now go to “File -> Save as…”, select as file type ‘DXF – AutoCAD’
  7. In the AutoCAD export window, select “AutoCAD R13” as the export version, and select “Millimeters” as the export unit.
  8. Open Robo Master, go to “File -> Load DXF…”
  9. Save the file as a GSD file.