Giter Club home page Giter Club logo

gcode-parser-and-viz's Introduction

G-code parsing and visualization in Blender

This repository contains scripts for Blender (checked with 3.4.1 version) that allow you to parse and visualize single-material .gcode files generated with PrusaSlicer.

Render Viewport

*Model: "Cyberpunk Robots x6" by CharlieVet


PrusaSlicer setup

The sample g-code was created with PrusaSlicer-2.6.1. Put the ;LAYER_Z_HEIGHT=[layer_z] line in the "Before layer change G-code" in PrusaSlicer.

G-code parsing

PrusaSlicer 2.6.1 supports G-Code parser supports 12 types of nozzle movements:

  • (1) Perimeter
  • (2) External perimeter
  • (3) Overhang perimeter
  • (4) Internal infill
  • (5) Solid infill
  • (6) Top solid infill
  • (7) Bridge infill
  • (8) Support material
  • (9) Support material interface
  • (10) Skirt/Brim
  • (11) Wipe tower
  • (12) Custom

The developed parser combines all perimeters as Shell, all infills - as Fill, and all supports - as Support.

Setup Blender environment

You can manually set light sources, camera settings, background images, HDRI maps, and materials. Alternatively, you can run certain scripts ("scene_setup_scripts" folder) to automate some parts of this process.

Blender scene

The script-based scene genetator picks the local "print_bed.jpg" file and scales it to real 210x210 mm Prusa Printer dimensions.

Run in Blender

To run it in Blender: (1) copy the code from the "blender_scripts" folder, (2) paste in a new script created in the "Scripting" tab, (3) update the "TODO" sections in the code, and (4) hit the "Run" button.



When you run a script, Blender becomes unresponsive. Therefore, switch the system console window to be able to “Ctrl+C” (break) processing in case of any errors.

Toggle system console Console window

Add automatic animation

Uncomment the animate_layers() function in the script.

gcode-parser-and-viz's People

Contributors

apetsiuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.