TransformationLike
TransformationLike =
Transformation|SketchupTransform|TransformationIdentity|TransformationScaleLike|TransformationTranslationLike
Any value that can be interpreted as a transformation.
Many API methods accept a TransformationLike so you can pass
whichever representation is most convenient:
- A
Transformationinstance - A 16-element number array (column-major 4x4 matrix)
nullfor the identity (no change)- A single number for uniform scaling
- A
Point3LikeorVector3Likefor translation
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let { Transformation } = SketchUpApi;
// ComponentInstance.transform accepts a// TransformationLike, so all of these work:let asInstance = Transformation.translation([10, 0, 0]);let asArray = [0, 0, 0]; // translation shorthandlet asScale = 2; // uniform scalelet asNull = null; // identity (no-op)
// Read a group's current transformlet groups = await model.entities.get( { filterBy: { types: ['Group'] } });if (groups.length > 0) { console.log(groups[0].transform.origin.toArray());}