I am trying to merge two curves as one using BooleanUnion function in rhino common.
Curve.CreateBooleanUnion(Curves, doc.ModelAbsoluteTolerance);
It works for most scenarios, but for some reasons its not working for some curves.
I am trying to merge two curves as one using BooleanUnion function in rhino common.
Curve.CreateBooleanUnion(Curves, doc.ModelAbsoluteTolerance);
It works for most scenarios, but for some reasons its not working for some curves.
Hi!
Control that both curves are in the same plane and intersecting each other. Otherwise, can you share a 3d file with the curves that are not working?
curve.3dm (33.0 KB)
sample file
added sample file in the thread
Hi @hariprazath,
This simple Python script seems to work on the curve in your sample file.
import Rhino
import scriptcontext as sc
def test_curve_booolean_union():
filter = Rhino.DocObjects.ObjectType.Curve
rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects("Select curves", False, filter)
if rc != Rhino.Commands.Result.Success:
return
if not objrefs:
return
in_curves = []
for objref in objrefs:
curve = objref.Curve()
if curve:
in_curves.append(curve)
if len(in_curves) < 2:
return
tolerance = sc.doc.ModelAbsoluteTolerance
out_curves = Rhino.Geometry.Curve.CreateBooleanUnion(in_curves, tolerance)
if out_curves:
for curve in out_curves:
id = sc.doc.Objects.AddCurve(curve)
rh_obj = sc.doc.Objects.Find(id)
if rh_obj:
rh_obj.Select(True)
sc.doc.Views.Redraw()
if( __name__ == "__main__" ):
test_curve_booolean_union()
What are we missing?
– Dale