Skip to content

npostma/GSeam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GSeam: CNC G-code Post-Processing Tools

A collection of Python scripts to enhance and automate your CNC G-code workflow before sending jobs to LinuxCNC.

These tools help you combine, clean, validate, and augment G-code generated by any CAD/CAM system (such as Fusion 360, FreeCAD, etc.) before running it on your CNC machine.


Why?

  • Simplify multi-operation workflows from multiple CAM files
  • Ensure safe toolchanges and predictable start/end sequences
  • Remove unnecessary comments or lines
  • Automatically renumber lines for clarity and compatibility
  • Validate G-code for common issues before risking a machine run

Example: G-code Merge & Clean Script

The script f360_seam.py (name historic, works for all G-code sources!) allows you to:

  • Merge multiple G-code files into a single program
  • Keep only the relevant header and ending blocks
  • Renumber all N-lines (N10, N20, etc.) for clarity (configurable)
  • Optionally insert safe toolchange subroutine calls
  • Remove unnecessary or repetitive comments
  • Validate the final output and provide a summary report
  • Log all actions and warnings to file or console

Typical Usage

python f360_seam.py operations/ merged.ngc
python f360_seam.py job1.ngc job2.ngc job3.ngc final_job.ngc
python f360_seam.py --insert-toolchange-call --log process.log mydir/ result.ngc

Features

  • Works with any standard G-code files for LinuxCNC
  • Directory mode (merge all .ngc files in folder, ordered by number)
  • File list mode (manual order)
  • Flexible comment filtering (operation/toolchange comments kept, or keep all)
  • Output validation (toolchange count, end marker, summary)
  • Insert safe toolchange calls compatible with LinuxCNC remap/subroutine setup
  • Verbose/debug output, with logging to file

Example: LinuxCNC Safe Toolchange Integration

To use the safe toolchange call feature, configure your LinuxCNC install as follows:

Add this to your INI file:

[RS274NGC]
REMAP=M6 modalgroup=6 ngc=toolchange

Create toolchange.ngc in your nc_subroutines directory:

G53 G0 Z0
G53 G0 X0 Y0
M0 (Change tool and press cycle start)

See the LinuxCNC Remap documentation for advanced usage.


Fusion360 tool library converter

Keep your tools library in linuxcnc in sync with the toolsfile for linux cnc. Uses the exported JSON from fusion to create the tools.tbl file

Typical Usage

py .\f360_toollib_convert.py Library.json

Roadmap

  • More pre-processing utilities (block delete, param substitution, etc.)
  • Support for more CAM-generated G-code variants
  • Unit tests and example data

Contributions

PRs and suggestions are very welcome! Please add clear test cases/examples if you propose new features.


License

GSeam is free software: you may use, modify, and share it, provided that any changes or improvements are contributed back to this project (copyleft).

  • Commercial and non-commercial use allowed
  • Modification allowed, but you must submit your improvements via pull request or equivalent for the benefit of all users

About

G-code Post-Merge Script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages