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
00c69a8a
Commit
00c69a8a
authored
Jul 19, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework excluder logic (#413)
parent
d99be75b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
+36
-10
pronterface.py
pronterface.py
+36
-10
No files found.
pronterface.py
View file @
00c69a8a
...
@@ -183,6 +183,9 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -183,6 +183,9 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
_set_fgcode
(
self
,
value
):
def
_set_fgcode
(
self
,
value
):
self
.
_fgcode
=
value
self
.
_fgcode
=
value
self
.
excluder
=
None
self
.
excluder
=
None
self
.
excluder_e
=
None
self
.
excluder_z_abs
=
None
self
.
excluder_z_rel
=
None
fgcode
=
property
(
_get_fgcode
,
_set_fgcode
)
fgcode
=
property
(
_get_fgcode
,
_set_fgcode
)
def
__init__
(
self
,
filename
=
None
,
size
=
winsize
):
def
__init__
(
self
,
filename
=
None
,
size
=
winsize
):
...
@@ -414,8 +417,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -414,8 +417,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
is_excluded_move
(
self
,
gline
):
def
is_excluded_move
(
self
,
gline
):
if
not
gline
.
is_move
or
not
self
.
excluder
or
not
self
.
excluder
.
rectangles
:
if
not
gline
.
is_move
or
not
self
.
excluder
or
not
self
.
excluder
.
rectangles
:
return
False
return
False
if
gline
.
x
==
None
and
gline
.
y
==
None
:
return
False
for
(
x0
,
y0
,
x1
,
y1
)
in
self
.
excluder
.
rectangles
:
for
(
x0
,
y0
,
x1
,
y1
)
in
self
.
excluder
.
rectangles
:
if
x0
<=
gline
.
current_x
<=
x1
and
y0
<=
gline
.
current_y
<=
y1
:
if
x0
<=
gline
.
current_x
<=
x1
and
y0
<=
gline
.
current_y
<=
y1
:
return
True
return
True
...
@@ -425,14 +426,39 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -425,14 +426,39 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if
not
self
.
is_excluded_move
(
gline
):
if
not
self
.
is_excluded_move
(
gline
):
return
gline
return
gline
else
:
else
:
# Check if next move will be excluded too and if it will emit an absolute E set
if
gline
.
z
!=
None
:
if
next_gline
!=
None
and
self
.
is_excluded_move
(
next_gline
)
and
next_gline
.
e
!=
None
and
not
next_gline
.
relative_e
:
if
gline
.
relative
:
return
None
# nothing to do: next move will set absolute E if needed
if
self
.
excluder_z_abs
!=
None
:
else
:
# else, check if this is an extrusion move with non relative E and replace it
self
.
excluder_z_abs
+=
gline
.
z
if
gline
.
e
!=
None
and
not
gline
.
relative_e
:
elif
self
.
excluder_z_rel
!=
None
:
return
gcoder
.
Line
(
"G92 E
%.5
f"
%
gline
.
e
)
self
.
excluder_z_rel
+=
gline
.
z
else
:
# or just do nothing
else
:
return
None
self
.
excluder_z_rel
=
gline
.
z
else
:
self
.
excluder_z_rel
=
None
self
.
excluder_z_abs
=
gline
.
z
if
gline
.
e
!=
None
and
not
gline
.
relative_e
:
self
.
excluder_e
=
gline
.
e
# If next move won't be excluded, push the changes we have to do
if
next_gline
!=
None
and
not
self
.
is_excluded_move
(
next_gline
):
if
self
.
excluder_e
!=
None
:
self
.
p
.
send_now
(
"G92 E
%.5
f"
%
self
.
excluder_e
)
self
.
excluder_e
=
None
if
self
.
excluder_z_abs
!=
None
:
if
gline
.
relative
:
self
.
p
.
send_now
(
"G90"
)
self
.
p
.
send_now
(
"G1 Z.5f"
%
self
.
excluder_z_abs
)
self
.
excluder_z_abs
=
None
if
gline
.
relative
:
self
.
p
.
send_now
(
"G91"
)
if
self
.
excluder_z_rel
!=
None
:
if
not
gline
.
relative
:
self
.
p
.
send_now
(
"G91"
)
self
.
p
.
send_now
(
"G1 Z.5f"
%
self
.
excluder_z_rel
)
self
.
excluder_z_rel
=
None
if
not
gline
.
relative
:
self
.
p
.
send_now
(
"G90"
)
return
None
def
printsentcb
(
self
,
gline
):
def
printsentcb
(
self
,
gline
):
if
gline
.
is_move
and
hasattr
(
self
.
gwindow
,
"set_current_gline"
):
if
gline
.
is_move
and
hasattr
(
self
.
gwindow
,
"set_current_gline"
):
...
...
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