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
3e556f62
Commit
3e556f62
authored
Mar 24, 2012
by
Whitham D. Reeve II
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed old commented out code
parent
43541aa0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
51 deletions
+12
-51
BaseCutter.py
pycam/Cutters/BaseCutter.py
+2
-7
CylindricalCutter.py
pycam/Cutters/CylindricalCutter.py
+3
-26
SphericalCutter.py
pycam/Cutters/SphericalCutter.py
+3
-7
ToroidalCutter.py
pycam/Cutters/ToroidalCutter.py
+4
-11
No files found.
pycam/Cutters/BaseCutter.py
View file @
3e556f62
...
...
@@ -151,7 +151,6 @@ class BaseCutter(IDGenerator):
if
cp
:
# check if the contact point is between the endpoints
m
=
pdot
(
psub
(
cp
,
edge
.
p1
),
edge
.
dir
)
#m = cp.sub(edge.p1).dot(edge.dir)
if
(
m
<
-
epsilon
)
or
(
m
>
edge
.
len
+
epsilon
):
return
(
None
,
INFINITE
,
cp
)
return
(
cl
,
l
,
cp
)
...
...
@@ -160,7 +159,7 @@ class BaseCutter(IDGenerator):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_cylinder_point
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center)
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
point
)
# offset intersection
if
ccp
:
...
...
@@ -173,7 +172,6 @@ class BaseCutter(IDGenerator):
start
=
self
.
location
(
cl
,
ccp
,
cp
,
l
)
=
self
.
intersect_cylinder_point
(
direction
,
point
,
start
=
start
)
#if ccp and ccp[2] < start.sub(self.location).add(self.center)[2]:
if
ccp
and
ccp
[
2
]
<
padd
(
psub
(
start
,
self
.
location
),
self
.
center
)[
2
]:
return
(
None
,
INFINITE
,
None
)
return
(
cl
,
l
,
cp
)
...
...
@@ -182,12 +180,11 @@ class BaseCutter(IDGenerator):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_cylinder_line
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
edge
)
# offset intersection
if
ccp
:
cl
=
padd
(
start
,
psub
(
cp
,
ccp
))
#cl = start.add(cp.sub(ccp))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -199,10 +196,8 @@ class BaseCutter(IDGenerator):
if
not
ccp
:
return
(
None
,
INFINITE
,
None
)
m
=
pdot
(
psub
(
cp
,
edge
.
p1
),
edge
.
dir
)
#m = cp.sub(edge.p1).dot(edge.dir)
if
(
m
<
-
epsilon
)
or
(
m
>
edge
.
len
+
epsilon
):
return
(
None
,
INFINITE
,
None
)
#if ccp.z < start.sub(self.location).add(self.center)[2]:
if
ccp
[
2
]
<
padd
(
psub
(
start
,
self
.
location
),
self
.
center
)[
2
]:
return
(
None
,
INFINITE
,
None
)
return
(
cl
,
l
,
cp
)
...
...
pycam/Cutters/CylindricalCutter.py
View file @
3e556f62
...
...
@@ -138,11 +138,10 @@ class CylindricalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
d
)
=
intersect_circle_plane
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
distance_radius
,
direction
,
triangle
)
if
ccp
and
cp
:
cl
=
padd
(
cp
,
psub
(
start
,
ccp
))
#cl = cp.add(start.sub(ccp))
return
(
cl
,
ccp
,
cp
,
d
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -150,11 +149,10 @@ class CylindricalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_circle_point
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
point
)
if
ccp
:
cl
=
padd
(
cp
,
psub
(
start
,
ccp
))
#cl = cp.add(start.sub(ccp))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -162,11 +160,10 @@ class CylindricalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_circle_line
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
edge
)
if
ccp
:
cl
=
padd
(
cp
,
psub
(
start
,
ccp
))
#cl = cp.add(start.sub(ccp))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -181,8 +178,6 @@ class CylindricalCutter(BaseCutter):
cl
=
cl_t
cp
=
cp_t
if
cl
and
(
direction
[
0
]
==
0
)
and
(
direction
[
1
]
==
0
):
#print 'circle_triangle:'
#print 'cl is:', cl, 'd is:', d, 'cp is:', cp
return
(
cl
,
d
,
cp
)
(
cl_e1
,
d_e1
,
cp_e1
)
=
self
.
intersect_circle_edge
(
direction
,
triangle
.
e1
,
start
=
start
)
...
...
@@ -194,20 +189,15 @@ class CylindricalCutter(BaseCutter):
d
=
d_e1
cl
=
cl_e1
cp
=
cp_e1
#print 'circle_edge e1:'
if
d_e2
<
d
:
d
=
d_e2
cl
=
cl_e2
cp
=
cp_e2
#print 'circle_edge e2:'
if
d_e3
<
d
:
d
=
d_e3
cl
=
cl_e3
cp
=
cp_e3
#print 'circle_edge e3:'
if
cl
and
(
direction
[
0
]
==
0
)
and
(
direction
[
1
]
==
0
):
#print 'circle_edge:'
#print 'cl is:', cl, 'd is:', d, 'cp is:', cp
return
(
cl
,
d
,
cp
)
(
cl_p1
,
d_p1
,
cp_p1
)
=
self
.
intersect_circle_vertex
(
direction
,
triangle
.
p1
,
start
=
start
)
...
...
@@ -219,20 +209,15 @@ class CylindricalCutter(BaseCutter):
d
=
d_p1
cl
=
cl_p1
cp
=
cp_p1
#print 'circle vertex p1:'
if
d_p2
<
d
:
d
=
d_p2
cl
=
cl_p2
cp
=
cp_p2
#print 'circle vertex p2:'
if
d_p3
<
d
:
d
=
d_p3
cl
=
cl_p3
cp
=
cp_p3
#print 'circle vertex p3:'
if
cl
and
(
direction
[
0
]
==
0
)
and
(
direction
[
1
]
==
0
):
#print 'circle vertex:'
#print 'cl is:', cl, 'd is:', d, 'cp is:', cp
return
(
cl
,
d
,
cp
)
if
(
direction
[
0
]
!=
0
)
or
(
direction
[
1
]
!=
0
):
(
cl_p1
,
d_p1
,
cp_p1
)
=
self
.
intersect_cylinder_vertex
(
direction
,
...
...
@@ -245,17 +230,14 @@ class CylindricalCutter(BaseCutter):
d
=
d_p1
cl
=
cl_p1
cp
=
cp_p1
#print 'cyl vertex p1:'
if
d_p2
<
d
:
d
=
d_p2
cl
=
cl_p2
cp
=
cp_p2
#print 'cyl vertex p2:'
if
d_p3
<
d
:
d
=
d_p3
cl
=
cl_p3
cp
=
cp_p3
#print 'cyl vertex p3:'
(
cl_e1
,
d_e1
,
cp_e1
)
=
self
.
intersect_cylinder_edge
(
direction
,
triangle
.
e1
,
start
=
start
)
(
cl_e2
,
d_e2
,
cp_e2
)
=
self
.
intersect_cylinder_edge
(
direction
,
...
...
@@ -266,18 +248,13 @@ class CylindricalCutter(BaseCutter):
d
=
d_e1
cl
=
cl_e1
cp
=
cp_e1
#print 'cyl edge e1:'
if
d_e2
<
d
:
d
=
d_e2
cl
=
cl_e2
cp
=
cp_e2
#print 'cyl edge e2:'
if
d_e3
<
d
:
d
=
d_e3
cl
=
cl_e3
cp
=
cp_e3
#print 'cyl edge e3:'
#print 'cyl:'
#print 'cl is:', cl, 'd is:', d, 'cp is:', cp
return
(
cl
,
d
,
cp
)
pycam/Cutters/SphericalCutter.py
View file @
3e556f62
...
...
@@ -147,12 +147,11 @@ class SphericalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
d
)
=
intersect_sphere_plane
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
distance_radius
,
direction
,
triangle
)
# offset intersection
if
ccp
:
cl
=
padd
(
cp
,
psub
(
start
,
ccp
))
#cl = cp.add(start.sub(ccp))
return
(
cl
,
ccp
,
cp
,
d
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -167,7 +166,7 @@ class SphericalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_sphere_point
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
#start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
point
)
# offset intersection
cl
=
None
...
...
@@ -184,12 +183,11 @@ class SphericalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_sphere_line
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
# start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
edge
)
# offset intersection
if
ccp
:
cl
=
psub
(
cp
,
psub
(
ccp
,
start
))
#cl = cp.sub(ccp.sub(start))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -199,9 +197,7 @@ class SphericalCutter(BaseCutter):
if
cp
:
# check if the contact point is between the endpoints
d
=
psub
(
edge
.
p2
,
edge
.
p1
)
#d = edge.p2.sub(edge.p1)
m
=
pdot
(
psub
(
cp
,
edge
.
p1
),
d
)
#m = cp.sub(edge.p1).dot(d)
if
(
m
<
-
epsilon
)
or
(
m
>
pnormsq
(
d
)
+
epsilon
):
return
(
None
,
INFINITE
,
None
)
return
(
cl
,
l
,
cp
)
...
...
pycam/Cutters/ToroidalCutter.py
View file @
3e556f62
...
...
@@ -119,12 +119,11 @@ class ToroidalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_torus_plane
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
# start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_majorradius
,
self
.
distance_minorradius
,
direction
,
triangle
)
if
cp
:
cl
=
padd
(
cp
,
psub
(
start
,
ccp
))
#cl = cp.add(start.sub(ccp))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -139,13 +138,12 @@ class ToroidalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_torus_point
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
# start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_majorradius
,
self
.
distance_minorradius
,
self
.
distance_majorradiussq
,
self
.
distance_minorradiussq
,
direction
,
point
)
if
ccp
:
cl
=
padd
(
point
,
psub
(
start
,
ccp
))
#cl = point.add(start.sub(ccp))
return
(
cl
,
ccp
,
point
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -197,12 +195,11 @@ class ToroidalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_cylinder_point
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
# start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
point
)
# offset intersection
if
ccp
:
cl
=
padd
(
start
,
pmul
(
direction
,
l
))
#cl = start.add(direction.mul(l))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -210,7 +207,7 @@ class ToroidalCutter(BaseCutter):
if
start
is
None
:
start
=
self
.
location
(
ccp
,
cp
,
l
)
=
intersect_cylinder_line
(
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
# start.sub(self.location).add(self.center),
padd
(
psub
(
start
,
self
.
location
),
self
.
center
),
self
.
axis
,
self
.
distance_radius
,
self
.
distance_radiussq
,
direction
,
edge
)
# offset intersection
if
ccp
:
...
...
@@ -226,7 +223,6 @@ class ToroidalCutter(BaseCutter):
return
(
None
,
INFINITE
,
None
)
if
ccp
:
m
=
pdot
(
psub
(
cp
,
edge
.
p1
),
edge
.
dir
)
#m = cp.sub(edge.p1).dot(edge.dir)
if
(
m
<
-
epsilon
)
or
(
m
>
edge
.
len
+
epsilon
):
return
(
None
,
INFINITE
,
None
)
return
(
cl
,
l
,
cp
)
...
...
@@ -239,7 +235,6 @@ class ToroidalCutter(BaseCutter):
# offset intersection
if
ccp
:
cl
=
psub
(
cp
,
psub
(
ccp
,
start
))
#cl = cp.sub(ccp.sub(start))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -251,7 +246,6 @@ class ToroidalCutter(BaseCutter):
direction
,
point
)
if
ccp
:
cl
=
psub
(
cp
,
psub
(
ccp
,
start
))
#cl = cp.sub(ccp.sub(start))
return
(
cl
,
ccp
,
point
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
@@ -263,7 +257,6 @@ class ToroidalCutter(BaseCutter):
direction
,
edge
)
if
ccp
:
cl
=
psub
(
cp
,
psub
(
ccp
,
start
))
#cl = cp.sub(ccp.sub(start))
return
(
cl
,
ccp
,
cp
,
l
)
return
(
None
,
None
,
None
,
INFINITE
)
...
...
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