Multi-line text engraving g-code generator

More
26 Oct 2014 19:48 #52407 by cparsons
cparsons replied the topic: Multi-line text engraving g-code generator
FINALLY got it working!

In desperation I thought I would have alook at the single line version and noticed a comment about QCAD 3 fonts being incompatible - so downloaded from the link which was helpfully supplied to the compatible fonts, and it now works, wahoo

Didn't need to add the variable declarations either - I commented these out and it still seems to work so I will have to try and work out why I got error messages at some point

You are right, not very intuitive but still a helpful utlility, pity the message about using the older fonts and link to them was not repeated, would have saved me a lot of time but I got there in the end, thanks

Chris
More
26 Oct 2014 21:19 #52409 by ArcEye
ArcEye replied the topic: Multi-line text engraving g-code generator

You are right, not very intuitive but still a helpful utlility, pity the message about using the older fonts and link to them was not repeated,......


At the time it was written and the instructions prepared, there were no older fonts, QCad used .cxf fonts.
It throws an error if it cannot find the default romanc.cxf font, you should have had that.

As usual, the next version of QCad broke backward compatibility when they started using different fonts B)

As for intuitive, it is a command line program, if you want the options you either put in -h or --help, one of them will always work.

Glad you got there eventually

regards
More
26 Oct 2014 22:33 - 26 Oct 2014 22:35 #52410 by ArcEye
ArcEye replied the topic: Multi-line text engraving g-code generator

BigJohnT wrote: I did add this around line 469 to make it show the help file if no arguments are passed.

    if len(sys.argv[1:]) == 0:
        help_message()
        sys.exit(0)

Makes it a little more intuitive.

JT


I have added your test and the resultant code plus the man file is in this new zip

There is also a zip of the earlier versions of the qcad fonts available on my site.
www.mgware.co.uk/LinuxCNC/qcad-fonts.zip

Hopefully that will prevent similar problems

regards
Attachments:
Last Edit: 26 Oct 2014 22:35 by ArcEye.
The following user(s) said Thank You: cparsons
More
20 Jul 2016 10:18 #77695 by cparsons
cparsons replied the topic: Multi-line text engraving g-code generator
Just had to reinstall engrave-lines.py (bombed drive!) and used the '-v4' version but it will not allow embedded spaces in lines?

As soon as a space in encountered in a line the gcode generation stops - and will not generate the subsequent lines?

For instance

0 Hello World
1 Line1
2 Line2

Results in the gcode to engrave 'Hello'

This may have been the case all along but at the back of my mind I am sure I have managed to do this in the version I had in the past?

Of course I can have each word in it's own line and space them accordingly but don't remember having to do this before?

Regards

Chris
More
20 Jul 2016 11:06 #77696 by ArcEye
ArcEye replied the topic: Multi-line text engraving g-code generator
Something wrong your end.

engrave-lines -X7.5 -x5 -i'123' -Y12.75 -y5.25 -S0.4 -s0.5 -Z2 -D0.1 -0'Line 0' -1'Line 1' -2'Line 2' -3'Line 3' > test.ngc

produces



Suggest you re-install and make sure you have the fonts from the zip, not anything qcad provides.
Attachments:
More
20 Jul 2016 12:02 #77700 by cparsons
cparsons replied the topic: Multi-line text engraving g-code generator
Nope, doesn't work for me...I got around it in the end by double quoting the string inside the single quotes, ie

-0'"Hello World"'
-1'Line1'

etc

Maybe something to do with character sets or something? (wild guess!)

Without the extra double quotes the header message in the ngc file said

( Line 0 )
( Code generated by engrave-lines.py )
( by ArcEye 2012, based on work by <Lawrence Glaister>)
( Engraving: "'Hello") << note the double quote followed by single quote, but closed with just a double quote
( Fontfile: fonts/romanc.cxf )

Not an issue (now) but I am curious why I get this? (I am running this from Windows 7 32bit in the office, Python 2.7)

Chris
More
20 Jul 2016 12:09 #77701 by ArcEye
ArcEye replied the topic: Multi-line text engraving g-code generator

Not an issue (now) but I am curious why I get this? (I am running this from Windows 7 32bit in the office, Python 2.7)


I have no idea, it works fine on Jessie amd64 with python 2.7.

If you want to use programs written for linux on windoze, you will have to fix your own problems I'm afraid.
The following user(s) said Thank You: cparsons
More
20 Jul 2016 12:50 #77702 by cparsons
cparsons replied the topic: Multi-line text engraving g-code generator
Yes, of course - it wasn't a complaint, just curiosity, I am learning Python and thought it was fairly portable

When I have a minute I am going to rebuild my LinuxCNC machine with 2.7.5 so hopefully this won't be an issue (I had a HDD crash)

I also noticed some messages about 'Features' that appeared to run your code, this looks like a very interesting development - LinuxCNC seems to be ever moving upwards/forwards thanks to a lot of hard work, wish I knew enough to be able to help myself

Best wishes

Chris
More
20 Jul 2016 12:55 #77704 by BigJohnT
BigJohnT replied the topic: Multi-line text engraving g-code generator

cparsons wrote: Yes, of course - it wasn't a complaint, just curiosity, I am learning Python and thought it was fairly portable


Python is fairly portable but there are some things that work differently and if the program doesn't detect the OS and use those things that are different for Windoze then it will not work in Windoze. To start google python differences between windows and linux

JT
More
20 Jul 2016 13:01 #77705 by ArcEye
ArcEye replied the topic: Multi-line text engraving g-code generator
At a SWAG, either windoze implementation of python differs, or the windoze command shell treats quoting differently.
I lean towards the latter.

Quoting is often used to ensure that blocks of text are seen as an entity.
That is the purpose of the -1`text here` quoting, to prevent only the section until the 0x20 char (space) being seen as the argument

shells will treat `text here` differently from "text here" in some situations, as will other programs
bash will usually accept either, but in some circumstances requires one of them
eg
echo $STRING will produce the string held in the variable, but if you want to compare it, it needs to be quoted.

if [ $STRING == "yes" ] will fail
needs to be
if [ "$STRING" == "yes" ]

I would experiment, you may find that simply using quotation marks instead of apostrophes or back ticks may work
The following user(s) said Thank You: cparsons
Time to create page: 0.134 seconds
Powered by Kunena Forum