Sketchup C Api SUTransformationGetOrigin

I just tried the latest C SDK (SDK_WIN_x64_2021-1-279)
The SUTransformationSetFromPointAndAxes() function will adjust the given point?
see the below example, the retrieved value is (-100,-200,0) instead of the given (100,200,0).
how to solve the issue?

SUPoint3D origin{};
origin.x = 100;
origin.y = 200;
origin.z = 0;

SUVector3D xAxis{};
xAxis.x = 1.0;
xAxis.y = 0.0;
xAxis.z = 0.0;

SUVector3D yAxis{};
yAxis.x = 0.0;
yAxis.y = 1.0;
yAxis.z = 0.0;

SUVector3D zAxis{};
zAxis.x = 0.0;
zAxis.y = 0.0;
zAxis.z = 1.0;

SUTransformation trans{};
SUTransformationSetFromPointAndAxes(&trans, &origin, &xAxis, &yAxis, &zAxis);

//get the origin
SUPoint3D retrieved{};
SUTransformationGetOrigin(&trans, &retrieved);

The origin of the axis is not the same as the point given in SUTransformationSetFromPointAndAxes.

When you provide (100,200,0) to SUTransformationSetFromPointAndAxes that means the point will become the new 0, 0, 0 when you apply the transformation, thus the transformation includes a translation in the direction of -100,-200,0.

If you need to obtain the point given to SUTransformationSetFromPointAndAxes you’d need to take the inverse transformation and use SUTransformationGetOrigin.

I just realized our Ruby and C API is inconsistent. The Ruby API behaves as you expected.

tr =, Y_AXIS, Z_AXIS, [100, 200, 0])
Point3d(100, 200, 0)
tr2 = Geom::Transformation.axes([100, 200, 0], X_AXIS, Y_AXIS, Z_AXIS)
Point3d(100, 200, 0)

I’m not sure why the C API ended up with this behaviour. Found this comment in the implementation:

    // Negate the point so the explanation of what the method does is correct
    *cpoint *= -1.0;

An unfortunate inconsistency. I’ll write up a ticket to clarify the effect in the documentation.


thanks for the clarification.