Dear Pablo,

you could use BRepAlgoAPI_Cut and it's Generated/Modified methods to achieve 
this.
I am thinking of something along these lines:

a) Perform the cut using a halfspace:
        CutPln = gp_Pln(gp_Ax3(P0, gp_Dir(0,0,1)))
        CutPlnFace = BRepBuilderAPI_MakeFace(CutPln, -d, d, -d, d).Face() 
        aHalfSpace=BRepPrimAPI_MakeHalfSpace(CutPlnFace, P0).Solid()
        brepbuilder=BRepAlgoAPI_Cut(SolidToCut, aHalfSpace)    
        newShape= brepbuilder.Shape()
with appropriate values

b) Inspect the result:
        input_shapes=[SolidToCut, aHalfSpace]
        if brepbuilder.HasGenerated():
            print "HAS GENERATED"
            # shapes generated for input/tool-shape
            for in_shape in input_shapes:
                gen_shapes = brepbuilder.Generated(in_shape)
                itr = TopTools_ListIteratorOfListOfShape(gen_shapes)
                while itr.More():       
                    this = itr.Value()
                    print "Shape generated by cut is of type", this.ShapeType()
                    if this.ShapeType()==TopAbs_FACE:
                        # do something with this face   
                        pass
                    itr.Next()
            # shapes generated for the faces of input/tool-shape
            for in_shape in input_shapes:
                for face in Topo(in_shape).faces():
                    gen_shapes = brepbuilder.Generated(face)
                    itr = TopTools_ListIteratorOfListOfShape(gen_shapes)
                    while itr.More():
                        this = itr.Value()
                        if this.ShapeType()==TopAbs_FACE:
                                # do something with this face   
                                pass
                        itr.Next()
       
Depending on what you are interested in you also might want to look at 
brepbuilder.Modified()
and brepbuilder.IsDeleted() methods as well.

Hope this helps,
Mark



Am 16.06.2013 um 08:39 schrieb Pablo Mosteiro:

> I need to cut a solid in half and then have "access" to the plane in each
> solid that was generated by the cut. For instance, suppose the solid is a
> donut and I'm cutting it in half diametrically. I need "access" to the two
> circles that are formed by the cutting plane.
> 
> By "access" I mean know their location so that I can do something like draw
> dots on them.
> 
> Currently I'm making the cut by defining a box that is half the size of the
> original object and taking the common volume using BRepAlgoAPI_Common
> But then I don't have any knowledge of what are the planes generated by this
> cut.
> 
> Is anyone familiar with this? Can you give help, please?
> 
> Thanks!
> 
> Pablo
> 
> 
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users


_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to