gp_Trsf Problem

Hi there.
I am using gp_Trsf to set the Transformation of a shape. It works perfectly. For the case that a shape might (and mostly will) be transformed more then once, I am keeping Track of all Transformation by haven one gp_Trsf Variable for every Shape. When a new Transformation is applied to the Shape I just multiply the new Transformation with the Shape-Transformation-Variable so I that I have the chance to Save the Values of the gp_Trsf Variable to a file an reload it any time.

And here comes the thing:
If I reload the Values of the gp_Trsf Variable, I apply it as Transformation to the Shape. But the Shape is then NOT transformed to the Position it SHOULD have.

Any Idea what I am doing Wrong?

Here is some Code for you. (I am using my own C# Wrapper, so don't be confused by the Code. But it should be understandeble)

The following Function I use for applying a new Transformation to the shape an Multiply this Transformation with the Shapes gp_Trsf Variable.

void Transform(NET_gp_Trsf Transformation)
{
NET_BRepBuilderAPI_Transform Transform;

Transform = new NET_BRepBuilderAPI_Transform(this.m_T_Shape, Transformation);
this.m_T_Shape = Transform.Shape();
this.m_A_Shape.Set(this.m_T_Shape);
this.m_Transformation.Multiply(Transformation);
}

Btw.
When loading the Values of the Transformationmatrix, I use the function SetValues() for applying the Values. But as I don't know what the Parameters "Tolang" and "TolDist" mean I leave them with the Value 0.

So has anybody an Idea what I am doing wrong?

Evgeny Lodyzhehsky's picture

Dear Naehfix.

Have a look the file BRepTest_BasicCommands.cxx (function: transform)to
find out how to use gp_Trsf and BRepBuilderAPI_Transform.
IMHO using an absolute transformation is better than relative.
At least the approach it is less error-prone and more checkable.