mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 16:27:51 -06:00
D5: Added support of printers with center is zero parameter
This commit is contained in:
parent
4aa59950ca
commit
e6ebd225d3
1 changed files with 10 additions and 9 deletions
|
@ -140,6 +140,7 @@ class GCodeReader(MeshReader):
|
||||||
current_block = LayerPolygon.Inset0Type
|
current_block = LayerPolygon.Inset0Type
|
||||||
current_layer = 0
|
current_layer = 0
|
||||||
prev_z = 0
|
prev_z = 0
|
||||||
|
center_is_zero = False
|
||||||
|
|
||||||
self._message = Message(catalog.i18nc("@info:status", "Parsing GCODE"), lifetime=0)
|
self._message = Message(catalog.i18nc("@info:status", "Parsing GCODE"), lifetime=0)
|
||||||
self._message.setProgress(0)
|
self._message.setProgress(0)
|
||||||
|
@ -173,11 +174,15 @@ class GCodeReader(MeshReader):
|
||||||
if line[0] == ";":
|
if line[0] == ";":
|
||||||
continue
|
continue
|
||||||
G = self._getInt(line, "G")
|
G = self._getInt(line, "G")
|
||||||
if G is not None:
|
|
||||||
if G == 0 or G == 1:
|
|
||||||
x = self._getFloat(line, "X")
|
x = self._getFloat(line, "X")
|
||||||
y = self._getFloat(line, "Y")
|
y = self._getFloat(line, "Y")
|
||||||
z = self._getFloat(line, "Z")
|
z = self._getFloat(line, "Z")
|
||||||
|
if x is not None and x < 0:
|
||||||
|
center_is_zero = True
|
||||||
|
if y is not None and y < 0:
|
||||||
|
center_is_zero = True
|
||||||
|
if G is not None:
|
||||||
|
if G == 0 or G == 1:
|
||||||
e = self._getFloat(line, "E")
|
e = self._getFloat(line, "E")
|
||||||
z_changed = False
|
z_changed = False
|
||||||
if x is not None:
|
if x is not None:
|
||||||
|
@ -206,17 +211,12 @@ class GCodeReader(MeshReader):
|
||||||
current_path.clear()
|
current_path.clear()
|
||||||
|
|
||||||
elif G == 28:
|
elif G == 28:
|
||||||
x = self._getFloat(line, "X")
|
|
||||||
y = self._getFloat(line, "Y")
|
|
||||||
if x is not None:
|
if x is not None:
|
||||||
current_x = x
|
current_x = x
|
||||||
if y is not None:
|
if y is not None:
|
||||||
current_y = y
|
current_y = y
|
||||||
current_z = 0
|
current_z = 0
|
||||||
elif G == 92:
|
elif G == 92:
|
||||||
x = self._getFloat(line, "X")
|
|
||||||
y = self._getFloat(line, "Y")
|
|
||||||
z = self._getFloat(line, "Z")
|
|
||||||
e = self._getFloat(line, "E")
|
e = self._getFloat(line, "E")
|
||||||
if x is not None:
|
if x is not None:
|
||||||
current_x = x
|
current_x = x
|
||||||
|
@ -262,6 +262,7 @@ class GCodeReader(MeshReader):
|
||||||
machine_width = settings.getProperty("machine_width", "value")
|
machine_width = settings.getProperty("machine_width", "value")
|
||||||
machine_depth = settings.getProperty("machine_depth", "value")
|
machine_depth = settings.getProperty("machine_depth", "value")
|
||||||
|
|
||||||
|
if not center_is_zero:
|
||||||
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
||||||
|
|
||||||
Logger.log("d", "Loaded %s" % file_name)
|
Logger.log("d", "Loaded %s" % file_name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue