I am preparing curves for a CNC.
Tolerances / Accuracy vs. Minimum Amount of Data / Points matter a lot.
I can only send Polylines to the machine.
I do not care about computation time.
Rhino s _convert command has a simplify Option.
_convert Equivalent
It looks like the functionality exposed in rhino’s _convert command is split into 3 Rhinocommon methods: Curve Simplify ToArcsAndLines ToPolyline
I am fine with that.
Or do I miss something ?
my main question:
If I use Curve Simplify combined with ToPolyline - what s the best practice handling tolerances ?
I have a fixed amount of deviation that is allowed for the conversion to Polyline (example: 0.01 mm)
If I pass a fixed amount of deviation / tolerance to Simplify first, (example: 0.005 mm)
and the remaining deviation / tolerance (example: 0.005 mm) to ToPolyline second.
The second step (toPolyline) does not get the full local potential of reducing the data, if simplify did not used the full deviation at a certain point.
does rhino’s _convert command handles tolerances more intelligent ?
if yes what s the concept ?
is it exposed to rhinoCommon ?
My guess: passing a smaller amount of the overall tolerance to simplify (example 0.002) and a bigger amount to ToPolyline (example 0.008) will give an acceptable general case…
Or shall I skip the simplify step, create a very dense Polyline (ToPolyline, tolerance 0.001) and then ReduceSegemtnes (tolerance 0.009).
It sounds like the _convert command would do everything you need it to do? If so, you could just use it via scripting and avoid having to reinvent anything.
public static Curve Simplify(RhinoDoc doc, Curve curve)
{
Guid id = doc.Objects.Add(curve);
RhinoApp.RunScript("_SelNone", false);
doc.Objects.Select(id);
RhinoApp.RunScript("_Convert S=Yes T=0.005 _enter", false);
// Code to find the new simple curve object
// Code to delete the simple curve object
return simpleCurve;
}
I try to keep as much geometry away from the document - and those curves will only be written to a cnc file.
I hate scripted methods - that will require the calling command has a “script-runner” attribute.
Any insights (my main question above) on how the overall tolerance is handled/distributed between the simplify and the toPolyline part of the _convert command ?
@dale thanks a lot for digging in.
if i play around “with my curves” (some of them are already polylines) in rhino using the _convert command - I get best results when the simplify=yes option is set.
does your answer mean, that Curve Simplify is always call behind the scenes when I call Curve.ToPolyline ? (no need for arcs…)
maybe I am just confused that the rhino command has a simplify yes/no option, while the rhino common command does not have a matching parameter…