Patch default parameters

Hi all,

I am trying to implement a function to have the same outcome of the “Patch” command of the GUI.

This is the code I am using:

CRhinoGetObject gv;
	gv.SetCommandPrompt(L"Select obj");
	gv.GetObjects(1, 1);
	if (gv.CommandResult() != success)
		return gv.CommandResult();

    const CRhinoObject* obj = gv.Object(0).Object();
	ON_SimpleArray<const ON_Geometry*> input_geometry;
    int u_spans = 5;
    int v_spans = 5;
    bool bTrim = true;
    bool bTangency = true;
    double point_spacing = 1;
    double flexibility = 1;
    double surface_pull = 1;
    int false_edges[] = { 0, 0, 0, 0 };
    int true_edges[] = { 1, 1, 1, 1 };
    bool PreserveEdges = false;
    double tolerance = ::RhinoApp().ActiveDoc()->AbsoluteTolerance();
    const ON_Surface* StartingSurface = nullptr;

    if (obj) {
        const ON_Curve * curve = ON_Curve::Cast(obj->Geometry());
        if (curve)
        {
            input_geometry.Append(curve);
        }
    }

    ON_Brep* brepPatch =  CRhinoFitPatch::Fit(input_geometry, 
                                        StartingSurface,
                                        u_spans,
                                        v_spans,
                                        bTrim,
                                        bTangency,
                                        point_spacing,
                                        flexibility,
                                        surface_pull,
                                        PreserveEdges ? true_edges : false_edges,
                                        tolerance);

    if (brepPatch)
    {
        ::RhinoApp().ActiveDoc()->AddBrepObject(*brepPatch);
    }

The problem is that, although I have tried some combination of the parameters, I cannot get the same outcome of the Patch command for complex curves. Does anyone know more about it?
Thanks

Gennaro

Hi @gennaro,

Can you post a 3dm file that contains the geometry you want to patch, along with a screen capture of the Patch dialog with the setting you are using?

Thanks,

– Dale

Here you can see that the outcome is different:

Here the default values:

Here the file with the curve:
patch.3dm (18.4 KB)

Hi @gennaro,

I can see that the Patch command in Rhino 6 no longer uses the code behind CRhinoFitPatch::Fit. Thus, it won’t be possible to produce the same surface in Rhino 6 using this function. I’ve logged the issue.

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

Thanks,

– Dale