Multi-line text engraving g-code generator

More
10 years 3 months ago #77704 by BigJohnT

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

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #77705 by ArcEye
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

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #77720 by cparsons
Spot on...I substituted the single quotes for double quotes (on their own) and everything worked as expected.

As I said, this will be run on Linux anyway but at least I have learned something this afternoon <g>

Thanks for the feedback

Chris

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #126712 by connectable
Hi, I found all the contributions above very useful. However, I produced a new engraver program that fulfilled my needs more closely:*
* Gcode can be output to either stdout or a file, or both.
* Individual fonts can be used on each separate text line.
* Individual lines can be scaled in both X and Y.
* X and Y start positions for individual line text can be specified,
including a text centreing option.
* Output files contain both a given title and date-time stamp.
* Pre and Postamble code strings can be easily edited to suit
individual CNC software and/or machines

The attached file has the module engraver.py. It includes a main() section demonstrating code use.
The following user(s) said Thank You: Mike_Eitel, andypugh, tommylight

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #127186 by andypugh
It might be worth putting this in a thread of its own to make it easier to find. (maybe just a new post liking to this post)

Please Log in or Create an account to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum