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
837ad5c6
Commit
837ad5c6
authored
Aug 26, 2011
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #52 from Skateboss/master
Display dimensions of gcode file on load.
parents
af977d46
f23f6209
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
pronsole.py
pronsole.py
+47
-0
pronterface.py
pronterface.py
+6
-1
No files found.
pronsole.py
View file @
837ad5c6
...
@@ -18,6 +18,53 @@ except:
...
@@ -18,6 +18,53 @@ except:
def
dosify
(
name
):
def
dosify
(
name
):
return
os
.
path
.
split
(
name
)[
1
]
.
split
(
"."
)[
0
][:
8
]
+
".g"
return
os
.
path
.
split
(
name
)[
1
]
.
split
(
"."
)[
0
][:
8
]
+
".g"
def
measurements
(
g
):
Xcur
=
0.0
Ycur
=
0.0
Zcur
=
0.0
Xmin
=
1000000
Ymin
=
1000000
Zmin
=
1000000
Xmax
=-
1000000
Ymax
=-
1000000
Zmax
=-
1000000
Xtot
=
0
Ytot
=
0
Ztot
=
0
for
i
in
g
:
if
"X"
in
i
and
(
"G1"
in
i
or
"G0"
in
i
):
try
:
Xcur
=
float
(
i
.
split
(
"X"
)[
1
]
.
split
(
" "
)[
0
])
if
Xcur
<
Xmin
and
Xcur
>
5.0
:
Xmin
=
Xcur
if
Xcur
>
Xmax
:
Xmax
=
Xcur
except
:
pass
if
"Y"
in
i
and
(
"G1"
in
i
or
"G0"
in
i
):
try
:
Ycur
=
float
(
i
.
split
(
"Y"
)[
1
]
.
split
(
" "
)[
0
])
if
Ycur
<
Ymin
and
Ycur
>
5.0
:
Ymin
=
Ycur
if
Ycur
>
Ymax
:
Ymax
=
Ycur
except
:
pass
if
"Z"
in
i
and
(
"G1"
in
i
or
"G0"
in
i
):
try
:
Zcur
=
float
(
i
.
split
(
"Z"
)[
1
]
.
split
(
" "
)[
0
])
if
Zcur
<
Zmin
:
Zmin
=
Zcur
if
Zcur
>
Zmax
:
Zmax
=
Zcur
except
:
pass
Xtot
=
Xmax
-
Xmin
Ytot
=
Ymax
-
Ymin
Ztot
=
Zmax
-
Zmin
return
(
Xtot
,
Ytot
,
Ztot
,
Xmin
,
Xmax
,
Ymin
,
Ymax
,
Zmin
,
Zmax
)
def
totalelength
(
g
):
def
totalelength
(
g
):
tot
=
0
tot
=
0
...
...
pronterface.py
View file @
837ad5c6
...
@@ -1023,7 +1023,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1023,7 +1023,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
def
loadviz
(
self
):
def
loadviz
(
self
):
print
pronsole
.
totalelength
(
self
.
f
),
_
(
"mm of filament used in this print"
)
Xtot
,
Ytot
,
Ztot
,
Xmin
,
Xmax
,
Ymin
,
Ymax
,
Zmin
,
Zmax
=
pronsole
.
measurements
(
self
.
f
)
print
pronsole
.
totalelength
(
self
.
f
),
_
(
"mm of filament used in this print
\n
"
)
Xtot
,
Ytot
,
Ztot
=
pronsole
.
measurements
(
self
.
f
)
print
_
(
"the print goes from"
),
Xmin
,
_
(
"mm to"
),
Xmax
,
_
(
"mm in X
\n
and is"
),
Xtot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Ymin
,
_
(
"mm to"
),
Ymax
,
_
(
"mm in Y
\n
and is"
),
Ytot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Zmin
,
_
(
"mm to"
),
Zmax
,
_
(
"mm in Z
\n
and is"
),
Ztot
,
_
(
"mm high
\n
"
)
self
.
gviz
.
clear
()
self
.
gviz
.
clear
()
self
.
gwindow
.
p
.
clear
()
self
.
gwindow
.
p
.
clear
()
for
i
in
self
.
f
:
for
i
in
self
.
f
:
...
...
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