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
43541aa0
Commit
43541aa0
authored
Mar 24, 2012
by
Whitham D. Reeve II
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old commented out code.
parent
c8d5feb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
21 deletions
+2
-21
ContourFollow.py
pycam/PathGenerators/ContourFollow.py
+1
-13
DropCutter.py
pycam/PathGenerators/DropCutter.py
+1
-2
PushCutter.py
pycam/PathGenerators/PushCutter.py
+0
-1
__init__.py
pycam/PathGenerators/__init__.py
+0
-5
No files found.
pycam/PathGenerators/ContourFollow.py
View file @
43541aa0
...
...
@@ -50,7 +50,6 @@ def _process_one_triangle((model, cutter, up_vector, triangle, z)):
# Case 1a
return
result
,
None
# ignore triangles pointing upwards or downwards
#if triangle.normal.cross(up_vector).norm == 0:
if
pnorm
(
pcross
(
triangle
.
normal
,
up_vector
))
==
0
:
# Case 1b
return
result
,
None
...
...
@@ -344,14 +343,12 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
for
index
in
range
(
3
):
edge
=
Line
(
proj_points
[
index
-
1
],
proj_points
[
index
])
# the edge should be clockwise around the model
#if edge.dir.cross(triangle.normal).dot(up_vector) < 0:
if
pdot
(
pcross
(
edge
.
dir
,
triangle
.
normal
),
up_vector
)
<
0
:
edge
=
Line
(
edge
.
p2
,
edge
.
p1
)
edges
.
append
((
edge
,
proj_points
[
index
-
2
]))
outer_edges
=
[]
for
edge
,
other_point
in
edges
:
# pick only edges, where the other point is on the right side
#if other_point.sub(edge.p1).cross(edge.dir).dot(up_vector) > 0:
if
pdot
(
pcross
(
psub
(
other_point
,
edge
.
p1
),
edge
.
dir
),
up_vector
)
>
0
:
outer_edges
.
append
(
edge
)
if
len
(
outer_edges
)
==
0
:
...
...
@@ -364,7 +361,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
outer_edges
=
[
long_edge
]
else
:
edge
=
Line
(
proj_points
[
0
],
proj_points
[
1
])
#if edge.dir.cross(triangle.normal).dot(up_vector) < 0:
if
pdot
(
pcross
(
edge
.
dir
,
triangle
.
normal
),
up_vector
)
<
0
:
edge
=
Line
(
edge
.
p2
,
edge
.
p1
)
outer_edges
=
[
edge
]
...
...
@@ -402,7 +398,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
elif
len
(
points_above
)
==
1
:
other_point
=
points_above
[
0
]
dot
=
pdot
(
pcross
(
psub
(
other_point
,
waterline
.
p1
),
waterline
.
dir
),
up_vector
)
#dot = other_point.sub(waterline.p1).cross(waterline.dir).dot(up_vector)
if
dot
>
0
:
# Case (2b)
outer_edges
=
[
waterline
]
...
...
@@ -413,7 +408,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
edges
.
append
(
Line
(
waterline
.
p2
,
other_point
))
outer_edges
=
[]
for
edge
in
edges
:
#if edge.dir.cross(triangle.normal).dot(up_vector) < 0:
if
pdot
(
pcross
(
edge
.
dir
,
triangle
.
normal
),
up_vector
)
<
0
:
outer_edges
.
append
(
Line
(
edge
.
p2
,
edge
.
p1
))
else
:
...
...
@@ -427,7 +421,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
edges
.
append
(
Line
(
waterline
.
p2
,
other_point
))
edges
.
sort
(
key
=
lambda
x
:
x
.
len
)
edge
=
edges
[
-
1
]
#if edge.dir.cross(triangle.normal).dot(up_vector) < 0:
if
pdot
(
pcross
(
edge
.
dir
,
triangle
.
normal
),
up_vector
)
<
0
:
outer_edges
=
[
Line
(
edge
.
p2
,
edge
.
p1
)]
else
:
...
...
@@ -436,7 +429,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
# two points above
other_point
=
points_above
[
0
]
dot
=
pdot
(
pcross
(
psub
(
other_point
,
waterline
.
p1
),
waterline
.
dir
),
up_vector
)
#dot = other_point.sub(waterline.p1).cross(waterline.dir).dot(up_vector)
if
dot
>
0
:
# Case (2b)
# the other two points are on the right side
...
...
@@ -444,7 +436,6 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
elif
dot
<
0
:
# Case (3a)
edge
=
Line
(
points_above
[
0
],
points_above
[
1
])
#if edge.dir.cross(triangle.normal).dot(up_vector) < 0:
if
pdot
(
pcross
(
edge
.
dir
,
triangle
.
normal
),
up_vector
)
<
0
:
outer_edges
=
[
Line
(
edge
.
p2
,
edge
.
p1
)]
else
:
...
...
@@ -479,22 +470,19 @@ def get_collision_waterline_of_triangle(model, cutter, up_vector, triangle, z):
if
direction
is
None
:
continue
direction
=
pmul
(
direction
,
max_length
)
#direction = direction.mul(max_length)
edge_dir
=
psub
(
edge
.
p2
,
edge
.
p1
)
#edge_dir = edge.p2.sub(edge.p1)
# TODO: Adapt the number of potential starting positions to the length
# of the line. Don't use 0.0 and 1.0 - this could result in ambiguous
# collisions with triangles sharing these vertices.
for
factor
in
(
0.5
,
epsilon
,
1.0
-
epsilon
,
0.25
,
0.75
):
start
=
padd
(
edge
.
p1
,
pmul
(
edge_dir
,
factor
))
#start = edge.p1.add(edge_dir.mul(factor))
# We need to use the triangle collision algorithm here - because we
# need the point of collision in the triangle.
collisions
=
get_free_paths_triangles
([
model
],
cutter
,
start
,
padd
(
start
,
direction
),
return_triangles
=
True
)
for
index
,
coll
in
enumerate
(
collisions
):
if
(
index
%
2
==
0
)
and
(
not
coll
[
1
]
is
None
)
\
and
(
not
coll
[
2
]
is
None
)
\
and
(
pdot
(
psub
(
coll
[
0
],
start
),
direction
)
>
0
):
#and (coll[0].sub(start).dot(direction) > 0):
and
(
pdot
(
psub
(
coll
[
0
],
start
),
direction
)
>
0
):
cl
,
hit_t
,
cp
=
coll
break
else
:
...
...
pycam/PathGenerators/DropCutter.py
View file @
43541aa0
...
...
@@ -26,8 +26,7 @@ from pycam.Utils import ProgressCounter
from
pycam.Utils.threading
import
run_in_parallel
import
pycam.Geometry.Model
import
pycam.Utils.log
#import pprint
#pp = pprint.PrettyPrinter(indent=4)
log
=
pycam
.
Utils
.
log
.
get_logger
()
...
...
pycam/PathGenerators/PushCutter.py
View file @
43541aa0
...
...
@@ -129,7 +129,6 @@ class PushCutter(object):
p1
,
p2
=
line
# calculate the required calculation depth (recursion)
distance
=
pnorm
(
psub
(
p2
,
p1
))
#distance = p2.sub(p1).norm
# TODO: accessing cutter.radius here is slightly ugly
depth
=
math
.
log
(
accuracy
*
distance
/
cutter
.
radius
)
/
math
.
log
(
2
)
depth
=
min
(
max
(
ceil
(
depth
),
4
),
max_depth
)
...
...
pycam/PathGenerators/__init__.py
View file @
43541aa0
...
...
@@ -65,11 +65,8 @@ def get_free_paths_triangles(models, cutter, p1, p2, return_triangles=False):
return
all_results
backward
=
pnormalized
(
psub
(
p1
,
p2
))
#backward = p1.sub(p2).normalized()
forward
=
pnormalized
(
psub
(
p2
,
p1
))
#forward = p2.sub(p1).normalized()
xyz_dist
=
pnorm
(
psub
(
p2
,
p1
))
#xyz_dist = p2.sub(p1).norm
minx
=
min
(
p1
[
0
],
p2
[
0
])
maxx
=
max
(
p1
[
0
],
p2
[
0
])
...
...
@@ -255,9 +252,7 @@ def get_max_height_triangles(model, cutter, x, y, minz, maxz):
def
_check_deviance_of_adjacent_points
(
p1
,
p2
,
p3
,
min_distance
):
straight
=
psub
(
p3
,
p1
)
#straight = p3.sub(p1)
added
=
pnorm
(
psub
(
p2
,
p1
))
+
pnorm
(
psub
(
p3
,
p2
))
#added = p2.sub(p1).norm + p3.sub(p2).norm
# compare only the x/y distance of p1 and p3 with min_distance
if
straight
[
0
]
**
2
+
straight
[
1
]
**
2
<
min_distance
**
2
:
# the points are too close together
...
...
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