Hi
I have recently been using my small CNC mill to do a large batch of drag engraving of small brass trophy plaques.
Each plaque requires 3 lines of different text, and each plaque differs from the last.
Lawrence Glaister's engrave.py program is excellent, but for this sort of work very time consuming because it only outputs one line at a time.
This requires you to cut and paste several files, each of one line of text, remove unwanted bits and ensure that the text line offsets produce the required output.
I don't normally program in python, but saw no merit in re-writing a perfectly good python font parsing routine into C, just for the sake of it, so slithered into my limited python mode.
The result is a command-line program (yes, old habits die hard, but they are the most flexible and powerful) which takes a plethora of switches (nearly all of which have sensible defaults) which will automatically generate code for engraving up to 10 lines of text
There is built in help
Just invoke
engrave-lines.py -h
and get
engrave-lines.py G-Code Engraving Generator for command-line usage
(C) ArcEye <2012>
based upon code from engrave-11.py
Copyright (C) <2008> <Lawrence Glaister> <ve7it at shaw dot ca>
engrave-lines.py -X -x -Y -y -S -s -Z -D -C -W -M -F -P -p -0 -1 -2 -3 ..............
Options:
-h Display this help message
-X Start X value Defaults to 0
-x X offset between lines Defaults to 0
-Y Start Y value Defaults to 0
-y Y offset between lines Defaults to 0
-S X Scale Defaults to 1
-s Y Scale Defaults to 1
-Z Safe Z for moves Defaults to 2mm
-D Z depth for engraving Defaults to 0.1mm
-C Charactor Space % Defaults to 25%
-W Word Space % Defaults to 100%
-M Mirror Defaults to 0 (No)
-F Flip Defaults to 0 (No)
-P Preamble g code Defaults to "G17 G21 G40 G90 G64 P0.003 F50"
-p Postamble g code Defaults to "M2"
-0 Line0 string follow this
-1 Line1 string follow this
-2 Line2 string follow this
-3 Line3 string follow this
-4 Line4 string follow this
-5 Line5 string follow this
-6 Line6 string follow this
-7 Line7 string follow this
-8 Line8 string follow this
-9 Line9 string follow this
Example
engrave-lines.py -X7.5 -x0 -Y12.75 -y5.25 -S0.4 -s0.5 -Z2 -D0.1 -0'Line0' -1'Line1' -2'Line2' -3'Line3' > test.ngc
So run the example
engrave-lines.py -X7.5 -x0 -Y12.75 -y5.25 -S0.4 -s0.5 -Z2 -D0.1 -0'Line0' -1'Line1' -2'Line2' -3'Line3' > test.ngc
and test.ngc will look like this in Axis
It takes a bit of time to work out what your line offsets need to be and the best starting point X and Y to balance the text on the workpiece, but once you have that sorted you can fly through
I generated all the code required to engrave a further 19 plaques, whilst the mill was engraving the first one!
If it helps you - enjoy
regards