Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
1877d2cc
Commit
1877d2cc
authored
Oct 17, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle G92 in hosts
parent
fd89ad28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
gcoder.py
printrun/gcoder.py
+14
-8
No files found.
printrun/gcoder.py
View file @
1877d2cc
...
@@ -87,7 +87,8 @@ class Layer(list):
...
@@ -87,7 +87,8 @@ class Layer(list):
self
.
z
=
z
self
.
z
=
z
def
_preprocess
(
self
,
current_x
,
current_y
,
current_z
,
def
_preprocess
(
self
,
current_x
,
current_y
,
current_z
,
offset_x
,
offset_y
,
offset_z
,
ignore_noe
=
False
):
offset_x
,
offset_y
,
offset_z
,
ignore_noe
=
False
,
host_mode
=
True
):
xmin
=
float
(
"inf"
)
xmin
=
float
(
"inf"
)
ymin
=
float
(
"inf"
)
ymin
=
float
(
"inf"
)
zmin
=
0
zmin
=
0
...
@@ -136,9 +137,14 @@ class Layer(list):
...
@@ -136,9 +137,14 @@ class Layer(list):
if
line
.
z
:
current_z
=
0
if
line
.
z
:
current_z
=
0
elif
line
.
command
==
"G92"
:
elif
line
.
command
==
"G92"
:
if
line
.
x
:
offset_x
=
current_x
-
line
.
x
if
host_mode
:
if
line
.
y
:
offset_y
=
current_y
-
line
.
y
current_x
=
line
.
x
or
current_x
if
line
.
z
:
offset_z
=
current_z
-
line
.
z
current_y
=
line
.
y
or
current_y
current_z
=
line
.
z
or
current_z
else
:
if
line
.
x
:
offset_x
=
current_x
-
line
.
x
if
line
.
y
:
offset_y
=
current_y
-
line
.
y
if
line
.
z
:
offset_z
=
current_z
-
line
.
z
line
.
current_x
=
current_x
line
.
current_x
=
current_x
line
.
current_y
=
current_y
line
.
current_y
=
current_y
...
@@ -175,14 +181,14 @@ class GCode(object):
...
@@ -175,14 +181,14 @@ class GCode(object):
est_layer_height
=
None
est_layer_height
=
None
def
__init__
(
self
,
data
):
def
__init__
(
self
,
data
,
host_mode
=
True
):
self
.
lines
=
[
Line
(
l2
)
for
l2
in
self
.
lines
=
[
Line
(
l2
)
for
l2
in
(
l
.
strip
()
for
l
in
data
)
(
l
.
strip
()
for
l
in
data
)
if
l2
]
if
l2
]
self
.
_preprocess_lines
()
self
.
_preprocess_lines
()
self
.
filament_length
=
self
.
_preprocess_extrusion
()
self
.
filament_length
=
self
.
_preprocess_extrusion
()
self
.
_create_layers
()
self
.
_create_layers
()
self
.
_preprocess_layers
()
self
.
_preprocess_layers
(
host_mode
=
host_mode
)
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
line_idxs
)
return
len
(
self
.
line_idxs
)
...
@@ -359,7 +365,7 @@ class GCode(object):
...
@@ -359,7 +365,7 @@ class GCode(object):
def
num_layers
(
self
):
def
num_layers
(
self
):
return
len
(
self
.
layers
)
return
len
(
self
.
layers
)
def
_preprocess_layers
(
self
):
def
_preprocess_layers
(
self
,
host_mode
=
True
):
xmin
=
float
(
"inf"
)
xmin
=
float
(
"inf"
)
ymin
=
float
(
"inf"
)
ymin
=
float
(
"inf"
)
zmin
=
0
zmin
=
0
...
@@ -379,7 +385,7 @@ class GCode(object):
...
@@ -379,7 +385,7 @@ class GCode(object):
for
l
in
self
.
all_layers
:
for
l
in
self
.
all_layers
:
meta
=
l
.
_preprocess
(
current_x
,
current_y
,
current_z
,
meta
=
l
.
_preprocess
(
current_x
,
current_y
,
current_z
,
offset_x
,
offset_y
,
offset_z
,
offset_x
,
offset_y
,
offset_z
,
ignore_noe
)
ignore_noe
,
host_mode
)
current_x
,
current_y
,
current_z
=
meta
[
0
]
current_x
,
current_y
,
current_z
=
meta
[
0
]
offset_x
,
offset_y
,
offset_z
=
meta
[
1
]
offset_x
,
offset_y
,
offset_z
=
meta
[
1
]
(
xm
,
xM
),
(
ym
,
yM
),
(
zm
,
zM
)
=
meta
[
2
:]
(
xm
,
xM
),
(
ym
,
yM
),
(
zm
,
zM
)
=
meta
[
2
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment