Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pyMKcam
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
pyMKcam
Commits
8c0e3576
Commit
8c0e3576
authored
Dec 22, 2011
by
Paul Bonser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add profiling script, currently profiles dropcutter
parent
3af54b31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
profile_pycam.py
scripts/profile_pycam.py
+55
-0
No files found.
scripts/profile_pycam.py
0 → 100644
View file @
8c0e3576
import
cProfile
from
os.path
import
join
import
pstats
import
sys
from
time
import
time
from
pycam.Cutters.CylindricalCutter
import
CylindricalCutter
from
pycam.Gui.Console
import
ConsoleProgressBar
from
pycam.Importers.STLImporter
import
ImportModel
from
pycam.PathGenerators.DropCutter
import
DropCutter
from
pycam.PathProcessors.PathAccumulator
import
PathAccumulator
from
pycam.Toolpath
import
Bounds
from
pycam.Toolpath.MotionGrid
import
get_fixed_grid
from
pycam.Utils.locations
import
get_data_file_location
""" Profile PyCAM doing several operations, print out the top 10
(sorted by actual local runtime) methods.
"""
model
=
ImportModel
(
get_data_file_location
(
join
(
'samples'
,
'pycam-textbox.stl'
)))
print
model
.
minx
,
model
.
miny
,
model
.
maxx
,
model
.
maxy
def
run_dropcutter
():
""" Run DropCutter on standard PyCAM sample plaque """
progress_bar
=
ConsoleProgressBar
(
sys
.
stdout
)
overlap
=
.6
layer_distance
=
1
tool
=
CylindricalCutter
(
10
)
path_generator
=
DropCutter
(
PathAccumulator
())
bounds
=
Bounds
(
Bounds
.
TYPE_CUSTOM
,
(
model
.
minx
-
5
,
model
.
miny
-
5
,
model
.
minz
),
(
model
.
maxx
+
5
,
model
.
maxy
+
5
,
model
.
maxz
))
low
,
high
=
bounds
.
get_absolute_limits
()
line_distance
=
2
*
tool
.
radius
*
(
1.0
-
overlap
)
motion_grid
=
get_fixed_grid
((
low
,
high
),
layer_distance
,
line_distance
,
tool
.
radius
/
4.0
)
moves
=
path_generator
.
GenerateToolPath
(
tool
,
[
model
],
motion_grid
,
minz
=
low
[
2
],
maxz
=
high
[
2
],
draw_callback
=
progress_bar
.
update
)
if
__name__
==
'__main__'
:
start_time
=
time
()
cProfile
.
run
(
'run_dropcutter()'
,
'dropcutter.pyprof'
)
run_time
=
time
()
-
start_time
print
'
\n
Dropcutter took
%
f seconds'
%
run_time
p
=
pstats
.
Stats
(
'dropcutter.pyprof'
)
print
'Top ten time-consuming functions:'
p
.
sort_stats
(
'time'
)
.
print_stats
(
10
)
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