Boolean operation problem

I have following code:
gp_Pnt P1(1,0,0), P2(3,0,0),P3(1,0,0),P4(10,0,0);

TopoDS_Edge E1 =BRepBuilderAPI_MakeEdge(P1,P2);
TopoDS_Edge E2 =BRepBuilderAPI_MakeEdge(P3,P4);

TopoDS_Shape S =BRepAlgoAPI_Common(E1,E2);

Standard_Integer N =S.ShapeType();

#### Code End #####

and I assume the value for S.ShapeType()=6, that is an Edge(actually should be E1), but actually, I get value 0, that means it returns a Compound Shapetype, Could you help me to understand Why?

thanks.

S. Routelous's picture

Hi,

In your case ( after trying in DRAW ), the common doesn't work:
vertex v1 1 0 0
vertex v2 3 0 0
vertex v3 1 0 0
vertex v4 10 0 0
edge e1 v1 v2
edge e2 v3 v4
common res e1 e2
whatis res
-> compound
dump res
-> it is empty

I think the boolean operations are not done to do thing like that, but more working with solids of face-based shapes.

You have to keep in mind that it can be a compound with only one edge.

I've already seen that in the case of a fuse of a sphere and a box.
With the Test Harness, you can try:
box b 10 10 10
psphere s 3
fuse res b s
whatis res
-> output : COMPOUND
explode res
-> output res_1
whatis res_1
-> output SOLID

HTH,

Stephane