Hello,
I am trying to add some descriptive strings for each of the TopoDS_Shape as an attribute, such as id of the shape to the brep file. For example, instead of doing:
TShapes 35
Ve
1e-07
0 0 2
0 0
0101101
*
Ve
1e-07
...
I am trying to add lines as:
TShapes 35
Ve
1e-07
0 0 2
0 0
CGM_ATTRIB ENTITY_ID* * 4 -2147483648 -1 * *
*
0101101
*
Ve
1e-07
...
For this, I rewrote TopTools_ShapeSet.cxx function
void TopTools_ShapeSet::Read(Standard_IStream& IS)
in "read the shapes" block, after ReadGeometry(T,IS,S); I added a 'while' course
// Read Attributes and Set the flags
IS >> buffer; ----------original file line 717
while (buffer[0] == 'C')
{
ReadAttribute(S, IS,l_attr);
IS >> buffer;
}
// sub-shapes --------------original file line 719
TopoDS_Shape SS;
In which I read in the string started with specific character not recognizable by occ code.
It's running fine, and it's easy to embed the attributes just in the brep file. However, since I added code in TopTools_ShapeSet.cxx, without changing in opencascade side, other software won't be able to read files with such string characters. Like Salome can't port such brep file to it.
I am wondering if it's an good practice for opencascade to add a virtual function of ReadAttribute(TopoDS_Shape& S,Standard_IStream& IS), to ignore all strings that are not recognizable from the opencascade, and others can derive classes which implement this method if necessary?
Another thought is: I am also aware that using OCAF, we can generate new attribute by inherite class from TDF_Attribute. I haven't used OCAF yet, so from user's guide, I understand that we need to create a separate document for the Attributes based on each shape and subshape, my question is, is this document going to be stand along with brep file? So after read in brep file, we need to open the document and read/add the attributes? or we can omit the part of generating a brep file and store everything in the document? I have downloaded some brep file, so knew the data structure of it. I haven't found any document which contains either all info for geometry+attributes, or just the shapes+attributes which goes with a certain brep file. Can someone if you happen to have such a ducument, send an example of it, so I can clear my mind on this?
Thank you so much for your possible help!([email removed])
Jane