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
a66f1fb4
Commit
a66f1fb4
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
73cb1bb0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
31 deletions
+0
-31
MotionGrid.py
pycam/Toolpath/MotionGrid.py
+0
-7
SupportGrid.py
pycam/Toolpath/SupportGrid.py
+0
-17
__init__.py
pycam/Toolpath/__init__.py
+0
-7
No files found.
pycam/Toolpath/MotionGrid.py
View file @
a66f1fb4
...
...
@@ -262,13 +262,9 @@ def get_spiral_layer(minx, maxx, miny, maxy, z, line_distance, step_width,
#offset = edge_vector.normalized().mul(radius)
if
previous
:
start
=
padd
(
start
,
offset
)
#start = start.add(offset)
center
=
padd
(
previous
,
offset
)
#center = previous.add(offset)
up_vector
=
pnormalized
(
pcross
(
psub
(
previous
,
center
),
psub
(
start
,
center
)))
#up_vector = previous.sub(center).cross(start.sub(center)).normalized()
north
=
padd
(
center
,
(
1.0
,
0.0
,
0.0
,
'v'
))
#north = center.add(Vector(1.0, 0.0, 0.0))
angle_start
=
pycam
.
Geometry
.
get_angle_pi
(
north
,
center
,
previous
,
up_vector
,
pi_factor
=
True
)
*
180.0
angle_end
=
pycam
.
Geometry
.
get_angle_pi
(
north
,
center
,
start
,
up_vector
,
pi_factor
=
True
)
*
180.0
# TODO: remove these exceptions based on up_vector.z (get_points_of_arc does not respect the plane, yet)
...
...
@@ -301,7 +297,6 @@ def get_spiral_layer(minx, maxx, miny, maxy, z, line_distance, step_width,
steps
=
floatrange
(
0.0
,
line
.
len
,
inc
=
step_width
)
for
step
in
steps
:
next_point
=
padd
(
line
.
p1
,
pmul
(
line
.
dir
,
step
))
#next_point = line.p1.add(line.dir.mul(step))
points
.
append
(
next_point
)
if
reverse
:
points
.
reverse
()
...
...
@@ -346,7 +341,6 @@ def get_lines_layer(lines, z, last_z=None, step_width=None,
# for both point pairs.
factor
=
(
z
-
line
.
p1
[
2
])
/
(
line
.
p2
[
2
]
-
line
.
p1
[
2
])
plane_point
=
padd
(
line
.
p1
,
pmul
(
line
.
vector
,
factor
))
#plane_point = line.p1.add(line.vector.mul(factor))
if
line
.
p1
[
2
]
<
z
:
p1
=
get_proj_point
(
line
.
p1
)
p2
=
line
.
p2
...
...
@@ -387,7 +381,6 @@ def get_lines_layer(lines, z, last_z=None, step_width=None,
steps
=
floatrange
(
0.0
,
line
.
len
,
inc
=
step_width
)
for
step
in
steps
:
next_point
=
padd
(
line
.
p1
,
pmul
(
line
.
dir
,
step
))
#next_point = line.p1.add(line.dir.mul(step))
points
.
append
(
next_point
)
yield
points
...
...
pycam/Toolpath/SupportGrid.py
View file @
a66f1fb4
...
...
@@ -35,25 +35,15 @@ def _get_triangles_for_face(pts):
def
_add_cuboid_to_model
(
model
,
start
,
direction
,
height
,
width
):
up
=
pmul
((
0
,
0
,
1
,
'v'
),
height
)
#up = Vector(0, 0, 1).mul(height)
ortho_dir
=
pnormalized
(
pcross
(
direction
,
up
))
#ortho_dir = direction.cross(up).normalized()
start1
=
padd
(
start
,
pmul
(
ortho_dir
,
-
width
/
2
))
#start1 = start.add(ortho_dir.mul(-width/2))
start2
=
padd
(
start1
,
up
)
#start2 = start1.add(up)
start3
=
padd
(
start2
,
pmul
(
ortho_dir
,
width
))
#start3 = start2.add(ortho_dir.mul(width))
start4
=
psub
(
start3
,
up
)
#start4 = start3.sub(up)
end1
=
padd
(
start1
,
direction
)
#end1 = start1.add(direction)
end2
=
padd
(
start2
,
direction
)
#end2 = start2.add(direction)
end3
=
padd
(
start3
,
direction
)
#end3 = start3.add(direction)
end4
=
padd
(
start4
,
direction
)
#end4 = start4.add(direction)
faces
=
((
start1
,
start2
,
start3
,
start4
),
(
start1
,
end1
,
end2
,
start2
),
(
start2
,
end2
,
end3
,
start3
),
(
start3
,
end3
,
end4
,
start4
),
(
start4
,
end4
,
end1
,
start1
),
(
end4
,
end3
,
end2
,
end1
))
...
...
@@ -195,7 +185,6 @@ def get_support_distributed(model, z_plane, average_distance,
average_distance
,
avoid_distance
)
for
pos
,
direction
in
bridges
:
_add_cuboid_to_model
(
result
,
pos
,
pmul
(
direction
,
length
),
height
,
thickness
)
#_add_cuboid_to_model(result, pos, direction.mul(length), height, thickness)
return
result
...
...
@@ -207,10 +196,8 @@ class _BridgeCorner(object):
self
.
position
=
p2
self
.
direction
=
pnormalized
(
pycam
.
Geometry
.
get_bisector
(
p1
,
p2
,
p3
,
self
.
up_vector
))
preferred_direction
=
pnormalized
(
psub
(
p2
,
barycenter
))
#preferred_direction = p2.sub(barycenter).normalized()
# direction_factor: 0..1 (bigger -> better)
direction_factor
=
(
pdot
(
preferred_direction
,
self
.
direction
)
+
1
)
/
2
#direction_factor = (preferred_direction.dot(self.direction) + 1) / 2
angle
=
pycam
.
Geometry
.
get_angle_pi
(
p1
,
p2
,
p3
,
self
.
up_vector
,
pi_factor
=
True
)
# angle_factor: 0..1 (bigger -> better)
if
angle
>
0.5
:
...
...
@@ -285,7 +272,6 @@ def _get_edge_bridges(polygon, z_plane, min_bridges, average_distance,
avoid_distance
):
def
is_near_list
(
point_list
,
point
,
distance
):
for
p
in
point_list
:
#if p.sub(point).norm <= distance:
if
pnorm
(
psub
(
p
,
point
))
<=
distance
:
return
True
return
False
...
...
@@ -320,9 +306,7 @@ def _get_edge_bridges(polygon, z_plane, min_bridges, average_distance,
line
=
polygon
.
get_lines
()[
line_index
]
# calculate two alternative points on the same line
position1
=
pdiv
(
padd
(
position
,
line
.
p1
),
2
)
#position1 = position.add(line.p1).div(2)
position2
=
pdiv
(
padd
(
position
,
line
.
p2
),
2
)
#position2 = position.add(line.p2).div(2)
if
is_near_list
(
bridge_positions
,
position1
,
avoid_distance
):
if
is_near_list
(
bridge_positions
,
position2
,
avoid_distance
):
...
...
@@ -339,7 +323,6 @@ def _get_edge_bridges(polygon, z_plane, min_bridges, average_distance,
# move the point to z_plane
position
=
(
position
[
0
],
position
[
1
],
z_plane
)
bridge_dir
=
pnormalized
(
pcross
(
lines
[
line_index
]
.
dir
,
polygon
.
plane
.
n
))
#bridge_dir = lines[line_index].dir.cross(polygon.plane.n).normalized()
result
.
append
((
position
,
bridge_dir
))
return
result
pycam/Toolpath/__init__.py
View file @
a66f1fb4
...
...
@@ -38,9 +38,7 @@ from itertools import groupby
def
_check_colinearity
(
p1
,
p2
,
p3
):
v1
=
pnormalized
(
psub
(
p2
,
p1
))
#v1 = p2.sub(p1).normalized()
v2
=
pnormalized
(
psub
(
p3
,
p2
))
#v2 = p3.sub(p2).normalized()
# compare if the normalized distances between p1-p2 and p2-p3 are equal
return
v1
==
v2
...
...
@@ -171,12 +169,10 @@ class Toolpath(object):
return
True
else
:
distance
=
pnorm
(
psub
(
new_position
,
self
.
last_pos
))
#distance = new_position.sub(self.last_pos).norm
if
self
.
moved_distance
+
distance
>
self
.
max_movement
:
partial
=
(
self
.
max_movement
-
self
.
moved_distance
)
/
\
distance
partial_dest
=
padd
(
self
.
last_pos
,
pmul
(
psub
(
new_position
,
self
.
last_pos
),
partial
))
#partial_dest = self.last_pos.add(new_position.sub(self.last_pos).mul(partial))
self
.
moves
.
append
((
partial_dest
,
rapid
))
self
.
last_pos
=
partial_dest
# we are finished
...
...
@@ -203,7 +199,6 @@ class Toolpath(object):
if
((
abs
(
p_last
[
0
]
-
p_next
[
0
])
>
epsilon
)
or
(
abs
(
p_last
[
1
]
-
p_next
[
1
])
>
epsilon
)):
# Draw the connection between the last and the next path.
# Respect the safety height.
#if (abs(p_last[2] - p_next[2]) > epsilon) or (p_last.sub(p_next).norm > self._max_safe_distance + epsilon):
if
(
abs
(
p_last
[
2
]
-
p_next
[
2
])
>
epsilon
)
or
(
pnorm
(
psub
(
p_last
,
p_next
))
>
self
.
_max_safe_distance
+
epsilon
):
# The distance between these two points is too far.
# This condition helps to prevent moves up/down for
...
...
@@ -357,7 +352,6 @@ class Toolpath(object):
for
new_pos
,
rapid
in
self
.
get_moves
(
safety_height
):
if
not
current_position
is
None
:
result
+=
pnorm
(
psub
(
new_pos
,
current_position
))
/
self
.
_feedrate
#result += new_pos.sub(current_position).norm / self._feedrate
current_position
=
new_pos
return
result
...
...
@@ -369,7 +363,6 @@ class Toolpath(object):
for
new_pos
,
rapid
in
self
.
get_moves
(
safety_height
):
if
not
current_position
is
None
:
result
+=
pnorm
(
psub
(
new_pos
,
current_position
))
#result += new_pos.sub(current_position).norm
current_position
=
new_pos
return
result
...
...
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