Tue, 03/25/2003 - 02:15
Forums:
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
Tue, 03/25/2003 - 03:09
Indeed, the header file is not there. What if you would just create one ?
Tue, 03/25/2003 - 08:56
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
Tue, 03/25/2003 - 09:00
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
Tue, 03/25/2003 - 10:59
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
Tue, 03/25/2003 - 11:41
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