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

@ -55,9 +55,9 @@ class MakerbotWriter(MeshWriter):
] ]
_PNG_FORMAT_METHOD = [ _PNG_FORMAT_METHOD = [
{"prefix": "thumbnail", "width": 140, "height": 106}, {"prefix": "thumbnail", "width": 140, "height": 106},
{"prefix": "thumbnail", "width": 212, "height": 300}, {"prefix": "thumbnail", "width": 212, "height": 300},
{"prefix": "thumbnail", "width": 960, "height": 1460}, {"prefix": "thumbnail", "width": 960, "height": 1460},
] ]
_META_VERSION = "3.0.0" _META_VERSION = "3.0.0"
@ -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,12 +223,11 @@ 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, }
}
meta["miracle_config"] = {"gaggles": {str(node.getName()): {} for node in nodes}} meta["miracle_config"] = {"gaggles": {str(node.getName()): {} for node in nodes}}