Gcode reader for RepRap variant generated by Slic3r #42925
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#42925
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This script adds an "Import" capability for GCode files generated by the popular Slic3r generator. Each layer is created as an individual object consisting of a set of polyline curves which are beveled with an ellipse. Filenames should be of the form "file.gcode"
Source code and documentation also available on on GitHub
ioImportGcode.py
Changed status to: 'Open'
Added subscriber: @butler
Added subscriber: @ideasman42
Checked the script.
Can you exmplain the use case for having this?
Typically gcode is generated from 3D models (isnt it more of an output only format?).
Checked over the code, some basic notes.
polyline.points.add
- try to batch these calls (add the total number of points, then fill them in), adding one at a time is quite inefficient (it realloc's each time internally).I think the Operator subclass could be split out from the import class. The operator can just define the draw/execute/invoke functions. Would prefer to use a separate class for the internal loading logic. (most Blender importers do this too).
Using
eval
to run functions is insecure (gcode files could have code embedded) and unnecessary. Instead you can use:if delta in self.thickness.keys(): self.thickness[delta]
isn't very efficient, you can instead do:... this is faster too.
if axis not in npos.keys()
can be written asif axis not in npos
... applies to other areas.if axis in ['X', 'Y', 'Z', 'E']:
, can use a static-set eg:if axis in {'X', 'Y', 'Z', 'E'}:
replace
for extensions is error prone (.gcode could exist in middle of string). useos.path.splitext
instead.Thanks for the feedback! I'll look into making the changes you suggested.
The use case is to visualize the 3D print before printing. People just getting started with 3D printing often have trouble understanding the resolution limitations of 3D printing. The goal is to be able to pull the Gcode back into Blender and compare the 3D print to the object you modeled so you know what to fix before printing.
With regard to the "Operator" and "import" classes, can you point me at reference documentation so I can separate them out? I'm afraid that was something I just copied from someone else's script.
Regarding splitting the functions out
PLY Import is an example:
class:
https://developer.blender.org/diffusion/BA/browse/master/io_mesh_ply/init.py;b8577cee6fd9aa8483ce66e79df0cdfd6542f403$155
export function:
https://developer.blender.org/diffusion/BA/browse/master/io_mesh_ply/export_ply.py;b8577cee6fd9aa8483ce66e79df0cdfd6542f403$185
In this case theres no need to make them into separate files though.
Added subscriber: @mont29
Changed status from 'Open' to: 'Archived'
Nothing new here since months… closing for now, we can always reopen it should requested points be addressed.
Changed status from 'Archived' to: 'Archived'