-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: Add MakerbotReader plugin to support .makerbot files #20645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit introduces a new plugin, MakerbotReader, which allows Cura to open .makerbot files. The plugin handles .makerbot files as zip archives and can currently process `print.gcode` files found within these archives. If a `print.jsontoolpath` file is found, a warning is displayed to you, as this specific toolpath format is not yet supported by this reader. The implementation follows the pattern of other readers like UFPReader, utilizing the existing GCodeReader for parsing gcode data.
print.gcode
files found within these archives. If a
print.jsontoolpath
file is found, a warning is displayed to you, as this specific toolpath format is not yet supported by this
reader.
The implementation follows the pattern of other readers like UFPReader,
utilizing the existing GCodeReader for parsing gcode data.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for opening and parsing .makerbot
archives by introducing a new MakerbotReader plugin that delegates G-code handling to the existing GCodeReader.
- Registers
.makerbot
mime type and file extension inplugin.json
- Implements
MakerbotReader._read
to extractprint.gcode
, decode it, and feed it to GCodeReader - Warns and aborts on unsupported
print.jsontoolpath
entries
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
plugins/MakerbotReader/plugin.json | Defines the MakerbotReader plugin manifest |
plugins/MakerbotReader/MakerbotReader.py | Implements file extraction and GCodeReader usage |
Comments suppressed due to low confidence (1)
plugins/MakerbotReader/MakerbotReader.py:1
- There are currently no unit or integration tests for the MakerbotReader plugin—adding tests for
.makerbot
extraction and GCodeReader integration would help catch regressions.
# Copyright (c) 2024 UltiMaker
# The GCodeReader's read method expects a file name, but we have a stream. | ||
# We need to ensure preReadFromStream and readFromStream are correctly used. | ||
# GCodeReader's typical usage might involve filenames for context, so we pass the original .makerbot filename. | ||
cast(MeshReader, gcode_reader).preReadFromStream(gcode_stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCodeReader.preReadFromStream and readFromStream expect a file-like object, not a raw string. Wrap gcode_stream
in io.StringIO
to provide the correct interface.
Copilot uses AI. Check for mistakes.
return None | ||
|
||
# Check for gcode file first | ||
gcode_file_path_in_archive = "print.gcode" # Common name in MakerBot files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the archive entry names (print.gcode
and print.jsontoolpath
) into constants for clarity and to avoid duplication.
Copilot uses AI. Check for mistakes.
Logger.info(f"Attempting to read Makerbot file: {file_name}") | ||
nodes: List[SceneNode] = [] | ||
try: | ||
archive = VirtualFile() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource cleanup is scattered across multiple return paths—consider using a try/finally
or context manager to ensure archive.close()
is always called, even on unexpected errors.
Copilot uses AI. Check for mistakes.
Description
Created by Jules AI agent (not yet tested)
This commit introduces a new plugin, MakerbotReader, which allows
Cura to open .makerbot files.
The plugin handles .makerbot files as zip archives and can currently
process
print.gcode
files found within these archives. If aprint.jsontoolpath
file is found, a warning is displayed to you, as this specific toolpath format is not yet supported by thisreader.
The implementation follows the pattern of other readers like UFPReader,
utilizing the existing GCodeReader for parsing gcode data.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: