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
99da253f
Commit
99da253f
authored
Jun 12, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of github.com:kliment/Printrun into experimental
parents
cef4c50a
099c68ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
gcoder.py
printrun/gcoder.py
+28
-18
actors.py
printrun/libtatlin/actors.py
+1
-1
No files found.
printrun/gcoder.py
View file @
99da253f
...
@@ -25,7 +25,7 @@ gcode_exp = re.compile("\([^\(\)]*\)|;.*|[/\*].*\n|[a-z][-+]?[0-9]*\.?[0-9]*")
...
@@ -25,7 +25,7 @@ gcode_exp = re.compile("\([^\(\)]*\)|;.*|[/\*].*\n|[a-z][-+]?[0-9]*\.?[0-9]*")
m114_exp
=
re
.
compile
(
"
\
([^
\
(
\
)]*
\
)|[/
\
*].*
\n
|[A-Z]:?[-+]?[0-9]*
\
.?[0-9]*"
)
m114_exp
=
re
.
compile
(
"
\
([^
\
(
\
)]*
\
)|[/
\
*].*
\n
|[A-Z]:?[-+]?[0-9]*
\
.?[0-9]*"
)
move_gcodes
=
[
"G0"
,
"G1"
,
"G2"
,
"G3"
]
move_gcodes
=
[
"G0"
,
"G1"
,
"G2"
,
"G3"
]
class
Line
(
object
):
class
Py
Line
(
object
):
__slots__
=
(
'x'
,
'y'
,
'z'
,
'e'
,
'f'
,
'i'
,
'j'
,
's'
,
'p'
,
__slots__
=
(
'x'
,
'y'
,
'z'
,
'e'
,
'f'
,
'i'
,
'j'
,
's'
,
'p'
,
'raw'
,
'split_raw'
,
'raw'
,
'split_raw'
,
...
@@ -34,15 +34,25 @@ class Line(object):
...
@@ -34,15 +34,25 @@ class Line(object):
'current_x'
,
'current_y'
,
'current_z'
,
'extruding'
,
'current_tool'
,
'current_x'
,
'current_y'
,
'current_z'
,
'extruding'
,
'current_tool'
,
'gcview_end_vertex'
)
'gcview_end_vertex'
)
def
__init__
(
self
,
l
):
self
.
raw
=
l
self
.
split_raw
=
gcode_exp
.
findall
(
self
.
raw
.
lower
())
self
.
command
=
self
.
split_raw
[
0
]
.
upper
()
if
not
self
.
split_raw
[
0
]
.
startswith
(
"n"
)
else
self
.
split_raw
[
1
]
.
upper
()
self
.
is_move
=
self
.
command
in
move_gcodes
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
return
None
return
None
def
set
(
self
,
name
,
value
):
setattr
(
self
,
name
,
value
)
LineBase
=
PyLine
class
Line
(
LineBase
):
__slots__
=
()
def
__init__
(
self
,
l
):
super
(
Line
,
self
)
.
__init__
()
self
.
set
(
"raw"
,
l
)
self
.
set
(
"split_raw"
,
gcode_exp
.
findall
(
self
.
raw
.
lower
()))
self
.
set
(
"command"
,
self
.
split_raw
[
0
]
.
upper
()
if
not
self
.
split_raw
[
0
]
.
startswith
(
"n"
)
else
self
.
split_raw
[
1
]
.
upper
())
self
.
set
(
"is_move"
,
self
.
command
in
move_gcodes
)
def
parse_coordinates
(
self
,
imperial
=
False
,
force
=
False
):
def
parse_coordinates
(
self
,
imperial
=
False
,
force
=
False
):
# Not a G-line, we don't want to parse its arguments
# Not a G-line, we don't want to parse its arguments
if
not
force
and
not
self
.
command
[
0
]
==
"G"
:
if
not
force
and
not
self
.
command
[
0
]
==
"G"
:
...
@@ -51,13 +61,13 @@ class Line(object):
...
@@ -51,13 +61,13 @@ class Line(object):
for
bit
in
self
.
split_raw
:
for
bit
in
self
.
split_raw
:
code
=
bit
[
0
]
code
=
bit
[
0
]
if
code
in
gcode_parsed_args
and
len
(
bit
)
>
1
:
if
code
in
gcode_parsed_args
and
len
(
bit
)
>
1
:
se
tattr
(
self
,
code
,
25.4
*
float
(
bit
[
1
:]))
se
lf
.
set
(
code
,
25.4
*
float
(
bit
[
1
:]))
else
:
else
:
for
bit
in
self
.
split_raw
:
for
bit
in
self
.
split_raw
:
code
=
bit
[
0
]
code
=
bit
[
0
]
if
code
in
gcode_parsed_args
and
len
(
bit
)
>
1
:
if
code
in
gcode_parsed_args
and
len
(
bit
)
>
1
:
se
tattr
(
self
,
code
,
float
(
bit
[
1
:]))
se
lf
.
set
(
code
,
float
(
bit
[
1
:]))
del
self
.
split_raw
self
.
set
(
"split_raw"
,
None
)
def
__repr__
(
self
):
def
__repr__
(
self
):
return
self
.
raw
return
self
.
raw
...
@@ -113,9 +123,9 @@ class Layer(object):
...
@@ -113,9 +123,9 @@ class Layer(object):
current_y
=
line
.
y
or
current_y
current_y
=
line
.
y
or
current_y
current_z
=
line
.
z
or
current_z
current_z
=
line
.
z
or
current_z
line
.
current_x
=
current_x
line
.
set
(
"current_x"
,
current_x
)
line
.
current_y
=
current_y
line
.
set
(
"current_y"
,
current_y
)
line
.
current_z
=
current_z
line
.
set
(
"current_z"
,
current_z
)
return
(
current_x
,
current_y
,
current_z
),
(
xmin
,
xmax
),
(
ymin
,
ymax
),
(
zmin
,
zmax
)
return
(
current_x
,
current_y
,
current_z
),
(
xmin
,
xmax
),
(
ymin
,
ymax
),
(
zmin
,
zmax
)
class
GCode
(
object
):
class
GCode
(
object
):
...
@@ -182,9 +192,9 @@ class GCode(object):
...
@@ -182,9 +192,9 @@ class GCode(object):
current_tool
=
self
.
current_tool
current_tool
=
self
.
current_tool
for
line
in
lines
:
for
line
in
lines
:
if
line
.
is_move
:
if
line
.
is_move
:
line
.
relative
=
relative
line
.
set
(
"relative"
,
relative
)
line
.
relative_e
=
relative_e
line
.
set
(
"relative_e"
,
relative_e
)
line
.
current_tool
=
current_tool
line
.
set
(
"current_tool"
,
current_tool
)
elif
line
.
command
==
"G20"
:
elif
line
.
command
==
"G20"
:
imperial
=
True
imperial
=
True
elif
line
.
command
==
"G21"
:
elif
line
.
command
==
"G21"
:
...
@@ -220,10 +230,10 @@ class GCode(object):
...
@@ -220,10 +230,10 @@ class GCode(object):
continue
continue
if
line
.
is_move
:
if
line
.
is_move
:
if
line
.
relative_e
:
if
line
.
relative_e
:
line
.
extruding
=
line
.
e
!=
0
line
.
set
(
"extruding"
,
line
.
e
!=
0
)
total_e
+=
line
.
e
total_e
+=
line
.
e
else
:
else
:
line
.
extruding
=
line
.
e
!=
cur_e
line
.
set
(
"extruding"
,
line
.
e
!=
cur_e
)
total_e
+=
line
.
e
-
cur_e
total_e
+=
line
.
e
-
cur_e
cur_e
=
line
.
e
cur_e
=
line
.
e
max_e
=
max
(
max_e
,
total_e
)
max_e
=
max
(
max_e
,
total_e
)
...
...
printrun/libtatlin/actors.py
View file @
99da253f
...
@@ -267,7 +267,7 @@ class GcodeModel(Model):
...
@@ -267,7 +267,7 @@ class GcodeModel(Model):
color_list
.
append
(
vertex_color
)
color_list
.
append
(
vertex_color
)
prev_pos
=
current_pos
prev_pos
=
current_pos
gline
.
gcview_end_vertex
=
len
(
vertex_list
)
gline
.
set
(
"gcview_end_vertex"
,
len
(
vertex_list
)
)
self
.
layer_stops
.
append
(
len
(
vertex_list
))
self
.
layer_stops
.
append
(
len
(
vertex_list
))
...
...
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