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
685ec9f9
Commit
685ec9f9
authored
Apr 29, 2012
by
Lars Kruse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed remaining issues of merging "fast points" and "toolpath filters"
parent
71cff6dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
PointUtils.py
pycam/Geometry/PointUtils.py
+5
-0
Filters.py
pycam/Toolpath/Filters.py
+8
-6
__init__.py
pycam/Toolpath/__init__.py
+1
-1
No files found.
pycam/Geometry/PointUtils.py
View file @
685ec9f9
...
@@ -32,6 +32,11 @@ def pnorm(a):
...
@@ -32,6 +32,11 @@ def pnorm(a):
def
pnormsq
(
a
):
def
pnormsq
(
a
):
return
pdot
(
a
,
a
)
return
pdot
(
a
,
a
)
def
pdist
(
a
,
b
,
axes
=
None
):
if
axes
is
None
:
axes
=
(
0
,
1
,
2
)
return
sqrt
(
sum
([(
a
[
index
]
-
b
[
index
])
**
2
for
index
in
axes
]))
def
pcmp
(
a
,
b
):
def
pcmp
(
a
,
b
):
""" Two points are equal if all dimensions are identical.
""" Two points are equal if all dimensions are identical.
Otherwise the result is based on the individual x/y/z comparisons.
Otherwise the result is based on the individual x/y/z comparisons.
...
...
pycam/Toolpath/Filters.py
View file @
685ec9f9
...
@@ -22,7 +22,8 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
...
@@ -22,7 +22,8 @@ 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.Point
import
Point
from
pycam.Geometry.PointUtils
import
psub
,
pdist
from
pycam.Geometry.utils
import
epsilon
class
BaseFilter
(
object
):
class
BaseFilter
(
object
):
...
@@ -48,14 +49,14 @@ class SafetyHeightFilter(BaseFilter):
...
@@ -48,14 +49,14 @@ class SafetyHeightFilter(BaseFilter):
if
not
last_pos
:
if
not
last_pos
:
# there was a safety move (or no move at all) before
# there was a safety move (or no move at all) before
# -> move sideways
# -> move sideways
safe_pos
=
Point
(
args
.
x
,
args
.
y
,
self
.
safety_height
)
safe_pos
=
(
args
[
0
],
args
[
1
]
,
self
.
safety_height
)
new_path
.
append
((
MOVE_STRAIGHT_RAPID
,
safe_pos
))
new_path
.
append
((
MOVE_STRAIGHT_RAPID
,
safe_pos
))
last_pos
=
args
last_pos
=
args
new_path
.
append
((
move_type
,
args
))
new_path
.
append
((
move_type
,
args
))
elif
move_type
==
MOVE_SAFETY
:
elif
move_type
==
MOVE_SAFETY
:
if
last_pos
:
if
last_pos
:
# safety move -> move straight up to safety height
# safety move -> move straight up to safety height
next_pos
=
Point
(
last_pos
.
x
,
last_pos
.
y
,
self
.
safety_height
)
next_pos
=
(
last_pos
[
0
],
last_pos
[
1
]
,
self
.
safety_height
)
new_path
.
append
((
MOVE_STRAIGHT_RAPID
,
next_pos
))
new_path
.
append
((
MOVE_STRAIGHT_RAPID
,
next_pos
))
last_pos
=
None
last_pos
=
None
else
:
else
:
...
@@ -79,9 +80,10 @@ class TinySidewaysMovesFilter(BaseFilter):
...
@@ -79,9 +80,10 @@ class TinySidewaysMovesFilter(BaseFilter):
for
move_type
,
args
in
toolpath
:
for
move_type
,
args
in
toolpath
:
if
move_type
in
(
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
):
if
move_type
in
(
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
):
if
in_safety
and
last_pos
:
if
in_safety
and
last_pos
:
# check if the last position was very close
# check if the last position was very close and at the
if
(
last_pos
.
sub
(
args
)
.
norm
<
self
.
tolerance
)
and
\
# same height
(
last_pos
.
x
==
args
.
x
)
and
(
last_pos
.
y
==
args
.
y
):
if
(
pdist
(
last_pos
,
args
)
<
self
.
tolerance
)
and
\
(
abs
(
last_pos
[
2
]
-
args
[
2
])
<
epsilon
):
# within tolerance -> remove previous safety move
# within tolerance -> remove previous safety move
new_path
.
pop
(
-
1
)
new_path
.
pop
(
-
1
)
in_safety
=
False
in_safety
=
False
...
...
pycam/Toolpath/__init__.py
View file @
685ec9f9
...
@@ -111,7 +111,7 @@ class Toolpath(object):
...
@@ -111,7 +111,7 @@ class Toolpath(object):
return
Toolpath
(
new_paths
,
parameters
=
self
.
get_params
())
return
Toolpath
(
new_paths
,
parameters
=
self
.
get_params
())
def
_get_limit_generic
(
self
,
idx
,
func
):
def
_get_limit_generic
(
self
,
idx
,
func
):
values
=
[
p
[
x
]
for
move_type
,
p
in
self
.
path
values
=
[
p
[
id
x
]
for
move_type
,
p
in
self
.
path
if
move_type
in
(
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
)]
if
move_type
in
(
MOVE_STRAIGHT
,
MOVE_STRAIGHT_RAPID
)]
return
func
(
values
)
return
func
(
values
)
...
...
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