pythonCascade Sample Problems
Geometry: 2D curves from intersections

harray = []
harray.append(gp_Pnt2d(0,0))
harray.append(gp_Pnt2d(-3,1))
harray.append(gp_Pnt2d(-2,5))
harray.append(gp_Pnt2d(2,9))
harray.append(gp_Pnt2d(-4,14))
anInterpolation = Geom2dAPI_Interpolate(harray,0,0.01)
anInterpolation.Perform()
SPL =
anInterpolation.Curve()
P1 =
gp_Pnt2d(-1,-2)
P2 =
gp_Pnt2d(0,15)
V1 =
gp().DY2d()
TC1=
GCE2d_MakeSegment(P1,V1,P2).Value()
tolerance =
Precision.Confusion()
ICC =
Geom2dAPI_InterCurveCurve(SPL,TC1,tolerance)
NbPoints
=ICC.NbPoints()
for k in
range(1,NbPoints +1):
PK =
ICC.Point(k)
# do
something with each intersection point
aCurve1 =
ISession2D_Curve(SPL,Aspect_TOL_SOLID,Aspect_WOL_MEDIUM,4)
aCurve1.SetDisplayPole(0)
self.myISessionContext.Display(aCurve1,1)
self.DisplayCurve(TC1,4,0)
for i in
range(1,NbPoints+1):
PK = ICC.Point(i)
pstring =
"PK_" +`i`
self.DisplayPoint(PK,pstring,0,0.5,0,0.05)
for P in
harray:
self.DisplayPoint(P,"",0,0.0,0,0.0)