g-code replacement filter?

More
04 Mar 2013 22:53 #30847 by andypugh
Replied by andypugh on topic g-code replacement filter?

Great, so how do i tell LinuxCNC to use this filter program? Will it just know?


You need to add an entry in the correct part of the INI file:
www.linuxcnc.org/docs/html/config/ini_co...sub_filter_section_a

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

More
05 Mar 2013 20:24 #30912 by tjamscad
Replied by tjamscad on topic g-code replacement filter?

Great, so how do i tell LinuxCNC to use this filter program? Will it just know?


You need to add an entry in the correct part of the INI file:
www.linuxcnc.org/docs/html/config/ini_co...sub_filter_section_a


How do I tell it to be called up? This is what is in the .ini now
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script

png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

So, I write this program and name it convert.py. Where do I put it in the file tree and how do i list it in the .ini section?

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

More
05 Mar 2013 20:51 #30913 by andypugh
Replied by andypugh on topic g-code replacement filter?

How do I tell it to be called up? This is what is in the .ini now
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script

png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python?


Looking at image-to-gcode as an example: Put your new filter program (which would need to be some sort of executable file) in the same place as image-to-gcode, which lives in /usr/bin/ with most other executable programs. Lets assume that the file is called gcodefilter andyou want to leave .ngc files unfiltered, and convert .tap files

PROGRAM_EXTENSION = .tap Some Comment Here if You Want

then you need to tell the system which filter to use:

.tap = gcodefilter

And that should be it.

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

More
05 Mar 2013 21:16 #30916 by tjamscad
Replied by tjamscad on topic g-code replacement filter?
Thanks, Andy
I am sure I will be asking more later but for now.

My new .ini

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .ngc gcode file
PROGRAM_EXTENSION = .txt possible gcode file

png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
ngc = gcodeconvert.txt
txt = gcodeconvert.txt

and filter just for testing "y0" is changed to "stop"

#!/bin/bash
sed -e 's/\(y0\)\([0-1000000]*\)/stop\2/' $1

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

More
05 Mar 2013 21:25 #30918 by andypugh
Replied by andypugh on topic g-code replacement filter?

ngc = gcodeconvert.txt
txt = gcodeconvert.txt


Having a .txt extension on an executable file is a little bit unusual.

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

More
06 Mar 2013 05:51 #30942 by tjamscad
Replied by tjamscad on topic g-code replacement filter?

ngc = gcodeconvert.txt
txt = gcodeconvert.txt


Having a .txt extension on an executable file is a little bit unusual.


That is true, I just told Ubuntu to make it executable. Should it be something else?

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

More
06 Mar 2013 06:09 #30943 by andypugh
Replied by andypugh on topic g-code replacement filter?

Having a .txt extension on an executable file is a little bit unusual.


That is true, I just told Ubuntu to make it executable. Should it be something else?

Linux doesn't really care. It just looks funny.

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

More
22 Mar 2013 06:18 - 22 Mar 2013 06:21 #31701 by tjamscad
Replied by tjamscad on topic g-code replacement filter?
I have broken my filter. Where should the exe be located? will this be ok in the ini? My previous attempt was working now it is not and changeing back to what it was didnt help either.

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .ngc gcode file
PROGRAM_EXTENSION = .txt possible gcode file
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
ngc = convert.py
txt = convert.py
Last edit: 22 Mar 2013 06:21 by tjamscad.

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

Time to create page: 0.108 seconds
Powered by Kunena Forum