Determine if Rhino.Geometry.Transform is a scaling operation?

(RhinoCommon C#)

I am attempting to store object attribute UserData which tracks the scaling of an object since its import.

Is it possible to determine whether or not a Transform struct represents a scaling operation?
Or is it possible to extract the scaling factor from a Transform struct which represents a series of transformations?

You can check whether a transform is rigid or not using RigidType. A rigid transform only consist of translation and/or rotation.

private void RunScript(Transform x, ref object A, ref object B)
{
  Vector3d translation, diagonal;
  Transform rotation, orthogonal;
  x.DecomposeAffine(out translation, out rotation, out orthogonal, out diagonal);
  A = x.RigidType != TransformRigidType.Rigid;
  B = diagonal;
}

IsScale.gh (11.1 KB)

Thanks!