Tuesday, August 30, 2016

Engraving objects - Front-panel Designer, Inkscape and HPGL files

An apology

This post was drafted some months ago. Since it was all too difficult and now that Schaeffer are offering printing to their front-panels now I didn't really come to any conclusion. Engraving tools, HPGL files and using Inkscape is a frustrating process and I just gave up. I'm posting this anyway, in case someone is looking for advice on using Inkscape with HPGL files and FPD, and hoping it might be of some use.

Oh no! Logo no-go?

I was thinking about having something more interesting than just the labels on the front panel. But what? How about a logo? If I use Schaeffer panels in theory anything can be engraved and in-filled with colour.

I found someone had created a Yamaha logo for CNC

They posted it as a dxf file so using Uniconvertor I made an HPGL file.

Front-Panel Designer can import HPGL engraving objects, so that works easily.

The cost is
HPGL engraving54.4462.98Yamaha 2 HPLG.plt1.83 €
Other--Engraving infill5.69 €
Other--1 tool changes1.03 €

Engaging in engraving

But this kind of engraving is easy because it's a single-line drawing. What if I wanted something more elaborate?

This is the Yamaha logo and logotype

If I convert this file to just show the outline though..

In this file the outline has not been cleanly closed off and it only makes sense when you view the 'fill' without the 'stroke'. To engrave this design you need to start with a clean outline and then have lines inside which are cut out.

You can do this in Inkscape but FPD recommends using Corel Draw as it has better support. But Inksape is free so... Let's try with Inkscape.


First there are some top tips in this document MANUAL FOR HPGL FILES WITH COREL DRAW
There is an explanation on engraving and cutting tools.

Something I missed earlier when doing this is that you need to set the stroke style's 'Join' to rounded. Doing this gives you a realistic picture of what the engraving will look like.

Also there is a fundamental problem with cutting a line in-side another line. Although the outside of an angle will have a rounded edge the inside will be straight and sharp. When you draw a line inside the corner that comes to meet that inside join it will be rounded and you get a gap. There's no way to prevent the gap so you have to fill in the triangle with another but of engraving or cutting to remove it. Alternatively go for designs with no acute angles inside.  

The S shape used below is a simply hard to do and there are much easier designs with fewer problems.

Starting with a single character 'S' in the Faktor font favoured in some of the Yamaha advertising of the same period as the SS30 let's try and engrave and cut a custom font.
This is how the text appears in Inkscape to start with.

Then I set the fill to nothing, the stroke colour to black and the stroke width to 0.2mm (which is the smallest engraving size on FPD).

That's not quite correct though. The thickness of the stroke works from the middle outwards.

A thicker stroke would start to unnoticeably distort the shape. This is at 3mm.

To be accurate the stroke needs to be centred 0.1mm inwards. Here's a close up showing the outline in black (at 0.05 px) and the proposed engraving in read (at 0.2 mm).

You can see clearly that the engraving is going outside the bounds. So let's fix that.
The Path->Inset command moves the selected path inwards by a set amount. You have to set the amount in the Preferences (Edit->Preferences->Behaviour->Steps->'Inset/Outset by'. For 0.2mm I've set it to 0.01.

Now the engraving line fit's inside the outline but it's lost the sharp edge. If we engrave this the tool will follow that curve instead of sharply turning the corner.

If you try and do this inset another way you get a different problem though. In blue I created another outline in blue, set it to 0.2 mm wide and then reduced the size of the outline by 0.1mm.

This still have sharp edges but as you can see it's not the same as doing an inset and it's not inside the lines. Reducing the size is nothing like doing an inset command. 
To get exactly the right size it is better to start with a shape which is 0.1 mm too small and then the engraving will keep it's sharp edges. But there are other problems with the inset function in Inkscape as we will see later. 

What happens when we actually engrave an inset outline? I took a copy of the drawing (deleting the blue engraving first) and offset the guide outline to the right from the engraving. Then I saved it as HPGL format.
This is what it looks like in Inkscape. The inset outline on the left the original shape on the right.

And then imported to FPD

You can see the problem. The line created with inset has lost it's smooth shape.

Now we know that the outline is better of being scaled correctly with allowance for the engraving tool width and not using inset we can turn our attention to the in-fill.

The cutter tool options are 0.6, 0.8, 1.0 , 1.5, 2.0, 2.4 and 3.0 mm.  Bigger tool means less cutting which is cheaper, but the bigger the tool the bigger the contour radii.

Here's is a close-up look at the outline cut with the 0.6mm tool.

The shape isn't too bad but the outer edges are rounded off. How will that fit inside the outline cut by the engraver?

Firstly let's create an inset path which is the first cut inside the engraving. The cut will be 0.6 mm and therefore 0.4 mm inside the outline (0.1 mm + 0.3 mm).


Not too bad, but you can see a gap. When this is cut and engraved that gap will be left over metal. This is because the inset has miscalculated and not followed the outline properly.

Let's convert to HPGL and see what happens.


We now hit problem with Inkscape and HPGL files. Each line in the HPGL file can be assigned a pen (from the idea that this was a file format for plotters). In FPD each so-called pen is assigned a tool (engraver or cutter). Unfortunately when you save the file in Inkscape you can only choose one pen and not multiple pens with a different one for each line.
Instead to create the engrave and the cut line you have to create two files. One file is just the engrave line and one is just the cut line. When you save the file you assign each one a different pen so that when you import then to FPD you can get two files loaded and placed at the same time with different pens. Actually not at the same time exactly. You have to place each one in the same position individually, which may be an issue if the reference points don't match up.  However, you can manually combine the two files. Open each file in a text editor, like Notepad++, and then append one after the other in a new file. Then you can open both as one file and you will have two pens, one for each. The pens are identified as SPx where x is the number of the pen, so SP1, SP2, etc.

In any case, bringing the file into FPD the result is poor.

I have done more experiments where the shape is much larger and the result is a bit better. But that is no use. You cannot reduce the size of the outline and it's still not perfect.

To be clear using the automatic inset function is not possible. But there is another way.

There is a path function called Linked Offset. Using this function you can manually drag the shape an inset. This has a much neater result and fewer errors. The only thing is that you have cannot measure the inset with 100% accuracy. You can move the amount of offset but also the position from which the offset is being dragged. This give a fair amount of variation and can create problems but is still better than the automatic option. Selecting this tool also creates a copy of the selected path so it's quite quick to use. There are some strange effects though. There seems to be a bug which causes all kind of artefacts to appear and make a mess of things. They can't be removed and appear scattered around the original shape for no apparent reason.

  And here I ran of interest in doing this....

No comments :