pythonCascade Sample Problems

Topology Building: Shapes sewing



        self.Initialize()

        self.interactive_context.EraseAll(0,1)

 

        P = gp_Pnt(0,0,0)

        V = gp_Vec(0,0,1)

        Pi = Geom_Plane(P,V)

        GeometricSurface = Geom_RectangularTrimmedSurface(Pi,0.,100.,0.,100.)

        FirstShape = BRepBuilderAPI_MakeFace(GeometricSurface).Face()

 

        white1 = AIS_Shape(FirstShape)

        self.interactive_context.SetColor(white1,Quantity_NOC_RED,0)

        self.interactive_context.SetMaterial(white1,Graphic3d_NOM_PLASTIC,0)

        self.interactive_context.SetTransparency(white1,0.7,0)

        self.interactive_context.SetDisplayMode(white1,AIS_Shaded,0)

        self.interactive_context.Display(white1,0)

 

        P1 = gp_Pnt(0,0,0)

        P2 = gp_Pnt(50,0,0)

        P3 = gp_Pnt(100,0,0)

        P4 = gp_Pnt(25,12,85)

        P5 = gp_Pnt(100,0,80)

        P6 = gp_Pnt(135,-12,85)

       

        array = []

        array.append([P1,P2,P3])

        array.append([P4,P5,P6])

        aSurf = GeomAPI_PointsToBSplineSurface(array,3,8,GeomAbs_C2,0.00001).Surface()

        SecondShape = BRepBuilderAPI_MakeFace(aSurf).Face()

 

        white2 = AIS_Shape(SecondShape)

        self.interactive_context.SetColor(white2,Quantity_NOC_YELLOW,0)

        self.interactive_context.SetMaterial(white2,Graphic3d_NOM_PLASTIC,0)

        self.interactive_context.SetTransparency(white2,0.4,0)

        self.interactive_context.SetDisplayMode(white2,AIS_Shaded,0)

        self.interactive_context.Display(white2,0)

 

        aMethod = BRepOffsetAPI_Sewing()

        aMethod.Add(FirstShape)           

        aMethod.Add(SecondShape)

       

        aMethod.Perform()

 

        sewedShape = aMethod.SewedShape()

        result = AIS_Shape(sewedShape)

        self.interactive_context.SetDisplayMode(result,0)

        self.interactive_context.Display(result,0)

        

        self.view.FitAll(0.01,0)

        self.view.ZFitAll(0.01)

        self.view.Redraw()