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
3316dac6
Commit
3316dac6
authored
Nov 28, 2011
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into experimental
Conflicts: stlview.py
parents
244350fe
02f14d50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
40 deletions
+78
-40
pronsole.py
pronsole.py
+2
-1
pronterface.py
pronterface.py
+8
-0
stlview.py
stlview.py
+68
-39
No files found.
pronsole.py
View file @
3316dac6
...
@@ -94,7 +94,8 @@ def estimate_duration(g):
...
@@ -94,7 +94,8 @@ def estimate_duration(g):
feedrate
=
0
feedrate
=
0
X_last_position
=
0
X_last_position
=
0
Y_last_position
=
0
Y_last_position
=
0
for
i
.
split
(
";"
)[
0
]
in
g
:
for
i
in
g
:
i
=
i
.
split
(
";"
)[
0
]
if
"G1"
in
i
and
(
"X"
in
i
or
"Y"
in
i
or
"F"
in
i
or
"E"
in
i
):
if
"G1"
in
i
and
(
"X"
in
i
or
"Y"
in
i
or
"F"
in
i
or
"E"
in
i
):
parts
=
i
.
split
(
" "
)
parts
=
i
.
split
(
" "
)
X
=
get_coordinate_value
(
"X"
,
parts
[
1
:])
X
=
get_coordinate_value
(
"X"
,
parts
[
1
:])
...
...
pronterface.py
View file @
3316dac6
...
@@ -1115,7 +1115,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1115,7 +1115,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
self
.
sdprinting
:
if
self
.
sdprinting
:
string
+=
_
(
" SD printing:
%04.2
f
%%
"
)
%
(
self
.
percentdone
,)
string
+=
_
(
" SD printing:
%04.2
f
%%
"
)
%
(
self
.
percentdone
,)
if
self
.
p
.
printing
:
if
self
.
p
.
printing
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
)
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsremain
=
secondsestimate
-
secondselapsed
string
+=
_
(
" Printing:
%04.2
f
%%
"
)
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
string
+=
_
(
" Printing:
%04.2
f
%%
"
)
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
string
+=
_
(
" Estimated:
%02.0
f"
)
%
(
int
(
secondsremain
/
60
),)
string
+=
_
(
":
%02.0
f"
)
%
(
int
(
secondsremain
%
60
),)
string
+=
_
(
" of
%02.0
f"
)
%
(
int
(
secondsestimate
/
60
),)
string
+=
_
(
":
%02.0
f Remaining"
)
%
(
int
(
secondsestimate
%
60
),)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
if
(
self
.
monitor
and
self
.
p
.
online
):
if
(
self
.
monitor
and
self
.
p
.
online
):
...
...
stlview.py
View file @
3316dac6
...
@@ -240,45 +240,10 @@ class gcview(object):
...
@@ -240,45 +240,10 @@ class gcview(object):
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'n3f/static'
,
layertemp
[
lasth
][
1
]))
(
'n3f/static'
,
layertemp
[
lasth
][
1
]))
lasth
=
i
[
0
][
2
]
lasth
=
i
[
0
][
2
]
S
=
i
[
0
][:
3
]
E
=
i
[
1
][:
3
]
v
=
map
(
lambda
x
,
y
:
x
-
y
,
E
,
S
)
vlen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
vlen
==
0
:
vlen
=
0.01
sq2
=
math
.
sqrt
(
2.0
)
/
2.0
htw
=
float
(
h
)
/
w
d
=
w
/
2.0
if
i
[
1
][
3
]
==
i
[
0
][
3
]:
d
=
0.05
points
=
[[
d
,
0
,
0
],
[
sq2
*
d
,
sq2
*
d
,
0
],
[
0
,
d
,
0
],
[
-
sq2
*
d
,
sq2
*
d
,
0
],
[
-
d
,
0
,
0
],
[
-
sq2
*
d
,
-
sq2
*
d
,
0
],
[
0
,
-
d
,
0
],
[
sq2
*
d
,
-
sq2
*
d
,
0
]
]
axis
=
stltool
.
cross
([
0
,
0
,
1
],
v
)
alen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
alen
>
0
:
axis
=
map
(
lambda
m
:
m
/
alen
,
axis
)
angle
=
math
.
acos
(
v
[
2
]
/
vlen
)
def
vrot
(
v
,
axis
,
angle
):
kxv
=
stltool
.
cross
(
axis
,
v
)
kdv
=
sum
(
map
(
lambda
x
,
y
:
x
*
y
,
axis
,
v
))
return
map
(
lambda
x
,
y
,
z
:
x
*
math
.
cos
(
angle
)
+
y
*
math
.
sin
(
angle
)
+
z
*
kdv
*
(
1.0
-
math
.
cos
(
angle
)),
v
,
kxv
,
axis
)
points
=
map
(
lambda
x
:
vrot
(
x
,
axis
,
angle
),
points
)
points
=
map
(
lambda
x
:[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
def
vadd
(
v
,
o
):
return
map
(
lambda
x
,
y
:
x
+
y
,
v
,
o
)
def
vdiff
(
v
,
o
):
def
vdiff
(
v
,
o
):
return
map
(
lambda
x
,
y
:
x
-
y
,
v
,
o
)
return
map
(
lambda
x
,
y
:
x
-
y
,
v
,
o
)
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
spoints
,
epoints
,
S
,
E
=
self
.
genline
(
i
,
h
,
w
)
for
j
in
xrange
(
8
):
for
j
in
xrange
(
8
):
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
spoints
[(
j
+
1
)
%
8
])
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
spoints
[(
j
+
1
)
%
8
])
...
@@ -326,6 +291,46 @@ class gcview(object):
...
@@ -326,6 +291,46 @@ class gcview(object):
(
'n3f/static'
,
layertemp
[
lasth
][
1
]))
(
'n3f/static'
,
layertemp
[
lasth
][
1
]))
def
genline
(
self
,
i
,
h
,
w
):
S
=
i
[
0
][:
3
]
E
=
i
[
1
][:
3
]
v
=
map
(
lambda
x
,
y
:
x
-
y
,
E
,
S
)
vlen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
vlen
==
0
:
vlen
=
0.01
sq2
=
math
.
sqrt
(
2.0
)
/
2.0
htw
=
float
(
h
)
/
w
d
=
w
/
2.0
if
i
[
1
][
3
]
==
i
[
0
][
3
]:
d
=
0.05
points
=
[[
d
,
0
,
0
],
[
sq2
*
d
,
sq2
*
d
,
0
],
[
0
,
d
,
0
],
[
-
sq2
*
d
,
sq2
*
d
,
0
],
[
-
d
,
0
,
0
],
[
-
sq2
*
d
,
-
sq2
*
d
,
0
],
[
0
,
-
d
,
0
],
[
sq2
*
d
,
-
sq2
*
d
,
0
]
]
axis
=
stltool
.
cross
([
0
,
0
,
1
],
v
)
alen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
alen
>
0
:
axis
=
map
(
lambda
m
:
m
/
alen
,
axis
)
angle
=
math
.
acos
(
v
[
2
]
/
vlen
)
def
vrot
(
v
,
axis
,
angle
):
kxv
=
stltool
.
cross
(
axis
,
v
)
kdv
=
sum
(
map
(
lambda
x
,
y
:
x
*
y
,
axis
,
v
))
return
map
(
lambda
x
,
y
,
z
:
x
*
math
.
cos
(
angle
)
+
y
*
math
.
sin
(
angle
)
+
z
*
kdv
*
(
1.0
-
math
.
cos
(
angle
)),
v
,
kxv
,
axis
)
points
=
map
(
lambda
x
:
vrot
(
x
,
axis
,
angle
),
points
)
points
=
map
(
lambda
x
:[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
def
vadd
(
v
,
o
):
return
map
(
lambda
x
,
y
:
x
+
y
,
v
,
o
)
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
return
spoints
,
epoints
,
S
,
E
def
transform
(
self
,
line
):
def
transform
(
self
,
line
):
line
=
line
.
split
(
";"
)[
0
]
line
=
line
.
split
(
";"
)[
0
]
cur
=
self
.
prev
[:]
cur
=
self
.
prev
[:]
...
@@ -697,8 +702,19 @@ class TestGlPanel(GLPanel):
...
@@ -697,8 +702,19 @@ class TestGlPanel(GLPanel):
glTranslatef
(
*
(
i
.
offsets
))
glTranslatef
(
*
(
i
.
offsets
))
glRotatef
(
i
.
rot
,
0.0
,
0.0
,
1.0
)
glRotatef
(
i
.
rot
,
0.0
,
0.0
,
1.0
)
glScalef
(
*
i
.
scale
)
glScalef
(
*
i
.
scale
)
i
.
batch
.
draw
()
glPopMatrix
()
try
:
if
i
.
curlayer
in
i
.
gc
.
layers
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.23
,
0.57
,
0.35
,
1
))
[
i
.
gc
.
layers
[
j
]
.
draw
()
for
j
in
i
.
gc
.
layers
.
keys
()
if
j
<
i
.
curlayer
]
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.5
,
0.9
,
0.7
,
1
))
b
=
i
.
gc
.
layers
[
i
.
curlayer
]
b
.
draw
()
else
:
i
.
batch
.
draw
()
except
:
i
.
batch
.
draw
()
glPopMatrix
()
glPopMatrix
()
glPopMatrix
()
#print "drawn batch"
#print "drawn batch"
class
TestFrame
(
wx
.
Frame
):
class
TestFrame
(
wx
.
Frame
):
...
@@ -713,6 +729,19 @@ class TestFrame(wx.Frame):
...
@@ -713,6 +729,19 @@ class TestFrame(wx.Frame):
self
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
mainsizer
.
Add
(
self
.
panel
)
self
.
mainsizer
.
Add
(
self
.
panel
)
#self.mainsizer.AddSpacer(10)
#self.mainsizer.AddSpacer(10)
class
d
:
def
GetSelection
(
self
):
return
-
1
m
=
d
()
m
.
offsets
=
[
0
,
0
,
0
]
m
.
rot
=
0
m
.
curlayer
=
1.0
m
.
scale
=
[
1.
,
1.
,
1.
]
m
.
batch
=
pyglet
.
graphics
.
Batch
()
m
.
gc
=
gcview
([],
batch
=
m
.
batch
)
self
.
models
=
{
""
:
m
}
self
.
l
=
d
()
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
self
.
mainsizer
.
Add
(
self
.
GLPanel1
,
1
,
wx
.
EXPAND
)
self
.
mainsizer
.
Add
(
self
.
GLPanel1
,
1
,
wx
.
EXPAND
)
#self.GLPanel2 = TestGlPanel(self, wx.ID_ANY, (20, 20))
#self.GLPanel2 = TestGlPanel(self, wx.ID_ANY, (20, 20))
...
...
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