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
6388e318
Commit
6388e318
authored
Jan 25, 2012
by
Václav 'Ax' Hůla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vary blue to see to line thickness
parent
38fdf15f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
gcview.py
gcview.py
+34
-12
No files found.
gcview.py
View file @
6388e318
...
@@ -199,10 +199,11 @@ class gcpoint(object):
...
@@ -199,10 +199,11 @@ class gcpoint(object):
"""gcode point
"""gcode point
stub for first line"""
stub for first line"""
def
__init__
(
self
,
x
=
0
,
y
=
0
,
z
=
0
,
e
=
0
):
def
__init__
(
self
,
x
=
0
,
y
=
0
,
z
=
0
,
e
=
0
):
self
.
x
=
x
self
.
x
=
x
self
.
y
=
y
self
.
y
=
y
self
.
z
=
z
self
.
z
=
z
self
.
e
=
e
self
.
e
=
e
self
.
length
=
0
class
gcline
(
object
):
class
gcline
(
object
):
...
@@ -282,11 +283,23 @@ class gcline(object):
...
@@ -282,11 +283,23 @@ class gcline(object):
self
.
y
,
self
.
y
,
self
.
z
,
self
.
z
,
]
]
def
glcolor
(
self
):
def
glcolor
(
self
,
upper_limit
=
None
,
lower_limit
=
0
):
if
self
.
extrusion_ratio
==
0
:
if
self
.
extrusion_ratio
==
0
:
return
[
255
,
255
,
255
,
0
,
0
,
0
]
return
[
255
,
255
,
255
,
0
,
0
,
0
]
else
:
else
:
return
[
255
,
128
,
128
,
128
,
0
,
0
]
if
upper_limit
is
not
None
:
if
self
.
extrusion_ratio
<=
lower_limit
:
color
=
0
else
:
color
=
int
((
self
.
extrusion_ratio
-
lower_limit
)
/
(
upper_limit
-
lower_limit
)
*
255
)
else
:
color
=
0
if
color
>
255
:
color
=
255
if
color
<
0
:
color
=
0
return
[
255
,
128
,
color
,
128
,
0
,
color
]
def
float_from_line
(
axe
,
line
):
def
float_from_line
(
axe
,
line
):
...
@@ -304,17 +317,26 @@ class gcview(object):
...
@@ -304,17 +317,26 @@ class gcview(object):
self
.
layers
=
{}
self
.
layers
=
{}
t0
=
time
.
time
()
t0
=
time
.
time
()
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
#
lines = [i for i in lines if i is not None]
lines
=
[
i
for
i
in
lines
if
i
is
not
None
]
t1
=
time
.
time
()
t1
=
time
.
time
()
print
"transformed
%
s lines in
%
fs"
%
(
len
(
lines
),
t1
-
t0
)
print
"transformed
%
s lines in
%
fs"
%
(
len
(
lines
),
t1
-
t0
)
upper_limit
=
0
lower_limit
=
None
for
line
in
lines
:
if
line
.
extrusion_ratio
and
line
.
length
>
0.003
:
#lines shorter than 0.003 can have large extrusion ratio
if
line
.
extrusion_ratio
>
upper_limit
:
upper_limit
=
line
.
extrusion_ratio
if
lower_limit
is
None
or
line
.
extrusion_ratio
<
lower_limit
:
lower_limit
=
line
.
extrusion_ratio
#print upper_limit, lower_limit
layertemp
=
{}
layertemp
=
{}
counter
=
0
counter
=
0
for
line
in
lines
:
for
line
in
lines
:
if
line
is
not
None
:
layer_name
=
line
.
z
layer_name
=
line
.
z
if
line
.
z
not
in
self
.
layers
:
if
line
.
z
not
in
self
.
layers
:
self
.
layers
[
line
.
z
]
=
pyglet
.
graphics
.
Batch
()
self
.
layers
[
line
.
z
]
=
pyglet
.
graphics
.
Batch
()
self
.
layers
[
line
.
z
]
.
add
(
2
,
GL_LINES
,
None
,
(
"v3f"
,
line
.
glline
()),
(
"c3B"
,
line
.
glcolor
(
)))
self
.
layers
[
line
.
z
]
.
add
(
2
,
GL_LINES
,
None
,
(
"v3f"
,
line
.
glline
()),
(
"c3B"
,
line
.
glcolor
(
upper_limit
,
lower_limit
)))
self
.
layerlist
=
self
.
layers
.
keys
()
self
.
layerlist
=
self
.
layers
.
keys
()
self
.
layerlist
.
sort
()
self
.
layerlist
.
sort
()
t2
=
time
.
time
()
t2
=
time
.
time
()
...
...
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