{"id":18694731,"url":"https://github.com/martinfrances107/gcode-nom","last_synced_at":"2025-11-11T11:07:12.801Z","repository":{"id":260667684,"uuid":"881598495","full_name":"martinfrances107/gcode-nom","owner":"martinfrances107","description":"Visualize G-code files","archived":false,"fork":false,"pushed_at":"2025-04-01T22:04:53.000Z","size":31653,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T23:09:52.113Z","etag":null,"topics":["byte-array","grammer","nom","parse","parser","parser-combinator","rust","validator"],"latest_commit_sha":null,"homepage":"","language":"G-code","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinfrances107.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-31T22:21:31.000Z","updated_at":"2025-04-01T22:04:56.000Z","dependencies_parsed_at":"2025-03-08T09:32:23.495Z","dependency_job_id":null,"html_url":"https://github.com/martinfrances107/gcode-nom","commit_stats":null,"previous_names":["martinfrances107/gcode2svg","martinfrances107/gcode-nom"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinfrances107%2Fgcode-nom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinfrances107%2Fgcode-nom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinfrances107%2Fgcode-nom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinfrances107%2Fgcode-nom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinfrances107","download_url":"https://codeload.github.com/martinfrances107/gcode-nom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125616,"owners_count":21051770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["byte-array","grammer","nom","parse","parser","parser-combinator","rust","validator"],"created_at":"2024-11-07T11:12:35.770Z","updated_at":"2025-11-11T11:07:12.796Z","avatar_url":"https://github.com/martinfrances107.png","language":"G-code","readme":"# gcode-nom\n\nRust 2021 Edition.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://crates.io/crates/gcode-nom\"\u003e\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/gcode-nom.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://docs.rs/gcode-nom/latest/gcode_nom\" rel=\"nofollow noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/crates/d/gcode_nom.svg\" alt=\"Documentation\"\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\nA library containing a full set of [nom](https://crates.io/crates/nom) parsers for decoding gcode files.\n\nBoth .gcode files and binary .bgcode files are recognized.\n\nBased on this library the workspace contains a series of visualization tools\n\n* gcode2obj - Generates \"WaveFront Obj\" files.\n* gcode2svg - Generates SVG files.\n* gcodeExtractThumbs - Extracts the images embedded in a binary-gcode file.\n* bgcodeViewer - Generates a report by turning on all the logging and them attempts to parse the file.\n\nI intend the parsers to be as strictly compliant as possible. This is under-going rapid development. **Please** create a issue in the associated git repository.\n\nSee [nom](https://crates.io/crates/nom) - \"A byte-oriented, zero-copy, parser combinator library\"\n\n## Changelog\n\n Version 0.6.0 adds supports of G02/G03 \"Arc or Circle\" commands.\n   Allowing a more diverse set of gcode files to be rendered.\n\n Between version 0.4 and 0.5 a major performance misconception was unpicked.\n\nA 9.9MByte file is processed 60 times faster. Now in 1.3secs\n\n[ See the assets folder associated with this repository \"gear-holder-print-in-place_04n_022mm_pla_mk4_6h49m.bgcode\" ]\n\n## Tools\n\n### gcode2obj\n\nGenerates obj files.\n\nPass the gcode file into StdIn - the obj file is sent to StdOut :-\n\n```bash\ncd gcode2obj\ncargo run --release -- \u003c ./assets/benchy.gcode \u003e benchy.obj\n```\n\nIf a filename is passed in as a command line parameter then a obj file will be dumped to StdOut.\n\n```bash\ncd gocode2obj\ncargo run --release -- ../assets/X\\ 6x6_0.15mm_PLA_MK3S_1h55m.gcode \u003e X.obj\n```\n\nWhich for example can be imported into blender for visualization.\n\n![Benchy in Blender](https://github.com/martinfrances107/gcode-nom/blob/main/images/BlenderBenchy.png?raw=true)\n![Lego bricks](https://github.com/martinfrances107/gcode-nom/blob/main/images/lego.png?raw=true)\n![gears](https://github.com/martinfrances107/gcode-nom/blob/main/images/gears.png?raw=true)\n\nWithin blender :-\n\n1) This obj has been \"Imported\".\n2) Converted into a \"Curve\".\n3) Finally a circular bevel object has been applied to make the object solid [ A circle to represent a 0.1mm fibre].\n\n## gcode2svg\n\nGenerate svg files\n\n![Benchy in Blender](https://raw.githubusercontent.com/martinfrances107/gcode-nom/367a7add7ed0dcad84ea20d21fd2076b559188b9/images/benchy.svg)\n\n### How to use\n\nPass the gcode file into StdIn - the SVG file is sent to StdOut :-\n\n```bash\ncd gcode2svg\ncargo run --release -- \u003c ./assets/benchy.gcode \u003e benchy.svg\n```\n\nIf a filename is passed in as a command line parameter then a svg file will be dumped to StdOut.\n\n```bash\ncd gocode2svg\ncargo run --release -- ../assets/X\\ 6x6_0.15mm_PLA_MK3S_1h55m.gcode \u003e X.svg\n```\n\n### gcodeExtractThumbs\n\n Iterates over all the embedded thumbnail block and save the images to disk\n\n ```bash\n cargo run --release  --  ../assets/both\\ parts.bgcode\n ```\n\n### bgcodeViewer\n\n Strict checking of **binaries**. validates blocks checksums, ensures 'block' parameters values are within valid ranges.\n\nPass the gcode file into StdIn - A summary file is written to StdOut\n\n ```rust\n cd bgcodeViewer\n cargo run --release  \u003c ../assets/both\\ parts.bgcode \u003e summary.txt\n ```\n\n## Future work\n\nsee [TODO](TODO.md)\n\nMissing implementations\n\nG2/G3 -- Arc have two forms \"IJ\" and \"R\". \"R\" the less popular form is unimplemented.\n\nG5 - Bézier Cubic Spline Command\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinfrances107%2Fgcode-nom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinfrances107%2Fgcode-nom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinfrances107%2Fgcode-nom/lists"}