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
559d0962
Commit
559d0962
authored
Jul 02, 2012
by
Lars Kruse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched task processing to new filter style
parent
3a79c2b2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
41 deletions
+28
-41
Bounds.py
pycam/Plugins/Bounds.py
+2
-3
ProcessStrategies.py
pycam/Plugins/ProcessStrategies.py
+22
-35
TaskTypes.py
pycam/Plugins/TaskTypes.py
+4
-3
No files found.
pycam/Plugins/Bounds.py
View file @
559d0962
...
@@ -398,7 +398,7 @@ class BoundsDict(pycam.Plugins.ObjectWithAttributes):
...
@@ -398,7 +398,7 @@ class BoundsDict(pycam.Plugins.ObjectWithAttributes):
"Models"
:
[],
"Models"
:
[],
})
})
def
get_absolute_limits
(
self
,
tool
=
None
,
models
=
None
):
def
get_absolute_limits
(
self
,
tool
_radius
=
None
,
models
=
None
):
default
=
(
None
,
None
,
None
),
(
None
,
None
,
None
)
default
=
(
None
,
None
,
None
),
(
None
,
None
,
None
)
get_low_value
=
lambda
axis
:
\
get_low_value
=
lambda
axis
:
\
self
[
"parameters"
][
"BoundaryLow
%
s"
%
"XYZ"
[
axis
]]
self
[
"parameters"
][
"BoundaryLow
%
s"
%
"XYZ"
[
axis
]]
...
@@ -438,8 +438,7 @@ class BoundsDict(pycam.Plugins.ObjectWithAttributes):
...
@@ -438,8 +438,7 @@ class BoundsDict(pycam.Plugins.ObjectWithAttributes):
high
.
append
(
get_high_value
(
axis
))
high
.
append
(
get_high_value
(
axis
))
tool_limit
=
_BOUNDARY_MODES
[
self
[
"parameters"
][
"ToolLimit"
]]
tool_limit
=
_BOUNDARY_MODES
[
self
[
"parameters"
][
"ToolLimit"
]]
# apply inside/along/outside if a tool is given
# apply inside/along/outside if a tool is given
if
tool
and
(
tool_limit
!=
"along"
):
if
tool_radius
and
(
tool_limit
!=
"along"
):
tool_radius
=
tool
[
"parameters"
][
"radius"
]
if
tool_limit
==
"inside"
:
if
tool_limit
==
"inside"
:
offset
=
-
tool_radius
offset
=
-
tool_radius
else
:
else
:
...
...
pycam/Plugins/ProcessStrategies.py
View file @
559d0962
...
@@ -27,6 +27,9 @@ import pycam.Toolpath.MotionGrid
...
@@ -27,6 +27,9 @@ import pycam.Toolpath.MotionGrid
from
pycam.Toolpath.MotionGrid
import
START_X
,
START_Y
,
START_Z
from
pycam.Toolpath.MotionGrid
import
START_X
,
START_Y
,
START_Z
_get_line_distance
=
lambda
radius
,
overlap
:
2
*
radius
*
(
1.0
-
overlap
)
class
ProcessStrategySlicing
(
pycam
.
Plugins
.
PluginBase
):
class
ProcessStrategySlicing
(
pycam
.
Plugins
.
PluginBase
):
DEPENDS
=
[
"ParameterGroupManager"
,
"PathParamOverlap"
,
DEPENDS
=
[
"ParameterGroupManager"
,
"PathParamOverlap"
,
...
@@ -48,13 +51,9 @@ class ProcessStrategySlicing(pycam.Plugins.PluginBase):
...
@@ -48,13 +51,9 @@ class ProcessStrategySlicing(pycam.Plugins.PluginBase):
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"slicing"
)
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"slicing"
)
def
run_process
(
self
,
process
,
environment
=
None
):
def
run_process
(
self
,
process
,
tool_radius
,
(
low
,
high
)):
tool
=
environment
[
"tool"
]
line_distance
=
_get_line_distance
(
tool_radius
,
tool_params
=
tool
[
"parameters"
]
process
[
"parameters"
][
"overlap"
])
low
,
high
=
environment
[
"bounds"
]
.
get_absolute_limits
(
tool
=
tool
,
models
=
environment
[
"collision_models"
])
line_distance
=
2
*
tool_params
[
"radius"
]
*
\
(
1.0
-
process
[
"parameters"
][
"overlap"
])
path_generator
=
pycam
.
PathGenerators
.
PushCutter
.
PushCutter
(
waterlines
=
False
)
path_generator
=
pycam
.
PathGenerators
.
PushCutter
.
PushCutter
(
waterlines
=
False
)
path_pattern
=
process
[
"parameters"
][
"path_pattern"
]
path_pattern
=
process
[
"parameters"
][
"path_pattern"
]
path_get_func
=
self
.
core
.
get
(
"get_parameter_sets"
)(
path_get_func
=
self
.
core
.
get
(
"get_parameter_sets"
)(
...
@@ -63,7 +62,7 @@ class ProcessStrategySlicing(pycam.Plugins.PluginBase):
...
@@ -63,7 +62,7 @@ class ProcessStrategySlicing(pycam.Plugins.PluginBase):
motion_grid
=
grid_func
((
low
,
high
),
motion_grid
=
grid_func
((
low
,
high
),
process
[
"parameters"
][
"step_down"
],
process
[
"parameters"
][
"step_down"
],
line_distance
=
line_distance
,
**
kwargs
)
line_distance
=
line_distance
,
**
kwargs
)
return
path_generator
,
motion_grid
,
(
low
,
high
)
return
path_generator
,
motion_grid
class
ProcessStrategyContour
(
pycam
.
Plugins
.
PluginBase
):
class
ProcessStrategyContour
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -86,13 +85,9 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
...
@@ -86,13 +85,9 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"contour"
)
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"contour"
)
def
run_process
(
self
,
process
,
environment
=
None
):
def
run_process
(
self
,
process
,
tool_radius
,
(
low
,
high
)):
tool
=
environment
[
"tool"
]
line_distance
=
_get_line_distance
(
tool_radius
,
tool_params
=
tool
[
"parameters"
]
process
[
"parameters"
][
"overlap"
])
low
,
high
=
environment
[
"bounds"
]
.
get_absolute_limits
(
tool
=
tool
,
models
=
environment
[
"collision_models"
])
line_distance
=
2
*
tool_params
[
"radius"
]
*
\
(
1.0
-
process
[
"parameters"
][
"overlap"
])
path_generator
=
pycam
.
PathGenerators
.
PushCutter
.
PushCutter
(
waterlines
=
True
)
path_generator
=
pycam
.
PathGenerators
.
PushCutter
.
PushCutter
(
waterlines
=
True
)
# TODO: milling_style currently refers to the grid lines - not to the waterlines
# TODO: milling_style currently refers to the grid lines - not to the waterlines
motion_grid
=
pycam
.
Toolpath
.
MotionGrid
.
get_fixed_grid
(
motion_grid
=
pycam
.
Toolpath
.
MotionGrid
.
get_fixed_grid
(
...
@@ -100,7 +95,7 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
...
@@ -100,7 +95,7 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
line_distance
=
line_distance
,
line_distance
=
line_distance
,
grid_direction
=
pycam
.
Toolpath
.
MotionGrid
.
GRID_DIRECTION_X
,
grid_direction
=
pycam
.
Toolpath
.
MotionGrid
.
GRID_DIRECTION_X
,
milling_style
=
process
[
"parameters"
][
"milling_style"
])
milling_style
=
process
[
"parameters"
][
"milling_style"
])
return
path_generator
,
motion_grid
,
(
low
,
high
)
return
path_generator
,
motion_grid
class
ProcessStrategySurfacing
(
pycam
.
Plugins
.
PluginBase
):
class
ProcessStrategySurfacing
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -122,22 +117,18 @@ class ProcessStrategySurfacing(pycam.Plugins.PluginBase):
...
@@ -122,22 +117,18 @@ class ProcessStrategySurfacing(pycam.Plugins.PluginBase):
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"surfacing"
)
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"surfacing"
)
def
run_process
(
self
,
process
,
environment
=
None
):
def
run_process
(
self
,
process
,
tool_radius
,
(
low
,
high
)):
tool
=
environment
[
"tool"
]
line_distance
=
_get_line_distance
(
tool_radius
,
tool_params
=
tool
[
"parameters"
]
process
[
"parameters"
][
"overlap"
])
low
,
high
=
environment
[
"bounds"
]
.
get_absolute_limits
(
tool
=
tool
,
models
=
environment
[
"collision_models"
])
line_distance
=
2
*
tool_params
[
"radius"
]
*
\
(
1.0
-
process
[
"parameters"
][
"overlap"
])
path_generator
=
pycam
.
PathGenerators
.
DropCutter
.
DropCutter
()
path_generator
=
pycam
.
PathGenerators
.
DropCutter
.
DropCutter
()
path_pattern
=
process
[
"parameters"
][
"path_pattern"
]
path_pattern
=
process
[
"parameters"
][
"path_pattern"
]
path_get_func
=
self
.
core
.
get
(
"get_parameter_sets"
)(
path_get_func
=
self
.
core
.
get
(
"get_parameter_sets"
)(
"path_pattern"
)[
path_pattern
[
"name"
]][
"func"
]
"path_pattern"
)[
path_pattern
[
"name"
]][
"func"
]
grid_func
,
kwargs
=
path_get_func
(
path_pattern
)
grid_func
,
kwargs
=
path_get_func
(
path_pattern
)
motion_grid
=
grid_func
((
low
,
high
),
None
,
motion_grid
=
grid_func
((
low
,
high
),
None
,
step_width
=
(
tool_
params
[
"radius"
]
/
4.0
),
step_width
=
(
tool_
radius
/
4.0
),
line_distance
=
line_distance
,
**
kwargs
)
line_distance
=
line_distance
,
**
kwargs
)
return
path_generator
,
motion_grid
,
(
low
,
high
)
return
path_generator
,
motion_grid
class
ProcessStrategyEngraving
(
pycam
.
Plugins
.
PluginBase
):
class
ProcessStrategyEngraving
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -162,11 +153,7 @@ class ProcessStrategyEngraving(pycam.Plugins.PluginBase):
...
@@ -162,11 +153,7 @@ class ProcessStrategyEngraving(pycam.Plugins.PluginBase):
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"engraving"
)
self
.
core
.
get
(
"unregister_parameter_set"
)(
"process"
,
"engraving"
)
def
run_process
(
self
,
process
,
environment
=
None
):
def
run_process
(
self
,
process
,
tool_radius
,
(
low
,
high
)):
tool
=
environment
[
"tool"
]
tool_params
=
tool
[
"parameters"
]
low
,
high
=
environment
[
"bounds"
]
.
get_absolute_limits
(
tool
=
tool
,
models
=
environment
[
"collision_models"
])
path_generator
=
pycam
.
PathGenerators
.
EngraveCutter
.
EngraveCutter
()
path_generator
=
pycam
.
PathGenerators
.
EngraveCutter
.
EngraveCutter
()
models
=
[
m
.
model
for
m
in
process
[
"parameters"
][
"trace_models"
]]
models
=
[
m
.
model
for
m
in
process
[
"parameters"
][
"trace_models"
]]
if
not
models
:
if
not
models
:
...
@@ -179,18 +166,18 @@ class ProcessStrategyEngraving(pycam.Plugins.PluginBase):
...
@@ -179,18 +166,18 @@ class ProcessStrategyEngraving(pycam.Plugins.PluginBase):
progress
.
set_multiple
(
len
(
models
),
"Model"
)
progress
.
set_multiple
(
len
(
models
),
"Model"
)
compensated_models
=
[]
compensated_models
=
[]
for
index
in
range
(
len
(
models
)):
for
index
in
range
(
len
(
models
)):
models
[
index
]
=
models
[
index
]
.
get_offset_model
(
models
[
index
]
=
models
[
index
]
.
get_offset_model
(
tool_radius
,
tool_params
[
"radius"
],
callback
=
progress
.
update
)
callback
=
progress
.
update
)
progress
.
update_multiple
()
progress
.
update_multiple
()
progress
.
finish
()
progress
.
finish
()
progress
.
update
(
text
=
"Calculating moves"
)
progress
.
update
(
text
=
"Calculating moves"
)
motion_grid
=
pycam
.
Toolpath
.
MotionGrid
.
get_lines_grid
(
models
,
motion_grid
=
pycam
.
Toolpath
.
MotionGrid
.
get_lines_grid
(
models
,
(
low
,
high
),
process
[
"parameters"
][
"step_down"
],
(
low
,
high
),
process
[
"parameters"
][
"step_down"
],
line_distance
=
1.8
*
tool_
params
[
"radius"
]
,
line_distance
=
1.8
*
tool_
radius
,
step_width
=
(
tool_
params
[
"radius"
]
/
4.0
),
step_width
=
(
tool_
radius
/
4.0
),
milling_style
=
process
[
"parameters"
][
"milling_style"
],
milling_style
=
process
[
"parameters"
][
"milling_style"
],
pocketing_type
=
process
[
"parameters"
][
"pocketing_type"
],
pocketing_type
=
process
[
"parameters"
][
"pocketing_type"
],
callback
=
progress
.
update
)
callback
=
progress
.
update
)
progress
.
finish
()
progress
.
finish
()
return
path_generator
,
motion_grid
,
(
low
,
high
)
return
path_generator
,
motion_grid
pycam/Plugins/TaskTypes.py
View file @
559d0962
...
@@ -62,9 +62,10 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
...
@@ -62,9 +62,10 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
funcs
[
key
]
=
self
.
core
.
get
(
"get_parameter_sets"
)(
key
)
\
funcs
[
key
]
=
self
.
core
.
get
(
"get_parameter_sets"
)(
key
)
\
[
environment
[
key
][
set_name
]][
"func"
]
[
environment
[
key
][
set_name
]][
"func"
]
tool
,
tool_filters
=
funcs
[
"tool"
](
environment
[
"tool"
][
"parameters"
])
tool
,
tool_filters
=
funcs
[
"tool"
](
environment
[
"tool"
][
"parameters"
])
self
.
log
.
info
(
"Filters:
%
s"
%
str
(
tool_filters
))
low
,
high
=
environment
[
"bounds"
]
.
get_absolute_limits
(
path_generator
,
motion_grid
,
(
low
,
high
)
=
funcs
[
"process"
](
tool_radius
=
tool
.
radius
,
models
=
environment
[
"collision_models"
])
environment
[
"process"
],
environment
=
environment
)
path_generator
,
motion_grid
=
funcs
[
"process"
](
environment
[
"process"
],
tool
.
radius
,
(
low
,
high
))
if
path_generator
is
None
:
if
path_generator
is
None
:
# we assume that an error message was given already
# we assume that an error message was given already
return
return
...
...
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