New parametric CAD plugin

I am new to OpenCASCADE, and I would like
to get some suggestions about a project.
I already implemented a mechanical-simulation
plugin for a 3D rendering software (my plugin
is called Chrono, you can see info in, but now I realize that
I would need more advanced modelling tools in that
rendering software (Realsoft3D, it is just a rendering sw, not a CAD). Then, I would like to make another plugin which introduces parametric modeling like in 3D CADs, and I would like to
use OpenCASCADE for this.
Realsoft3D has a complete API for adding
custom objects. I could implement my own objects in scene (the 'mechanical parts'): each would encapsulate an handle to a TopoDS_Shape object. The host sw requires serialization and copying of scene objects: ok, it is straightforward to do so also for the encapsulated TopoDS_Shape.
BUT... a problem! How could I make unique references to edges, faces, vertexes of a
TopoDS_Shape? (needed for making constraints,
to mark something as selected, etc.)
Well, I understand that I could use the 'label' mechanism of the OCAF, but it is not very clear to me... If I use OCAF, then my 'mechanical parts' objects should encapsulate an OCAF
project each, that is a TDocStd_Document, true?
I am asking this because I fear that the
OCAF framework may be too complex and
cpu intensive for my simple requirement (attaching labels or unique IDs to edges,vetexes
and faces of some TopoDS_Shape objects).

I hope that someone could sugest a simple
way to reference edges/vertexes without
setting up a complete OCAF application object.
Is it possible?

best regards


Rob Bachrach's picture

Well, I don't know if this is better than OCAF,
but this is what I did...

Your in-session data simply stores a TopoDS_Shape.
Since this uses shared memory, it will directly
refer to the edge/face/vertex in which you are

Then, when serializing your geometry, use
BRepTools_ShapeSet. Since this is derived from
TopTools_ShapeSet, you can use the Write and Read
functions to write the stored TopoDS_Shape reference. When reading these back in, the
references are reconstructed correctly.