Patch different result Rhino Command and C#

Good day,

We somehow get different results when we use the Rhino Command Patch with the same settings and the C# command. Hereby an example, from left to right, input geometry, Rhino Patch Command, C# Result:

Hereby the Patch settings:
image

Hereby the Rhino File:
PatchBug_.3dm (230.3 KB)

And the C# code, select the Polyline + Mesh and run it in a C# command:

var selObj = doc.Objects.GetSelectedObjects(true, true).ToArray();

Rhino.Geometry.Curve c = null;
Rhino.Geometry.Mesh m = null;
foreach(var o in selObj)
{
    switch (o.ObjectType)
    {
        case ObjectType.Curve:
            c = (Rhino.Geometry.Curve)o.Geometry;
            break;
        case ObjectType.Mesh:

            m = (Rhino.Geometry.Mesh) o.Geometry;
            break;
    }
}

var ml = m.SplitDisjointPieces();
var geobase = new List<GeometryBase>();
geobase.Add(c);
geobase.AddRange(ml);

// create patch
Brep patchBr = Brep.CreatePatch(geobase.ToArray(), null, 25, 75, true, true, 1, 11, 0.001, new bool[] { false, false, false, false }, 0.001);
if (patchBr == null)
{
    return Result.Success;
}

doc.Objects.AddBrep(patchBr);
return Result.Success;

Just ignore the part where I split the disjoint mesh, because I tested it to see what happens, but same result.

Any ideas?

Regards,

Jordy

Hi @Jordy,

I’ve logged an issue so I can remember to dig into this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-75169

Thanks,

– Dale

Hi @dale ,

Any tips or tricks for a work around to get this working? To get the same result as in Rhino? Do you do something specifically before the Rhino command?

Just thinking out loud to help our users as well.

Regards,

Jordy

Instead of using _Patch’s Stiffness value as an argument for CreatePatch’s flexibility parameter, try the reciprocal.