derived class of BRep_TFace

I need to associate some extra datas to the faces. Using the DatMapOfShape stuff is not sufficient. I don't want to look up a table all the time for all the faces (vertices, etc.). The memory requirement seemed to increase a lot by those maps. So i've created an ABrep_TFace. It has a constructor that copies all the required information for BRep_TFace (Surface, Triangulation, etc.). I've also implemented a small class derived from TopoDS_Builder to convert the BRep_TFace to ABRep_TFace:

m_shape = p_shape;
TopExp_Explorer it(p_shape, TopAbs_FACE);
BRepTools_ReShape reShape;
for(; it.More(); it.Next()) {
TopoDS_Face f = TopoDS::Face(it.Current());
const Handle_BRep_TFace& brep = Handle_BRep_TFace::DownCast(f.TShape());
Handle_ABRep_TFace abrep = new ABRep_TFace(brep, c);
MakeShape(f, abrep);
TopoDS_Iterator it2(it.Current());
for(; it2.More(); it2.Next()) {
Add(f, it2.Value());
reShape.Replace(it.Current(), f);
m_shape = reShape.Apply(m_shape);

It seems to be working and the shape tree seems to be correct, but when i invoke a cut operation, the result is empty. More precisely: all the cut faces are gone and only the unchanged faces (with extended datastruct) remain.

I was prepared for that the, associated info will be lost during a Down_Cast and only the BREP_TFace part will remain. But i cannot figure out why the whole face is gone. Any suggestions??? Has anyone tried it before ?

Thank you: Z

Zoltan Gaal's picture

I've managed to correct this problem, but unfortunatelly the method won't work. During FaceSplit a new , empty TFace, and not the original TFace is EmptyCopy()-ed.

Is it palanned to modify the code that way? It'd give the lib a huge flexibility. (The same is valid for BrepBuilderAPI_Transform)

Jane Hu's picture

For the BrepBuilderAPI_Tranform issue, you have to use ModifiedShape() to find the new shape corresponding to the old one, then update it in your code structure.