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