Re: [Pythonocc-users] Faces in common between two solids

2013-06-16 Thread Mark Blome

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


Re: [Pythonocc-users] Faces in common between two solids

2013-06-16 Thread Milos Davidovic
Have you tried using GEOMAlgo_Builder?

aBuilder = GEOMAlgo_Builder()
user_shapes = [donut, box]
for aShape in user_shapes:
aBuilder.AddShape(aShape)

aBuilder.Perform()

aBuilder should also have methods Generated, Modified, IsDeleted.
aBuilder.Shape() will have faces you are looking for.

Best regards,
Milos


On Sun, Jun 16, 2013 at 8:39 AM, Pablo Mosteiro  wrote:

> 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