pythonCascade Sample Problems
Geometry: 2D
circles from curves

P1 =
gp_Pnt2d(9,6)
P2 =
gp_Pnt2d(10,4)
P3 =
gp_Pnt2d(6,7)
C =
gce_MakeCirc2d(P1,P2,P3).Value()
QC = GccEnt().Outside(C)
P4 =
gp_Pnt2d(-2,7)
P5 =
gp_Pnt2d(12,-3)
L =
GccAna_Lin2d2Tan(P4,P5,Precision.Confusion()).ThisSolution(1)
QL =
GccEnt().Unqualified(L)
radius = 2
TR =
GccAna_Circ2d2TanRad(QC,QL,radius,Precision.Confusion())
if
TR.IsDone():
NbSol =
TR.NbSolutions()
for k in
range(1,NbSol+1):
circ
= TR.ThisSolution(k)
#
find the solution circle
parsol,pararg,tangentpoint1 = TR.Tangency1(k)
#
find the first tangent point
parsol,pararg,tangentpoint2 = TR.Tangency2(k)
#
find the second tangent point
self.DisplayPoint(P1,"P1",0,0,0,0.05)
self.DisplayPoint(P2,"P2",0,0,0,0.05)
self.DisplayPoint(P3,"P3",0,0,0,0.05)
self.DisplayPoint(P4,"P4",0,0,0,0.05)
self.DisplayPoint(P5,"P5",0,0,0,0.05)
aCircle =
Geom2d_Circle(C)
self.DisplayCurve(aCircle,3,1)
aLine =
GCE2d_MakeSegment(L,-2,20).Value()
self.DisplayCurve(aLine,5,0)
if TR.IsDone():
NbSol =
TR.NbSolutions()
for k in
range(1,NbSol+1):
circ
= TR.ThisSolution(k)
aCircle = Geom2d_Circle(circ)
self.DisplayCurve(aCircle,5,1)
#
find the solution circle
parsol,pararg,tangentpoint1 = TR.Tangency1(k)
#
find the first tangent point
self.DisplayPoint(tangentpoint1,"tangentpoint1",0,0.1,0,0.05)
parsol,pararg,tangentpoint2 = TR.Tangency2(k)
self.DisplayPoint(tangentpoint2,"tangentpoint2",0,0.1,0,0.05)
# find the second tangent point