Removed TangentLine - redundant to PolarLine

This commit is contained in:
Roger Maitland 2022-11-18 14:32:06 -05:00
parent 5f08c3a098
commit 328ab92340
4 changed files with 34 additions and 73 deletions

View file

@ -78,7 +78,6 @@ Objects
.. autoclass:: SagittaArc
.. autoclass:: Spline
.. autoclass:: TangentArc
.. autoclass:: TangentLine
.. autoclass:: ThreePointArc
***********

View file

@ -21,59 +21,52 @@ license:
from build123d import *
pegd = 6.35+0.1 #mm ~0.25inch
c2c = 25.4 #mm 1.0inch
pegd = 6.35 + 0.1 # mm ~0.25inch
c2c = 25.4 # mm 1.0inch
arcd = 7.2
both = 10
topx = 6
midx = 8
maind = 0.82*pegd
midd = 1.0*pegd
maind = 0.82 * pegd
midd = 1.0 * pegd
hookd = 23
hookx = 10
splitz = maind/2-.1
splitz = maind / 2 - 0.1
topangs = 70
with BuildPart() as mainp:
with BuildLine(mode=Mode.PRIVATE) as sprof:
l1 = Line((-both,0),(c2c-arcd/2-0.5,0))
l2 = JernArc(start=l1@1,
tangent=l1%1,
radius=arcd/2,
arc_size=topangs
)
l3 = TangentLine(start=l2@1,
tangent=l2%1,
length=topx
)
l4 = JernArc(start=l3@1,
tangent=l3%1,
radius=arcd/2,
arc_size=-topangs
)
l5 = TangentLine(start=l4@1,
tangent=l4%1,
length=topx
)
l6 = JernArc(start=l1@0,
tangent=(l1%0).reverse(),
radius=hookd/2,
arc_size=170
)
l7 = TangentLine(start=l6@1,
tangent=l6%1,
length=hookx
)
l1 = Line((-both, 0), (c2c - arcd / 2 - 0.5, 0))
l2 = JernArc(start=l1 @ 1, tangent=l1 % 1, radius=arcd / 2, arc_size=topangs)
l3 = PolarLine(
start=l2 @ 1,
length=topx,
direction=l2 % 1,
)
l4 = JernArc(start=l3 @ 1, tangent=l3 % 1, radius=arcd / 2, arc_size=-topangs)
l5 = PolarLine(
start=l4 @ 1,
length=topx,
direction=l4 % 1,
)
l6 = JernArc(
start=l1 @ 0, tangent=(l1 % 0).reverse(), radius=hookd / 2, arc_size=170
)
l7 = PolarLine(
start=l6 @ 1,
length=hookx,
direction=l6 % 1,
)
with BuildSketch(Plane.YZ):
Circle(radius=maind/2)
Circle(radius=maind / 2)
Sweep(path=sprof.wires()[0])
with BuildLine(mode=Mode.PRIVATE) as stub:
l7 = Line((0,0),(0,midx+maind/2))
l7 = Line((0, 0), (0, midx + maind / 2))
with BuildSketch(Plane.XZ):
Circle(radius=midd/2)
Circle(radius=midd / 2)
Sweep(path=stub.wires()[0])
#splits help keep the object 3d printable by reducing overhang
Split(bisect_by=Plane(origin=(0,0,-splitz)))
Split(bisect_by=Plane(origin=(0,0,splitz)),keep=Keep.BOTTOM)
# splits help keep the object 3d printable by reducing overhang
Split(bisect_by=Plane(origin=(0, 0, -splitz)))
Split(bisect_by=Plane(origin=(0, 0, splitz)), keep=Keep.BOTTOM)
show_object(mainp.part.wrapped)

View file

@ -56,7 +56,6 @@ __all__ = [
"SagittaArc",
"Spline",
"TangentArc",
"TangentLine",
"JernArc",
"ThreePointArc",
"BuildPart",

View file

@ -579,36 +579,6 @@ class TangentArc(Edge):
super().__init__(arc.wrapped)
class TangentLine(Edge):
"""Line Object: Tangent Line
Add an straight line defined by start point, tangent and length.
Args:
start (VectorLike): start point
tangent (VectorLike): tangent at start point
length (float): line length
mode (Mode, optional): combination mode. Defaults to Mode.ADD.
"""
def __init__(
self,
start: VectorLike,
tangent: VectorLike,
length: float,
mode: Mode = Mode.ADD,
):
context: BuildLine = BuildLine._get_context()
validate_inputs(self, context)
start_point = Vector(start)
end_point = start_point + Vector(tangent).normalized() * length
line = Edge.make_line(start_point, end_point)
context._add_to_context(line, mode=mode)
super().__init__(line.wrapped)
class ThreePointArc(Edge):
"""Line Object: Three Point Arc