Parametric TopoDS_Vertex using coordinate system


Does anyone have an example on how to build parametric geometry? For example, how to create a point on a coordinate system, and that if the coordinate system definition changes (say the origin), the point would follow? I'd assume the point would have to be of type TopoDS_Vertex but I don't see a container to push a coordinate system in this type. How would I proceed? Another example would be how to create a point on an existing curve by specifying a ratio (or unitary distance u), such that if the curve is modified the point would follow. My understanding is that Opencascade has this infrastructure of "data persistence". Thank you

Benjamin Bihler's picture

According to my knowledge TDF_Attributes may refer to each other and these references can be stored by the data persistence infrastructure. But whether such references may influence the appearance of some TDF_Attributes or whether attribute changes should trigger recomputations of other TDF_Attributes must be modeled and implemented by yourself.


mfregeau's picture

There is got to be a way already implemented, that's a lot of work. Maybe OCAF offers something. There are no guide on how to use this library with parametric geometry features or I don't know where to find this information.

Guido van Hilst not specified's picture

Hi Mimosa Olive,

I don't know exactly wat you mean? 

You can use TopoDS_Shape::Located(..) to transform a shape.

If you create a TopoDS_Vertex and apply a transformation to it. (use Located) you can get the transformed point back with: BRep_Tool::Pnt(vertex);

You can have a look here to see about transform a Vertex Example tarnsfomation

​If you want I can make example for parametric point on a curve and transformation?

Best regards, Guido

mfregeau's picture

Sorry for the confusion, I am not asking "how to do a point based on another point" but how to take advantage of the parametric features of opencascade. I am trying to understand opencascade to take advantage of the parametric geometry capabilities. I think what I want is take advantage of working with XCAFDoc_ShapeTool. So every main shape is "stored" into the XCAFDoc_ShapeTool of the working Document. Then if any new shape wants to use a reference of an existing shape stored in XCAFDoc_ShapeTool then it needs to use it as a reference. When XCAFDoc_ShapeTool process an Update (at the request of the user) then all shapes gets re-computed, and if a shape has used any reference, the referenced has to be computed first, as needed.

mfregeau's picture

I guess, I can ask, how to create a derived class based on TopoDS_Vertex? are there any methods I need to implement as mandatory such as "compute" or other ones? Any example of a derived class shape? (my guess is this way I can implement more point type such as "between 2 points" or "at center of circle" which would take existing shape as attributes, and spits out 'invalid' if the required attributes are not specified properly.

Lincoln Nxumalo's picture

Hi Mimosa,

Have a look at OCAF function mechanism white paper. It seems like what you are looking for.