gp_Trsf

Hi All:
I am trying to save the relative data about gp_Trsf into the OCAF. I have found TDataStd_CoordSys that can be done. Unfortunately, I find the TDataStd_CoordSys.cxx without TDataStd_CoordSys.hxx. In the TDataStd_CoordSys.cxx, there is TopLoc_location that is relative with gp_Trsf. Now, I am stuck. Does anyone give me any suggestion? Thanks a lot.

Best regards,
Shawn

Sandor Racz's picture

Indeed, the header file is not there. What if you would just create one ?

Shawn Yang's picture

Hi:
I have a current document that link with other Document(s). If there are shapes that are changed or modified in certain Document. I can update the shape in the current Document at once. Then, I can get the record(like gp_Trsf) to translate, mirror or scale the shape(s) to be at the same location or same size. That is what I am doing. Thanks for your response.

Best regards,
Shawn

Serge's picture

Hi Shawn,

You can store gp_Trsf as a TopoDS_Shape location. That is
TopLoc_Location. It has a constructor which initialized by
gp_Trsf. The TopoDS_Shape can be easily saved using TNaming_NamedShape attribute.

Regards,
Serge

Shawn Yang's picture

Dear Serge:
Nice talk to you, again.

I know using TopLoc_Location that can be retrieved from TopoDS_Shape using TNaming_NamedShape attribute. But, if I want to reset(modify) the old TopoDS_Shape in the label and according to the TopLoc_Location of the old TopoDS_Shape to reset the new TopoDS_Shape that must have the same locatin or size. How?

I think it may be as following:
Handle(TNaming_NamedShape) TNS;
if (!L.FindAttribute(TNaming_NamedShape::GetID(), TNS)) continue;
TopoDS_Shape aShape = TNaming_Tool::GetShape(TNS);
TopLoc_Location aLocation = aShape.Location();
aNewShape.Location(aLocation);
TNaming_Builder B(L);
B.Modify( aShape, aNewShape);

If I have done some mirror, rotation or scale for old TopoDS_Shape. I think those should be included in TopLoc_Location. Am I right? I need suggestion. Thanks a lot.

PS. I haven't tested the above program. I will do later. But, I just wonder that ...

Best regards,
Shawn

Serge's picture

Hi Shawn,

That should work but more correct would be

B.Modify(aShape, aShape.Moved(aLocation)); as it takes into
account the current location of the shape, so you just apply
a translation(rotation,mirror) on the existent shape that is already located somewhere.

Regards,
Sergey