pythonCascade Sample Problems

 Geometry: BSpline

 

 

        array = []

        array.append(gp_Pnt2d (0,0))

        array.append(gp_Pnt2d (1,2))

        array.append(gp_Pnt2d (2,3))

        array.append(gp_Pnt2d (4,3))

        array.append(gp_Pnt2d (5,5))

 

        SPL1 = Geom2dAPI_PointsToBSpline(array).Curve()

 

        harray = []

       

        harray.append(gp_Pnt2d (7+ 0,0))

        harray.append(gp_Pnt2d (7+ 1,2))

        harray.append(gp_Pnt2d (7+ 2,3))

        harray.append(gp_Pnt2d (7+ 4,3))

        harray.append(gp_Pnt2d (7+ 5,5))

 

        anInterpolation = Geom2dAPI_Interpolate(harray,0,0.01)

        anInterpolation.Perform()

 

        SPL2 = anInterpolation.Curve()         

 

 

        harray2 = []

       

        harray2.append(gp_Pnt2d (11+ 0,0))

        harray2.append(gp_Pnt2d (11+ 1,2))

        harray2.append(gp_Pnt2d (11+ 2,3))

        harray2.append(gp_Pnt2d (11+ 4,3))

        harray2.append(gp_Pnt2d (11+ 5,5))

 

        anInterpolation2 = Geom2dAPI_Interpolate(harray2,1,0.01)

        anInterpolation2.Perform()

 

        SPL3 = anInterpolation2.Curve()         

 

        i = 0

        for P in array:

            i = i+1

            pstring = 'array'+`i`

            self.DisplayPoint(P,pstring,0,0,0,0.05)

 

        for P in harray:

            i = i+1

            pstring = 'harray'+`i`

            self.DisplayPoint(P,pstring,0,0,0,0.05)

       

        for P in harray2:

            i = i+1

            pstring = 'harray2'+`i`

            self.DisplayPoint(P,pstring,0,0,0,0.05)