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
9e8a234e
Commit
9e8a234e
authored
Jul 03, 2012
by
Lars Kruse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added chain function for combining filters of a toolpath
parent
fcad5299
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
8 deletions
+50
-8
GCodeExporter.py
pycam/Exporters/GCodeExporter.py
+0
-1
GCodeParameters.py
pycam/Plugins/GCodeParameters.py
+50
-7
No files found.
pycam/Exporters/GCodeExporter.py
View file @
9e8a234e
...
@@ -31,7 +31,6 @@ DEFAULT_HEADER = ("G40 (disable tool radius compensation)",
...
@@ -31,7 +31,6 @@ DEFAULT_HEADER = ("G40 (disable tool radius compensation)",
"G54 (select coordinate system 1)"
,
"G54 (select coordinate system 1)"
,
"G90 (disable incremental moves)"
)
"G90 (disable incremental moves)"
)
PATH_MODES
=
{
"exact_path"
:
0
,
"exact_stop"
:
1
,
"continuous"
:
2
}
MAX_DIGITS
=
12
MAX_DIGITS
=
12
...
...
pycam/Plugins/GCodeParameters.py
View file @
9e8a234e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"""
"""
$Id$
$Id$
Copyright 2011 Lars Kruse <devel@sumpfralle.de>
Copyright 2011
-2012
Lars Kruse <devel@sumpfralle.de>
This file is part of PyCAM.
This file is part of PyCAM.
...
@@ -22,7 +22,9 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
...
@@ -22,7 +22,9 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import
pycam.Plugins
import
pycam.Plugins
import
pycam.Gui.ControlsGTK
import
pycam.Gui.ControlsGTK
import
pycam.Toolpath.Filters
as
Filters
from
pycam.Toolpath
import
CORNER_STYLE_EXACT_PATH
,
CORNER_STYLE_EXACT_STOP
,
\
CORNER_STYLE_OPTIMIZE_SPEED
,
CORNER_STYLE_OPTIMIZE_TOLERANCE
class
GCodeSafetyHeight
(
pycam
.
Plugins
.
PluginBase
):
class
GCodeSafetyHeight
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -39,12 +41,20 @@ class GCodeSafetyHeight(pycam.Plugins.PluginBase):
...
@@ -39,12 +41,20 @@ class GCodeSafetyHeight(pycam.Plugins.PluginBase):
self
.
control
)
self
.
control
)
self
.
core
.
register_ui
(
"gcode_general_parameters"
,
"Safety Height"
,
self
.
core
.
register_ui
(
"gcode_general_parameters"
,
"Safety Height"
,
self
.
control
.
get_widget
(),
weight
=
20
)
self
.
control
.
get_widget
(),
weight
=
20
)
self
.
core
.
register_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
return
True
return
True
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
unregister_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
self
.
core
.
unregister_ui
(
"gcode_general_parameters"
,
self
.
core
.
unregister_ui
(
"gcode_general_parameters"
,
self
.
control
.
get_widget
())
self
.
control
.
get_widget
())
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
"safety_height"
)
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
"safety_height"
)
def
apply_filter
(
self
,
settings_dict
,
filters_list
):
if
"safety_height"
in
settings_dict
:
filters_list
.
append
(
Filters
.
SafetyHeightFilter
(
settings_dict
[
"safety_height"
]))
#TODO: move to settings for ToolpathOutputDialects
#TODO: move to settings for ToolpathOutputDialects
...
@@ -68,6 +78,10 @@ class GCodeFilenameExtension(pycam.Plugins.PluginBase):
...
@@ -68,6 +78,10 @@ class GCodeFilenameExtension(pycam.Plugins.PluginBase):
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
"filename_extension"
)
"filename_extension"
)
def
apply_filter
(
self
,
settings_dict
,
filters_list
):
# TODO: implement this after moving to Dialects
pass
class
GCodeStepWidth
(
pycam
.
Plugins
.
PluginBase
):
class
GCodeStepWidth
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -89,9 +103,11 @@ class GCodeStepWidth(pycam.Plugins.PluginBase):
...
@@ -89,9 +103,11 @@ class GCodeStepWidth(pycam.Plugins.PluginBase):
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
"step_width_
%
s"
%
key
,
control
)
"step_width_
%
s"
%
key
,
control
)
self
.
controls
.
append
((
key
,
control
))
self
.
controls
.
append
((
key
,
control
))
self
.
core
.
register_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
return
True
return
True
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
unregister_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
for
key
,
control
in
self
.
controls
:
for
key
,
control
in
self
.
controls
:
self
.
core
.
unregister_ui
(
"gcode_step_width"
,
control
)
self
.
core
.
unregister_ui
(
"gcode_step_width"
,
control
)
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
self
.
core
.
get
(
"unregister_parameter"
)(
"toolpath_processor"
,
...
@@ -99,6 +115,14 @@ class GCodeStepWidth(pycam.Plugins.PluginBase):
...
@@ -99,6 +115,14 @@ class GCodeStepWidth(pycam.Plugins.PluginBase):
self
.
core
.
unregister_ui
(
"gcode_general_parameters"
,
self
.
core
.
unregister_ui
(
"gcode_general_parameters"
,
self
.
_table
.
get_widget
())
self
.
_table
.
get_widget
())
def
apply_filter
(
self
,
settings_dict
,
filters_list
):
result
=
{}
if
any
([(
"step_width_
%
s"
%
key
)
in
settings_dict
for
key
in
"xyz"
]):
full_key
=
"step_width_
%
s"
%
key
result
[
full_key
]
=
settings_dict
.
get
(
full_key
,
0.0
)
filters_list
.
append
(
Filters
.
StepWidth
(
**
result
))
class
GCodeSpindle
(
pycam
.
Plugins
.
PluginBase
):
class
GCodeSpindle
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -123,10 +147,12 @@ class GCodeSpindle(pycam.Plugins.PluginBase):
...
@@ -123,10 +147,12 @@ class GCodeSpindle(pycam.Plugins.PluginBase):
self
.
spindle_enable
.
get_widget
(),
weight
=
10
)
self
.
spindle_enable
.
get_widget
(),
weight
=
10
)
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
"spindle_enable"
,
self
.
spindle_enable
)
"spindle_enable"
,
self
.
spindle_enable
)
self
.
core
.
register_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
self
.
update_widgets
()
self
.
update_widgets
()
return
True
return
True
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
unregister_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
self
.
core
.
unregister_ui
(
"gcode_spindle"
,
self
.
core
.
unregister_ui
(
"gcode_spindle"
,
self
.
spindle_delay
.
get_widget
())
self
.
spindle_delay
.
get_widget
())
self
.
core
.
unregister_ui
(
"gcode_spindle"
,
self
.
core
.
unregister_ui
(
"gcode_spindle"
,
...
@@ -142,6 +168,12 @@ class GCodeSpindle(pycam.Plugins.PluginBase):
...
@@ -142,6 +168,12 @@ class GCodeSpindle(pycam.Plugins.PluginBase):
widget
=
self
.
spindle_delay
.
get_widget
()
widget
=
self
.
spindle_delay
.
get_widget
()
widget
.
set_sensitive
(
self
.
spindle_enable
.
get_value
())
widget
.
set_sensitive
(
self
.
spindle_enable
.
get_value
())
def
apply_filter
(
self
,
settings_dict
,
filters_list
):
if
not
settings_dict
.
get
(
"spindle_enable"
,
False
):
return
filters_list
.
append
(
Filters
.
TriggerSpindle
(
settings_dict
.
get
(
"spindle_delay"
,
0
)))
class
GCodeCornerStyle
(
pycam
.
Plugins
.
PluginBase
):
class
GCodeCornerStyle
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -165,19 +197,23 @@ class GCodeCornerStyle(pycam.Plugins.PluginBase):
...
@@ -165,19 +197,23 @@ class GCodeCornerStyle(pycam.Plugins.PluginBase):
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
"naive_tolerance"
,
self
.
naive_tolerance
)
"naive_tolerance"
,
self
.
naive_tolerance
)
self
.
path_mode
=
pycam
.
Gui
.
ControlsGTK
.
InputChoice
((
self
.
path_mode
=
pycam
.
Gui
.
ControlsGTK
.
InputChoice
((
(
"Exact path mode (G61)"
,
"exact_path"
),
(
"Exact path mode (G61)"
,
CORNER_STYLE_EXACT_PATH
),
(
"Exact stop mode (G61.1)"
,
"exact_stop"
),
(
"Exact stop mode (G61.1)"
,
CORNER_STYLE_EXACT_STOP
),
(
"Continuous with maximum speed (G64)"
,
"optimize_speed"
),
(
"Continuous with maximum speed (G64)"
,
(
"Continuous with tolerance (G64 P/Q)"
,
"optimize_tolerance"
)))
CORNER_STYLE_OPTIMIZE_SPEED
),
(
"Continuous with tolerance (G64 P/Q)"
,
CORNER_STYLE_OPTIMIZE_TOLERANCE
)))
self
.
path_mode
.
get_widget
()
.
connect
(
"changed"
,
self
.
update_widgets
)
self
.
path_mode
.
get_widget
()
.
connect
(
"changed"
,
self
.
update_widgets
)
self
.
core
.
register_ui
(
"gcode_corner_style"
,
"Path mode"
,
self
.
core
.
register_ui
(
"gcode_corner_style"
,
"Path mode"
,
self
.
path_mode
.
get_widget
(),
weight
=
10
)
self
.
path_mode
.
get_widget
(),
weight
=
10
)
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
"path_mode"
,
self
.
core
.
get
(
"register_parameter"
)(
"toolpath_processor"
,
"path_mode"
,
self
.
path_mode
)
self
.
path_mode
)
self
.
core
.
register_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
self
.
update_widgets
()
self
.
update_widgets
()
return
True
return
True
def
teardown
(
self
):
def
teardown
(
self
):
self
.
core
.
unregister_chain
(
"toolpath_filters"
,
self
.
apply_filter
)
self
.
core
.
unregister_ui
(
"gcode_corner_style"
,
self
.
core
.
unregister_ui
(
"gcode_corner_style"
,
self
.
motion_tolerance
.
get_widget
())
self
.
motion_tolerance
.
get_widget
())
self
.
core
.
unregister_ui
(
"gcode_corner_style"
,
self
.
core
.
unregister_ui
(
"gcode_corner_style"
,
...
@@ -195,3 +231,10 @@ class GCodeCornerStyle(pycam.Plugins.PluginBase):
...
@@ -195,3 +231,10 @@ class GCodeCornerStyle(pycam.Plugins.PluginBase):
for
control
in
controls
:
for
control
in
controls
:
control
.
get_widget
()
.
set_sensitive
(
enable_tolerances
)
control
.
get_widget
()
.
set_sensitive
(
enable_tolerances
)
def
apply_filter
(
self
,
settings_dict
,
filters_list
):
param_dict
=
{}
for
name
in
(
"path_mode"
,
"motion_tolerance"
,
"naive_tolerance"
):
if
name
in
settings_dict
:
param_dict
[
name
]
=
settings_dict
[
name
]
filers_list
.
insert
(
Filters
.
MachineSetting
(
"corner_style"
,
param_dict
))
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