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
7aa44e0a
Commit
7aa44e0a
authored
Jun 19, 2012
by
Lars Kruse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement toolpath grid plugin with another filter
parent
e37feb5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
9 deletions
+26
-9
PointUtils.py
pycam/Geometry/PointUtils.py
+1
-1
ToolpathGrid.py
pycam/Plugins/ToolpathGrid.py
+9
-7
Filters.py
pycam/Toolpath/Filters.py
+16
-1
No files found.
pycam/Geometry/PointUtils.py
View file @
7aa44e0a
...
@@ -53,7 +53,7 @@ def pcmp(a,b):
...
@@ -53,7 +53,7 @@ def pcmp(a,b):
else
:
else
:
return
cmp
(
a
[
2
],
b
[
2
])
return
cmp
(
a
[
2
],
b
[
2
])
def
ptransform_by_matrix
(
a
,
matrix
,
transformed_list
=
None
):
def
ptransform_by_matrix
(
a
,
matrix
):
if
len
(
a
)
>
3
:
if
len
(
a
)
>
3
:
return
(
a
[
0
]
*
matrix
[
0
][
0
]
+
a
[
1
]
*
matrix
[
0
][
1
]
+
a
[
2
]
*
matrix
[
0
][
2
],
return
(
a
[
0
]
*
matrix
[
0
][
0
]
+
a
[
1
]
*
matrix
[
0
][
1
]
+
a
[
2
]
*
matrix
[
0
][
2
],
a
[
0
]
*
matrix
[
1
][
0
]
+
a
[
1
]
*
matrix
[
1
][
1
]
+
a
[
2
]
*
matrix
[
1
][
2
],
a
[
0
]
*
matrix
[
1
][
0
]
+
a
[
1
]
*
matrix
[
1
][
1
]
+
a
[
2
]
*
matrix
[
1
][
2
],
...
...
pycam/Plugins/ToolpathGrid.py
View file @
7aa44e0a
...
@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
...
@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import
pycam.Plugins
import
pycam.Plugins
from
pycam.Geometry.PointUtils
import
*
from
pycam.Geometry.PointUtils
import
*
import
pycam.Toolpath.Filters
class
ToolpathGrid
(
pycam
.
Plugins
.
PluginBase
):
class
ToolpathGrid
(
pycam
.
Plugins
.
PluginBase
):
...
@@ -94,19 +95,20 @@ class ToolpathGrid(pycam.Plugins.PluginBase):
...
@@ -94,19 +95,20 @@ class ToolpathGrid(pycam.Plugins.PluginBase):
y_space
=
self
.
gui
.
get_object
(
"GridYDistance"
)
.
get_value
()
y_space
=
self
.
gui
.
get_object
(
"GridYDistance"
)
.
get_value
()
x_dim
,
y_dim
=
self
.
_get_toolpaths_dim
(
toolpaths
)
x_dim
,
y_dim
=
self
.
_get_toolpaths_dim
(
toolpaths
)
for
toolpath
in
toolpaths
:
for
toolpath
in
toolpaths
:
new_path
s
=
[]
new_path
=
list
(
toolpath
.
path
)
for
x
in
range
(
x_count
):
for
x
in
range
(
x_count
):
for
y
in
range
(
y_count
):
for
y
in
range
(
y_count
):
shift
=
(
x
*
(
x_space
+
x_dim
),
y
*
(
y_space
+
y_dim
),
0
,
'v'
)
shift_x
=
x
*
(
x_space
+
x_dim
)
for
index
in
len
(
toolpath
.
paths
):
shift_y
=
y
*
(
y_space
+
y_dim
)
new_path
=
[
shift
.
add
(
p
)
for
p
in
toolpath
.
paths
[
index
]]
shift_filter
=
pycam
.
Toolpath
.
Filters
.
TransformPosition
((
new_paths
.
append
(
new_path
)
(
1
,
0
,
0
,
shift_x
),
(
0
,
1
,
0
,
shift_y
),
(
0
,
0
,
1
,
0
)))
new_path
.
extend
(
toolpath
.
path
|
shift_filter
)
if
not
self
.
gui
.
get_object
(
"KeepOriginal"
)
.
get_active
():
if
not
self
.
gui
.
get_object
(
"KeepOriginal"
)
.
get_active
():
toolpath
.
path
s
=
new_paths
toolpath
.
path
=
new_path
self
.
core
.
emit_event
(
"toolpath-changed"
)
self
.
core
.
emit_event
(
"toolpath-changed"
)
else
:
else
:
new_toolpath
=
toolpath
.
copy
()
new_toolpath
=
toolpath
.
copy
()
new_toolpath
.
path
s
=
new_paths
new_toolpath
.
path
=
new_path
self
.
core
.
get
(
"toolpaths"
)
.
append
(
new_toolpath
)
self
.
core
.
get
(
"toolpaths"
)
.
append
(
new_toolpath
)
self
.
core
.
get
(
"toolpaths"
)
.
select
(
toolpaths
)
self
.
core
.
get
(
"toolpaths"
)
.
select
(
toolpaths
)
pycam/Toolpath/Filters.py
View file @
7aa44e0a
...
@@ -22,7 +22,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
...
@@ -22,7 +22,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
from
pycam.Toolpath
import
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
,
MOVE_SAFETY
,
MACHINE_SETTING
from
pycam.Toolpath
import
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
,
MOVE_SAFETY
,
MACHINE_SETTING
from
pycam.Geometry.PointUtils
import
psub
,
pdist
from
pycam.Geometry.PointUtils
import
psub
,
pdist
,
ptransform_by_matrix
from
pycam.Geometry.Line
import
Line
from
pycam.Geometry.Line
import
Line
from
pycam.Geometry.utils
import
epsilon
from
pycam.Geometry.utils
import
epsilon
import
pycam.Utils.log
import
pycam.Utils.log
...
@@ -177,3 +177,18 @@ class Crop(BaseFilter):
...
@@ -177,3 +177,18 @@ class Crop(BaseFilter):
new_path
.
append
((
move_type
,
args
))
new_path
.
append
((
move_type
,
args
))
return
new_path
return
new_path
class
TransformPosition
(
BaseFilter
):
PARAMS
=
(
"matrix"
,
)
def
filter_toolpath
(
self
,
toolpath
):
new_path
=
[]
for
move_type
,
args
in
toolpath
:
if
move_type
in
(
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
):
new_pos
=
ptransform_by_matrix
(
args
,
self
.
settings
[
"matrix"
])
new_path
.
append
((
move_type
,
new_pos
))
else
:
new_path
.
append
((
move_type
,
args
))
return
new_path
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