The curve in the attached file causes MakeDeformable to fail.
To replicate,
- Use the command defined as follows:
using Rhino;
using Rhino.Commands;
using Rhino.DocObjects;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
namespace LayupRH.Commands
{
public class MyMakeDeformableTest : Command
{
public MyMakeDeformableTest()
{
Instance = this;
}
public static MyMakeDeformableTest Instance { get; private set; }
public override string EnglishName => "MyMakeDeformableTest";
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
using GetObject go = new();
go.SetCommandPrompt("Choose a curve");
go.GeometryFilter = ObjectType.Curve;
if (go.Get() == GetResult.Cancel)
{
return Result.Cancel;
}
Curve curve = go.Object(0).Curve();
if (curve.MakeDeformable())
{
RhinoApp.WriteLine("Successfully made deformable");
}
else
{
RhinoApp.WriteLine("Failed to make deformable");
}
Curve nurbsCurve = curve.ToNurbsCurve();
if (nurbsCurve != null)
{
RhinoApp.WriteLine("Successfully made into NURBS");
if (nurbsCurve.MakeDeformable())
{
RhinoApp.WriteLine("Successfully made NURBS curve deformable");
}
else
{
RhinoApp.WriteLine("Failed to make NURBS curve deformable");
}
}
else
{
RhinoApp.WriteLine("Failed to make into Nurbs");
}
return Result.Success;
}
}
}
- Open this file:
failedMakeDeformable.3dm (35.9 KB) - Call the
MyMakeDeformableTestcommand and select the curve
The result is that MakeDeformable fails on the original curve, but ToNurbsCurve succeeds and MakeDeformable succeeds on that NURBS curve. This is not the same problem found in RC MakeDeformable() question – the curve is internally an ArcCurve, but since the exposed type is Curve, it should be able to change the representation to something deformable without changing the type. Why does MakeDeformable fail on the curve instead of just calling ToNurbsCurve in this case? Is there an alternative to MakeDeformable that I can use more reliably?
Thanks,
- Russell