RhinoCommon Transofrm.Scale() bug

Hi @henrydm,

Does this help?

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var rc = RhinoGet.GetOneObject("Select curve to scale non-uniformly", 
    false, 
    ObjectType.Curve, 
    out var obj_ref
    );

  if (rc != Result.Success)
    return rc;

  var curve = obj_ref.Curve();
  if (null == curve)
    return Result.Failure;

  var bbox = curve.GetBoundingBox(true);
  var plane = new Plane(bbox.Center, Vector3d.XAxis, Vector3d.YAxis);
  var xform = Transform.Scale(plane, 2, 1, 1);

  var curve_copy = curve.DuplicateCurve();

  // If not a similarity transformation, make sure geometry
  // can be deformed. Generally, this involves converting non-NURBS
  // geometry into NURBS geometry.
  if (xform.SimilarityType == TransformSimilarityType.NotSimilarity)
    curve_copy.MakeDeformable();

  if (curve_copy.Transform(xform) && curve_copy.IsValid)
  {
    doc.Objects.Add(curve_copy);
    doc.Views.Redraw();
  }

  return Result.Success;
}

– Dale

1 Like