looking for a CLI-tool: convert plain text to gerber
- moony
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
19 Nov 2017 21:12 #102038
by moony
looking for a CLI-tool: convert plain text to gerber was created by moony
Hi there,
I hope I'm in the right place to ask for something like this: I'm looking for a commandline-tool, that can convert plain-text into coordinates of a vector font, preferably in gerber file fomat. Is there anything like that out there?
I hope I'm in the right place to ask for something like this: I'm looking for a commandline-tool, that can convert plain-text into coordinates of a vector font, preferably in gerber file fomat. Is there anything like that out there?
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23182
- Thank you received: 4868
24 Nov 2017 14:55 #102290
by andypugh
Replied by andypugh on topic looking for a CLI-tool: convert plain text to gerber
It looks like nobody here knows of one.
For a one-off I have used a spreadsheet for this. Text-to-columns then insert columns full of G-codes and coordinates, then re-export as space-delimited.
It's probably easy in Perl too. Or create a little Python file, something like this. (untested, just to give a feel)
You can experiment with the RegEx I used here: regexr.com/3h8md
For a one-off I have used a spreadsheet for this. Text-to-columns then insert columns full of G-codes and coordinates, then re-export as space-delimited.
It's probably easy in Perl too. Or create a little Python file, something like this. (untested, just to give a feel)
#!/usr/bin/python
import re
import sys
import shutil
filename = sys.argv[1:]:
if not os.path.isfile(opt):
{Error message here}
sys.exit()
file = open(filename,'r').read()
file=re.sub("(\d*\.*\d*),(\d*\.*\d*)", "G0 X$1 Y$2", file,flags=re.M)
newfile = open("filename"+& ".ngc")
newfile.write(file)
filename.close()
newfile.close()
You can experiment with the RegEx I used here: regexr.com/3h8md
Please Log in or Create an account to join the conversation.
Time to create page: 0.056 seconds