edwilliams16 wrote: ↑Wed Apr 21, 2021 8:40 am
Can you make a drawing, showing the known information and what you want to calculate? I couldn’t follow your written description.
Code: Select all
import FreeCAD
from FreeCAD import Rotation, Vector
from draftgeoutils.edges import findMidpoint
from draftgeoutils.intersections import findIntersection, angleBisection
def tangent2L1C(l_a, l_b):
pti = findIntersection(l_a, l_b, True, True)
line_a = Part.makeLine(l_a.Vertexes[1].Point, pti[0])
line_b = Part.makeLine(l_b.Vertexes[0].Point, pti[0])
obj1 = DOC.addObject("Part::Feature", "p_line_a")
obj1.Shape = line_a
obj1.ViewObject.LineColor = (1.000,0.000,0.000)
obj1.ViewObject.Visibility = True
obj2 = DOC.addObject("Part::Feature", "p_line_b")
obj2.Shape = line_b
obj2.ViewObject.LineColor = (1.000,0.000,0.000)
def make_dbg_mk(tgt_pt, anchor, dist, desc):
"""make a marker to show point position"""
l0_pos = dest_pt(tgt_pt, math.radians(anchor), dist)
o_l = Draft.make_label(
label_type="Custom",
target_point=tgt_pt,
placement=l0_pos,
custom_text=desc
)
o_l.ViewObject.ArrowType = "Arrow"
o_l.ViewObject.ArrowSize = 1
p1 = Vector(30.36, 74.38, 0.0)
p2 = Vector(135.88, 21.80, 0.0)
p3 = Vector(134.88, 0.00, 0.0)
p4 = Vector(12.56, 0.00, 0.0)
l_a = Part.LineSegment(p1, p2).toShape()
Part.show(l_a, "line_a")
l_b = Part.LineSegment(p3, p4).toShape()
Part.show(l_b, "line_b")
res = tangent2L1C(l_a, l_b)
pti = findIntersection(l_a, l_b, True, True)[0]
make_dbg_mk(p2, 90, 10, "Point A")
make_dbg_mk(p3, 270, 10, "Point B")
I want to find the circle that is tangent to point A and point B and that round edges, like in this image:
- K17id.png (61.86 KiB) Viewed 1121 times
I have calculated the point P, but I'm failing to find the perpendicular line to find the center, and even to trace the proper Bisection as
angleBisection from
draftgeoutils.intersections seems not to work .
I want to fillet the line between "point" A and "point B" with a circle that pass exactly for "point A" and "Point B", using the fillet function it will not work, so I'm trying to determine the center and the the bisection between "line a" and "line b" to pass to an
Part.Arc(p1, p3, p2) to have a proper arc passing through "Point A " and "Point B"
So I have to find the intersection between the lines to find circle center, and then calculate the radius OA == OB
Probably I'm doing something wrong, or misunderstand something.
TIA and Regards
Carlo D.