Postprocessor for oscillating tangential knife

More
18 Feb 2026 19:00 #343160 by TurboTux
Hi,
I've bought an oscillating tangential knife (Stepcraft OTK3) a few month ago but didn't found a linux post processor for it, So, I created one myself that should be generally usable because it does not contain any special features for my device. Probably, it may be useful for someone else,

It's written in C++ and can be easily created (needs g++ package on linux, compiling on Windows should be possible as well). Just extract the tgz into a subdirectory by
 tar xvzf OTKPP.tgz
Go into the directory and compile it with
 g++ OTKPP.cc -o OTKPP
alternatively just type
 make 

This should create the OTKPP executable. Copy it somewhere in your search path where it can be found by e.g. by your CAM program. It can also be called in the console For the file "engraving.ngc" you might call
  OTKPP -i engraving.ngc -o engraving_OTK.ngc
If no output option is specified, the result is printed to stdout.
  
There are some more options for example to change the OTK axis (default is C) or the max. angle for retraction. The available options are as follows (also printed if OTKPP is called without parameters):
  
  -a   --axis <axisname>   Name of the OTK axis e.g. A or C (default is C)
  -d     dwell <delay>     Delay time to run-up the oscillation (default 3 sec)
  -dbg --debug             Adds comments to the output about what's going on
  -f   --feed <speed>      Default z-feed (will be replaced by g-code if exists)
  -h   -? | --help         Prints the syntax and available options
  -i   --in <filename>     Path of the input gcode file 
  -l   --limit <angle>     Max. rotation without retraction (default 20°)
  -m   --modulo            Created rotation range [0..360)
  -o   --out <filename>    Path of the modified output gcode file
  -z   --zsafe <position>  Safe retraction height (default 2 machine units e.g. mm)

If the -dbg (or --debug) option is specified, the modifications are commented in the resulting code which should be still executable. The attached tgz also contains an example file (original and after processing)
  
It should be also possible to set up the OTKPP as post processr in your preferred CAM software in order to create the programs for the OTK directly. As I only use CamBam for Linux, here are the steps for the integration (sorry, I don't use Mach3/4 and thus, don't know how to set it up there).

1. Open the post processors settings in CamBam
2. Create a copy of your favorite post procesor (e.g. LinuxCNC -> LinuxCNC-OTK)
3. Add the following line in the "Post-Build Command" option:
    <Path_to_the_program>/OTKPP
4. Add your favorite arguments in the "Post-Build Command Arguments" option (e.g.):
     -dbg -a C -l 25 --in {$outfile} --out {$outfile}
5. Select the LinuxCNC-OTK post processor in the project's operation

Just one warning:
Please take care if your machine works with imperial units (inch), as the default retraction value is 2.0 which is equivalent to 2mm on my metric machine. Adjust the value in the code or by using the -z or --zsafe parameter if necessary. Nevertheless, it might be better to run a dry test anyway.

Feel free to adapt or modify it. If you have questions or run into problems just response.

Hope it helps,
Stefan
Attachments:
The following user(s) said Thank You: tommylight

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

Time to create page: 0.073 seconds
Powered by Kunena Forum