BrepDuplicateEdgeCurves Method (Boolean) |
Namespace: Rhino.Geometry
using System; using Rhino.DocObjects; partial class Examples { public static Rhino.Commands.Result DupBorder(Rhino.RhinoDoc doc) { const ObjectType filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter; Rhino.DocObjects.ObjRef objref; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", false, filter, out objref); if (rc != Rhino.Commands.Result.Success || objref == null) return rc; Rhino.DocObjects.RhinoObject rhobj = objref.Object(); Rhino.Geometry.Brep brep = objref.Brep(); if (rhobj == null || brep == null) return Rhino.Commands.Result.Failure; rhobj.Select(false); Rhino.Geometry.Curve[] curves = brep.DuplicateEdgeCurves(true); double tol = doc.ModelAbsoluteTolerance * 2.1; curves = Rhino.Geometry.Curve.JoinCurves(curves, tol); for (int i = 0; i < curves.Length; i++) { Guid id = doc.Objects.AddCurve(curves[i]); doc.Objects.Select(id); } doc.Views.Redraw(); return Rhino.Commands.Result.Success; } }
import Rhino import scriptcontext def DupBorder(): filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", False, filter) if rc != Rhino.Commands.Result.Success: return rc rhobj = objref.Object() brep = objref.Brep() if not rhobj or not brep: return Rhino.Commands.Result.Failure rhobj.Select(False) curves = brep.DuplicateEdgeCurves(True) tol = scriptcontext.doc.ModelAbsoluteTolerance * 2.1 curves = Rhino.Geometry.Curve.JoinCurves(curves, tol) for curve in curves: id = scriptcontext.doc.Objects.AddCurve(curve) scriptcontext.doc.Objects.Select(id) scriptcontext.doc.Views.Redraw() return Rhino.Commands.Result.Success if __name__=="__main__": DupBorder()