Transform Method

How should I define the argument, guid, when I use the transform method in a foreach statement?

Guid IndexTest = ///???///

foreach (Curve Item in curves)
{
 :
 :
 :
 Transform transformA = Transform.Translation(move);
 Transform transformB = Transform.Scale(center, radius);
 Transform transformC = Transform.PlaneToPlane(planeA, planeB);
 Guid testA = doc.Objects.Transform(///guid, transform, bool///);
 Guid testB = doc.Objects.Transform(///guid, transform, bool///);
 Guid testC = doc.Objects.Transform(///guid, transform, bool///);
 ids.Add(testC);
 doc.Views.Redraw();
}

if your curves are document objects, it would be Curve.Id

That apparently causes an error.

I was assuming your curves are curve objects. Is this not the case?

When transforming document objects just pass them directly into the doc.Objects.Transform function: one if the overloads take RhinoObject as argument.

If your curves are not yet in the document you can use the Transform method on Curve: Curve Class or the other functions Rotate, Scale, Translate…

Is this the same idea?

A BrepObject is derived from the same RhinoObject baseclass as the CurveObject, so yes, same idea.

Hi @jack3,

You might consider doing something like this:

foreach (var curve in curves)
{
  var xf_move = Transform.Translation(move);
  var xf_rotate = Transform.PlaneToPlane(planeA, planeB);
  var xf_scale = Transform.Scale(center, radius);
  var xf_final = xf_move * xf_rotate * xf_scale;
  if (xf_final.IsValid)
  {
    var new_curve = curve.DuplicateCurve();
    if (new_curve.Transform(xf_final))
    {
      doc.Objects.AddCurve(new_curve);
    }
  }
}
doc.Views.Redraw();

– Dale