pythonCascade Sample Problems

self.Initialize()
self.interactive_context.EraseAll(0,1)
Pnts1 = []
Pnts1.append(gp_Pnt(0,0,0))
Pnts1.append(gp_Pnt(5,0,0))
Pnts1.append(gp_Pnt(10,10,0))
Pnts2 = []
Pnts2.append(gp_Pnt(10,10,0))
Pnts2.append(gp_Pnt(5,12,4))
Pnts2.append(gp_Pnt(0,15,10))
Pnts3 = []
Pnts3.append(gp_Pnt(0,15,10))
Pnts3.append(gp_Pnt(-12,10,11))
Pnts3.append(gp_Pnt(-10,5,13))
Pnts4 = []
Pnts4.append(gp_Pnt(-10,5,13))
Pnts4.append(gp_Pnt(-2,-2,2))
Pnts4.append(gp_Pnt(0,0,0))
PTBS1 = GeomAPI_PointsToBSpline(Pnts1)
PTBS2 = GeomAPI_PointsToBSpline(Pnts2)
PTBS3 = GeomAPI_PointsToBSpline(Pnts3)
PTBS4 = GeomAPI_PointsToBSpline(Pnts4)
C1 = PTBS1.Curve()
C2 = PTBS2.Curve()
C3 = PTBS3.Curve()
C4 = PTBS4.Curve()
fill = GeomFill_BSplineCurves()
fill.Init(C1,C2,C3,C4,GeomFill_CoonsStyle)
BSS = fill.Surface()
S = BRepBuilderAPI_MakeFace(BSS).Face()
ais1 = AIS_Shape(S)
self.interactive_context.SetDisplayMode(ais1,AIS_Shaded,0)
self.interactive_context.SetMaterial(ais1,Graphic3d_NOM_PLASTIC,0)
self.interactive_context.SetColor(ais1,Quantity_NOC_GREEN,0)
self.interactive_context.Display(ais1,1)
System = GProp_GProps()
BRepGProp().SurfaceProperties(S,System)
G = System.CentreOfMass ()
Area = System.Mass()
I = System.MatrixOfInertia()
print "Area Of the Face =" + `Area`
print "CenterOfMass :"
print " X="+`G.X()`+"
Y="+`G.Y()`+" Z="+`G.Z()`
print "Matrix of Inertia : "
print "
"+`I.Value(1,1)`+"
"+`I.Value(1,2)`+"
"+`I.Value(1,3)`
print "
"+`I.Value(2,1)`+"
"+`I.Value(2,2)`+"
"+`I.Value(2,3)`
print "
"+`I.Value(3,1)`+"
"+`I.Value(3,2)`+"
"+`I.Value(3,3)`
self.view.FitAll(0.01,0)
self.view.ZFitAll(0.01)
self.view.Redraw()