pythonCascade Sample Problems

 Geometry: Bezier surfaces

 

        array1 = []

        array2 = []

        array3 = []

        array4 = []

 

        array1.append([gp_Pnt(1,1,1),gp_Pnt(2,1,2),gp_Pnt(3,1,1)])

        array1.append([gp_Pnt(1,2,1),gp_Pnt(2,2,2),gp_Pnt(3,2,0)])

        array1.append([gp_Pnt(1,3,2),gp_Pnt(2,3,1),gp_Pnt(3,3,0)])      

 

        array2.append([gp_Pnt(3,1,1),gp_Pnt(4,1,1),gp_Pnt(5,1,2)])

        array2.append([gp_Pnt(3,2,0),gp_Pnt(4,2,1),gp_Pnt(5,2,2)])

        array2.append([gp_Pnt(3,3,0),gp_Pnt(4,3,0),gp_Pnt(5,3,1)])

 

        array3.append([gp_Pnt(1,3,2),gp_Pnt(2,3,1),gp_Pnt(3,3,0)])

        array3.append([gp_Pnt(1,4,1),gp_Pnt(2,4,0),gp_Pnt(3,4,1)])

        array3.append([gp_Pnt(1,5,1),gp_Pnt(2,5,1),gp_Pnt(3,5,2)])

 

        array4.append([gp_Pnt(3,3,0),gp_Pnt(4,3,0),gp_Pnt(5,3,1)])

        array4.append([gp_Pnt(3,4,1),gp_Pnt(4,4,1),gp_Pnt(5,4,1)])

        array4.append([gp_Pnt(3,5,2),gp_Pnt(4,5,2),gp_Pnt(5,5,1)])

 

        BZ1 = Geom_BezierSurface(array1)

        BZ2 = Geom_BezierSurface(array2)

        BZ3 = Geom_BezierSurface(array3)

        BZ4 = Geom_BezierSurface(array4)

 

        bezierarray = []

        bezierarray.append([BZ1,BZ2])

        bezierarray.append([BZ3,BZ4])

 

        BB = GeomConvert_CompBezierSurfacesToBSplineSurface(bezierarray)

        if BB.IsDone():

            BSPLSURF = Geom_BSplineSurface(BB.Poles(),BB.UKnots(),BB.VKnots(),BB.UMultiplicities(),BB.VMultiplicities(),BB.UDegree(),BB.VDegree(),0,0 )    

            BSPLSURF.Translate(gp_Vec(0,0,2))

           

 

       

        self.DisplaySurface(BZ1,1,color = Quantity_NOC_RED)

        self.DisplaySurface(BZ2,1,color = Quantity_NOC_GREEN)

        self.DisplaySurface(BZ3,1,color = Quantity_NOC_BLUE1)

        self.DisplaySurface(BZ4,1,color = Quantity_NOC_BROWN)

 

        if BB.IsDone():

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