added machine bounds

CURA-11777
This commit is contained in:
Saumya Jain 2024-05-07 12:51:03 +02:00
parent d8c852b74a
commit fdfc5dcc67

View file

@ -109,13 +109,15 @@ class MakerbotWriter(MeshWriter):
if not success: if not success:
self.setInformation(gcode_writer.getInformation()) self.setInformation(gcode_writer.getInformation())
return False return False
match file_format:
if file_format == "application/x-makerbot-sketch": case "application/x-makerbot-sketch":
filename, filedata = "print.gcode", gcode_text_io.getvalue() filename, filedata = "print.gcode", gcode_text_io.getvalue()
self._PNG_FORMATS = self._PNG_FORMAT self._PNG_FORMATS = self._PNG_FORMAT
else: case "application/x-makerbot":
filename, filedata = "print.jsontoolpath", du.gcode_2_miracle_jtp(gcode_text_io.getvalue()) filename, filedata = "print.jsontoolpath", du.gcode_2_miracle_jtp(gcode_text_io.getvalue())
self._PNG_FORMATS = self._PNG_FORMAT + self._PNG_FORMAT_METHOD self._PNG_FORMATS = self._PNG_FORMAT + self._PNG_FORMAT_METHOD
case _:
raise Exception("Unsupported Mime type")
png_files = [] png_files = []
for png_format in self._PNG_FORMATS: for png_format in self._PNG_FORMATS:
@ -221,9 +223,8 @@ class MakerbotWriter(MeshWriter):
meta["version"] = MakerbotWriter._META_VERSION meta["version"] = MakerbotWriter._META_VERSION
meta["preferences"] = dict() meta["preferences"] = dict()
for node in nodes: bounds = application.getBuildVolume().getBoundingBox()
bounds = node.getBoundingBox() meta["preferences"]["instance0"] = {
meta["preferences"][str(node.getName())] = {
"machineBounds": [bounds.right, bounds.back, bounds.left, bounds.front] if bounds is not None else None, "machineBounds": [bounds.right, bounds.back, bounds.left, bounds.front] if bounds is not None else None,
"printMode": CuraApplication.getInstance().getIntentManager().currentIntentCategory, "printMode": CuraApplication.getInstance().getIntentManager().currentIntentCategory,
} }