Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jellespijker
Copy link
Member

@jellespijker jellespijker commented May 31, 2025

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 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.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Printer definition file(s)
  • Translations

How Has This Been Tested?

  • not yet
  • Test B

Test Configuration:

  • Operating System:

Checklist:

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.
@jellespijker jellespijker changed the title feat: Add MakerbotReader plugin to support .makerbot files 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. feat: Add MakerbotReader plugin to support .makerbot files May 31, 2025
@jellespijker jellespijker requested a review from Copilot May 31, 2025 10:42
Copy link

@Copilot Copilot AI left a 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 in plugin.json
  • Implements MakerbotReader._read to extract print.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)
Copy link
Preview

Copilot AI May 31, 2025

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
Copy link
Preview

Copilot AI May 31, 2025

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()
Copy link
Preview

Copilot AI May 31, 2025

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.

Copy link
Contributor

github-actions bot commented May 31, 2025

Test Results

23 775 tests  ±0   23 773 ✅ ±0   47s ⏱️ -1s
     1 suites ±0        2 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit f584384. ± Comparison against base commit 6ac6228.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant