pythonCascade Sample Problems

 Geometry: 3D curves from intersections

 

        P1 = gp_Pnt(-5,-5,0)                                        

        P2 = gp_Pnt(9,9,9)

        aCurve = GC_MakeSegment(P1,P2).Value()

        P3 = gp_Pnt(3,0,0)

        P4 = gp_Pnt(3,0,10)

        radius1 = 3

        radius2 = 2

 

        aSurface = GC_MakeConicalSurface(P3,P4,radius1,radius2).Value()  

        CS = GeomAPI_IntCS(aCurve,aSurface)

 

        if CS.IsDone():                                            

            NbSeg = CS.NbSegments()                          

            for k in range(1,NbSeg+1):            

                segment = CS.Segment(k)

                # do something with the segment                  

                                                           

        NbPoints = CS.NbPoints()

        for k in range(1,NbPoints+1):

            aPoint=CS.Point(k);                       

            # do something with the point                   

 

        self.DisplayCurve(aCurve,1)

 

        aTrimmedSurface= Geom_RectangularTrimmedSurface(aSurface,-50.,50.,0,1)

        self.DisplaySurface(aTrimmedSurface,1)

       

        if CS.IsDone():                                            

            NbSeg = CS.NbSegments()                          

            for k in range(1,NbSeg+1):            

                segment = CS.Segment(k)

                aCurve = ISession_Curve(segment)

                self.DisplayCurve(aTrimmedCurve,1)

       

        NbPoints = CS.NbPoints()

        for k in range(1,NbPoints+1):

            aPoint=CS.Point(k);                        

            self.DisplayPoint(aPoint,"P_"+`k`,0.1,0,0,0,0.5)