pythonCascade Sample Problems

 Geometry: Surfaces from curves

 

 

        array = []

 

        array.append(gp_Pnt(-4,0,2 ))                                                                      

        array.append(gp_Pnt(-7,2,2 ))                                                                       

        array.append(gp_Pnt(-6,3,1 ))                                                                      

        array.append(gp_Pnt(-4,3,-1))                                                                      

        array.append(gp_Pnt(-3,5,-2))

 

        SPL1 = GeomAPI_PointsToBSpline(array).Curve()

       

        array2 = []

 

        array2.append(gp_Pnt(-4,0,2 ))                                                                      

        array2.append(gp_Pnt(-2,2,0 ))                                                                      

        array2.append(gp_Pnt(2,3,-1 ))                                                                      

        array2.append(gp_Pnt(3,7,-2))                                                                       

        array2.append(gp_Pnt(4,9,-1))

 

        SPL2 = GeomAPI_PointsToBSpline(array2).Curve()

       

        aGeomFill1 = GeomFill_BSplineCurves(SPL1,SPL2,GeomFill_StretchStyle)

        aGeomFill2 = GeomFill_BSplineCurves(Geom_BSplineCurve().DownCast(SPL1.Translated(gp_Vec(10,0,0))),Geom_BSplineCurve().DownCast(SPL2.Translated(gp_Vec(10,0,0))),GeomFill_CoonsStyle)

        aGeomFill3 = GeomFill_BSplineCurves(Geom_BSplineCurve().DownCast(SPL1.Translated(gp_Vec(20,0,0))),Geom_BSplineCurve().DownCast(SPL2.Translated(gp_Vec(20,0,0))),GeomFill_CurvedStyle)

 

        aBSplineSurface1 = aGeomFill1.Surface()

        self.DisplaySurface(aBSplineSurface1,1,color = Quantity_NOC_YELLOW)

        aBSplineSurface2 = aGeomFill2.Surface()

        self.DisplaySurface(aBSplineSurface2,1,color = Quantity_NOC_SALMON)

        aBSplineSurface3 = aGeomFill3.Surface()

        self.DisplaySurface(aBSplineSurface3,1,color = Quantity_NOC_HOTPINK)

 

        for i in range(0,3):

            aCurve1 = ISession_Curve(Geom_Curve().DownCast(SPL1.Translated(gp_Vec(i * 10,0,0))))

            self.interactive_context.SetDisplayMode(aCurve1,0,1)

            self.interactive_context.SetColor(aCurve1,Quantity_NOC_RED,1)

            aCurve1.Attributes().LineAspect().SetColor(Quantity_NOC_RED)

            self.interactive_context.Display(aCurve1,1)

            aCurve2 = ISession_Curve(Geom_Curve().DownCast(SPL2.Translated(gp_Vec(i * 10,0,0))))

            self.interactive_context.SetDisplayMode(aCurve2,0,1)

            self.interactive_context.SetColor(aCurve2,Quantity_NOC_GREEN,1)

            aCurve1.Attributes().LineAspect().SetColor(Quantity_NOC_GREEN)

            self.interactive_context.Display(aCurve2,1)