compound - TopoDS_Shape

Good day to everyone on that forum,

I most recently encountered an unexplainable problem:

I tried to add a Polygon to a Compound. here is the code:

TopoDS_Compound myComp;
BRep_Builder myBuild;

myBuild.add(myComp,myPolygon.Shape()); // this instruction causes compiler-problems

The gcc 2.95.3 compiler then says:
no matching function for call to `BRep_Builder::add (TopoDS_Compound &, const TopoDS_Shape &)'

A quick look at the classbrowser shows, that there is no add-method within the BRep_Builder-class but rather higher inside the inheritance tree TopoDS_Build, which in turn does have an add-method that is defined like this:

void TopoDS_Builder::Add(TopoDS_Shape& S,const TopoDS_Shape& C) const

This should work, doesn`t it ? Why not ?

Am I missing something, or is it an undocumented bug ??

Sincerely and cluelessly


ekiroglu's picture


In "myBuild.add(myComp,myPolygon.Shape());", from which class is "myPolygon" derived? It should be derived from TopoDS_Shape or TopoDS_Edge, etc. class...

Best Regards


e3dfx's picture

myPolygon is an BRepBuilderAPI_MakePolygon object.
And BRepBuilderAPI_MakePolygon is derived from BRepBuilderAPI_MakeShape. This one has a Shape()-method that returns a const TopoDS_Shape&.

I do not understand it. You insert the correct object-type, but the compiler still malfunctions.
This is totally not logic.


C R Johnson's picture

Check your case:

Add(...) and add(...) are not the same function.

e3dfx's picture

Oh yes, that was it ! Many thanks.