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
741e3c8c
Commit
741e3c8c
authored
Jun 09, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display currently viewed layer in brown in gcview
parent
c7eeabf3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
17 deletions
+44
-17
gcview.py
printrun/gcview.py
+4
-1
actors.py
printrun/libtatlin/actors.py
+40
-16
No files found.
printrun/gcview.py
View file @
741e3c8c
...
@@ -362,7 +362,10 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -362,7 +362,10 @@ class GcodeViewPanel(wxGLPanel):
return
return
max_layers
=
self
.
parent
.
model
.
max_layers
max_layers
=
self
.
parent
.
model
.
max_layers
current_layer
=
self
.
parent
.
model
.
num_layers_to_draw
current_layer
=
self
.
parent
.
model
.
num_layers_to_draw
new_layer
=
min
(
max_layers
,
current_layer
+
1
)
# accept going up to max_layers + 1
# max_layers means visualizing the last layer differently,
# max_layers + 1 means visualizing all layers with the same color
new_layer
=
min
(
max_layers
+
1
,
current_layer
+
1
)
self
.
parent
.
model
.
num_layers_to_draw
=
new_layer
self
.
parent
.
model
.
num_layers_to_draw
=
new_layer
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
...
...
printrun/libtatlin/actors.py
View file @
741e3c8c
...
@@ -241,6 +241,7 @@ class GcodeModel(Model):
...
@@ -241,6 +241,7 @@ class GcodeModel(Model):
color_tool0
=
(
1.0
,
0.0
,
0.0
,
0.6
)
color_tool0
=
(
1.0
,
0.0
,
0.0
,
0.6
)
color_tool1
=
(
0.0
,
0.0
,
1.0
,
0.6
)
color_tool1
=
(
0.0
,
0.0
,
1.0
,
0.6
)
color_printed
=
(
0.2
,
0.75
,
0
,
0.6
)
color_printed
=
(
0.2
,
0.75
,
0
,
0.6
)
color_current
=
(
0.6
,
0.3
,
0
,
1
)
use_vbos
=
True
use_vbos
=
True
loaded
=
False
loaded
=
False
...
@@ -337,33 +338,56 @@ class GcodeModel(Model):
...
@@ -337,33 +338,56 @@ class GcodeModel(Model):
else
:
else
:
glVertexPointer
(
3
,
GL_FLOAT
,
0
,
self
.
vertex_buffer
.
ptr
)
glVertexPointer
(
3
,
GL_FLOAT
,
0
,
self
.
vertex_buffer
.
ptr
)
if
mode_2d
:
self
.
vertex_color_buffer
.
bind
()
glScale
(
1.0
,
1.0
,
0.0
)
# discard z coordinates
if
has_vbo
:
start
=
self
.
layer_stops
[
self
.
num_layers_to_draw
-
1
]
glColorPointer
(
4
,
GL_FLOAT
,
0
,
None
)
end
=
self
.
layer_stops
[
self
.
num_layers_to_draw
]
-
start
else
:
else
:
# 3d
glColorPointer
(
4
,
GL_FLOAT
,
0
,
self
.
vertex_color_buffer
.
ptr
)
start
=
0
start
=
0
end
=
self
.
layer_stops
[
self
.
num_layers_to_draw
]
if
self
.
num_layers_to_draw
<=
self
.
max_layers
:
end_prev_layer
=
self
.
layer_stops
[
self
.
num_layers_to_draw
-
1
]
else
:
end_prev_layer
=
-
1
end
=
self
.
layer_stops
[
min
(
self
.
num_layers_to_draw
,
self
.
max_layers
)]
glDisableClientState
(
GL_COLOR_ARRAY
)
glDisableClientState
(
GL_COLOR_ARRAY
)
glColor4f
(
*
self
.
color_printed
)
glColor4f
(
*
self
.
color_printed
)
printed_end
=
min
(
self
.
printed_until
,
end
)
# Draw printed stuff until end or end_prev_layer
if
start
<
printed_end
:
cur_end
=
min
(
self
.
printed_until
,
end
)
glDrawArrays
(
GL_LINES
,
start
,
printed_end
)
if
end_prev_layer
>=
0
:
cur_end
=
min
(
cur_end
,
end_prev_layer
)
if
cur_end
>=
0
:
glDrawArrays
(
GL_LINES
,
start
,
cur_end
)
glEnableClientState
(
GL_COLOR_ARRAY
)
glEnableClientState
(
GL_COLOR_ARRAY
)
self
.
vertex_color_buffer
.
bind
()
# Draw nonprinted stuff until end_prev_layer
if
has_vbo
:
start
=
max
(
cur_end
,
0
)
glColorPointer
(
4
,
GL_FLOAT
,
0
,
None
)
if
end_prev_layer
>=
start
:
else
:
glDrawArrays
(
GL_LINES
,
start
,
end_prev_layer
-
start
)
glColorPointer
(
4
,
GL_FLOAT
,
0
,
self
.
vertex_color_buffer
.
ptr
)
cur_end
=
end_prev_layer
glDisableClientState
(
GL_COLOR_ARRAY
)
glColor4f
(
*
self
.
color_current
)
# Draw current layer
orig_linewidth
=
(
GLfloat
)()
glGetFloatv
(
GL_LINE_WIDTH
,
orig_linewidth
)
glLineWidth
(
2.0
)
if
end_prev_layer
>=
0
and
end
>
end_prev_layer
:
glDrawArrays
(
GL_LINES
,
end_prev_layer
,
end
-
end_prev_layer
)
glLineWidth
(
orig_linewidth
)
glEnableClientState
(
GL_COLOR_ARRAY
)
# Draw non printed stuff until end (if not ending at a given layer)
start
=
max
(
self
.
printed_until
,
0
)
start
=
max
(
self
.
printed_until
,
0
)
end
=
end
-
start
end
=
end
-
start
if
start
>=
0
and
end
>
0
:
if
end_prev_layer
<
0
and
end
>
0
:
glDrawArrays
(
GL_LINES
,
start
,
end
)
glDrawArrays
(
GL_LINES
,
start
,
end
)
self
.
vertex_buffer
.
unbind
()
self
.
vertex_buffer
.
unbind
()
...
...
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