From 5d773cb73f07586242fa14f9534a068045da8ba5 Mon Sep 17 00:00:00 2001 From: Bozo Date: Wed, 13 Sep 2023 21:37:39 +0000 Subject: [PATCH] publish source from github.com/mcneel/rhino v8.0.23255.13163-beta --- quasar_site/src/api_examples.json | 255 +++++++++++++++--------------- 1 file changed, 127 insertions(+), 128 deletions(-) diff --git a/quasar_site/src/api_examples.json b/quasar_site/src/api_examples.json index 87979d8e..0d999bc0 100644 --- a/quasar_site/src/api_examples.json +++ b/quasar_site/src/api_examples.json @@ -1,5 +1,4 @@ [ - { "name": "Activeviewport.cs", "code": "partial class Examples\n{\n public static Rhino.Commands.Result ActiveViewport(Rhino.RhinoDoc doc)\n {\n Rhino.Display.RhinoView view = doc.Views.ActiveView;\n if (view == null)\n return Rhino.Commands.Result.Failure;\n\n Rhino.Display.RhinoPageView pageview = view as Rhino.Display.RhinoPageView;\n if (pageview != null)\n {\n string layout_name = pageview.PageName;\n if (pageview.PageIsActive)\n {\n Rhino.RhinoApp.WriteLine(\"The layout {0} is active\", layout_name);\n }\n else\n {\n string detail_name = pageview.ActiveViewport.Name;\n Rhino.RhinoApp.WriteLine(\"The detail {0} on layout {1} is active\", detail_name, layout_name);\n }\n }\n else\n {\n string viewport_name = view.MainViewport.Name;\n Rhino.RhinoApp.WriteLine(\"The viewport {0} is active\", viewport_name);\n }\n return Rhino.Commands.Result.Success;\n }\n}\n", @@ -23,10 +22,10 @@ ["Rhino.Input.Custom.GetNumber", "GetNumber()"], ["Rhino.Input.Custom.GetNumber", "GetResult Get()"], ["Rhino.Input.Custom.GetNumber", "System.Void SetLowerLimit(System.Double lowerLimit, System.Boolean strictlyGreaterThan)"], + ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.Input.Custom.GetBaseClass", "Result CommandResult()"], ["Rhino.Input.Custom.GetBaseClass", "System.Double Number()"], ["Rhino.Input.Custom.GetBaseClass", "RhinoView View()"], - ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoView ActiveView"] ] }, @@ -61,8 +60,8 @@ "name": "Addclippingplane.cs", "code": "using System;\n\npartial class Examples\n{\n public static Rhino.Commands.Result AddClippingPlane(Rhino.RhinoDoc doc)\n {\n // Define the corners of the clipping plane\n Rhino.Geometry.Point3d[] corners;\n Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetRectangle(out corners);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n\n // Get the active view\n Rhino.Display.RhinoView view = doc.Views.ActiveView;\n if (view == null)\n return Rhino.Commands.Result.Failure;\n\n Rhino.Geometry.Point3d p0 = corners[0];\n Rhino.Geometry.Point3d p1 = corners[1];\n Rhino.Geometry.Point3d p3 = corners[3];\n\n // Create a plane from the corner points\n Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(p0, p1, p3);\n\n // Add a clipping plane object to the document\n Guid id = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID);\n if (id != Guid.Empty)\n {\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n return Rhino.Commands.Result.Failure;\n }\n}\n", "members": [ - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.FileIO.File3dmObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"], + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.Input.RhinoGet", "static Result GetRectangle(out Point3d[] corners)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"] ] @@ -71,9 +70,9 @@ "name": "Addcylinder.cs", "code": "partial class Examples\n{\n public static Rhino.Commands.Result AddCylinder(Rhino.RhinoDoc doc)\n {\n Rhino.Geometry.Point3d center_point = new Rhino.Geometry.Point3d(0, 0, 0);\n Rhino.Geometry.Point3d height_point = new Rhino.Geometry.Point3d(0, 0, 10);\n Rhino.Geometry.Vector3d zaxis = height_point - center_point;\n Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(center_point, zaxis);\n const double radius = 5;\n Rhino.Geometry.Circle circle = new Rhino.Geometry.Circle(plane, radius);\n Rhino.Geometry.Cylinder cylinder = new Rhino.Geometry.Cylinder(circle, zaxis.Length);\n Rhino.Geometry.Brep brep = cylinder.ToBrep(true, true);\n if (brep != null)\n {\n doc.Objects.AddBrep(brep);\n doc.Views.Redraw();\n }\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"], ["Rhino.Geometry.Cylinder", "Cylinder(Circle baseCircle, double height)"], - ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"], - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"] + ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"] ] }, { @@ -99,14 +98,14 @@ "name": "Addlayout.cs", "code": "partial class Examples\n{\n /// \n /// Generate a layout with a single detail view that zooms to a list of objects\n /// \n /// \n /// \n public static Rhino.Commands.Result AddLayout(Rhino.RhinoDoc doc)\n {\n doc.PageUnitSystem = Rhino.UnitSystem.Millimeters;\n var page_views = doc.Views.GetPageViews();\n int page_number = (page_views==null) ? 1 : page_views.Length + 1;\n var pageview = doc.Views.AddPageView(string.Format(\"A0_{0}\",page_number), 1189, 841);\n if( pageview!=null )\n {\n Rhino.Geometry.Point2d top_left = new Rhino.Geometry.Point2d(20,821);\n Rhino.Geometry.Point2d bottom_right = new Rhino.Geometry.Point2d(1169, 20);\n var detail = pageview.AddDetailView(\"ModelView\", top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top);\n if (detail != null)\n {\n pageview.SetActiveDetail(detail.Id);\n detail.Viewport.ZoomExtents();\n detail.DetailGeometry.IsProjectionLocked = true;\n detail.DetailGeometry.SetScale(1, doc.ModelUnitSystem, 10, doc.PageUnitSystem);\n // Commit changes tells the document to replace the document's detail object\n // with the modified one that we just adjusted\n detail.CommitChanges();\n }\n pageview.SetPageAsActive();\n doc.Views.ActiveView = pageview;\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n return Rhino.Commands.Result.Failure;\n }\n}\n", "members": [ - ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], - ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.RhinoObject", "System.Boolean CommitChanges()"], - ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.Display.RhinoPageView", "DetailViewObject AddDetailView(System.String title, Geometry.Point2d corner0, Geometry.Point2d corner1, DefinedViewportProjection initialProjection)"], ["Rhino.Display.RhinoPageView", "System.Boolean SetActiveDetail(System.Guid detailId)"], ["Rhino.Display.RhinoPageView", "System.Void SetPageAsActive()"], + ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.RhinoDoc", "UnitSystem PageUnitSystem"], + ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], + ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView AddPageView(System.String title, System.Double pageWidth, System.Double pageHeight)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView[] GetPageViews()"] ] @@ -117,12 +116,12 @@ "members": [ ["Rhino.Geometry.Vector2d", "System.Boolean IsTiny(System.Double tolerance)"], ["Rhino.Geometry.Vector3d", "System.Boolean IsTiny(System.Double tolerance)"], - ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.Input.Custom.GetPoint", "GetPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Void DrawLineFromPoint(Point3d startPoint, System.Boolean showDistanceInStatusBar)"], ["Rhino.Input.Custom.GetPoint", "GetResult Get()"], ["Rhino.Input.Custom.GetPoint", "System.Void SetBasePoint(Point3d basePoint, System.Boolean showDistanceInStatusBar)"], + ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddLine(Point3d from, Point3d to)"] ] }, @@ -138,8 +137,8 @@ "name": "Addlineardimension2.cs", "code": "using System;\nusing Rhino.Geometry;\n\npartial class Examples\n{\n public static Rhino.Commands.Result AddLinearDimension2(Rhino.RhinoDoc doc)\n {\n Point3d origin = new Point3d(1,1,0);\n Point3d offset = new Point3d(11,1,0);\n Point3d pt = new Point3d((offset.X-origin.X)/2,3,0);\n\n Plane plane = Plane.WorldXY;\n plane.Origin = origin;\n\n double u,v;\n plane.ClosestParameter(origin, out u, out v);\n Point2d ext1 = new Point2d(u, v);\n\n plane.ClosestParameter(offset, out u, out v);\n Point2d ext2 = new Point2d(u, v);\n\n plane.ClosestParameter(pt, out u, out v);\n Point2d linePt = new Point2d(u, v);\n\n LinearDimension dimension = new LinearDimension(plane, ext1, ext2, linePt);\n if (doc.Objects.AddLinearDimension(dimension) != Guid.Empty)\n {\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n return Rhino.Commands.Result.Failure;\n }\n}\n", "members": [ - ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"], - ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"] + ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"], + ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"] ] }, { @@ -207,12 +206,12 @@ "name": "Addradialdimension.cs", "code": "using Rhino;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\nusing Rhino.Geometry;\nusing Rhino.Input;\n\nnamespace examples_cs\n{\n public class AddRadialDimensionCommand : Rhino.Commands.Command\n {\n public override string EnglishName\n {\n get { return \"csAddRadialDimension\"; }\n }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n ObjRef obj_ref;\n var rc = RhinoGet.GetOneObject(\"Select curve for radius dimension\", \n true, ObjectType.Curve, out obj_ref);\n if (rc != Result.Success)\n return rc;\n double curve_parameter;\n var curve = obj_ref.CurveParameter(out curve_parameter);\n if (curve == null)\n return Result.Failure;\n\n if (curve.IsLinear() || curve.IsPolyline())\n {\n RhinoApp.WriteLine(\"Curve must be non-linear.\");\n return Result.Nothing;\n }\n\n // in this example just deal with planar curves\n if (!curve.IsPlanar())\n {\n RhinoApp.WriteLine(\"Curve must be planar.\");\n return Result.Nothing;\n }\n\n var point_on_curve = curve.PointAt(curve_parameter);\n var curvature_vector = curve.CurvatureAt(curve_parameter);\n var len = curvature_vector.Length;\n if (len < RhinoMath.SqrtEpsilon)\n {\n RhinoApp.WriteLine(\"Curve is almost linear and therefore has no curvature.\");\n return Result.Nothing;\n }\n\n var center = point_on_curve + (curvature_vector/(len*len));\n Plane plane;\n curve.TryGetPlane(out plane);\n var radial_dimension = \n new RadialDimension(center, point_on_curve, plane.XAxis, plane.Normal, 5.0);\n doc.Objects.AddRadialDimension(radial_dimension);\n doc.Views.Redraw();\n return Result.Success;\n }\n }\n}", "members": [ + ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.Geometry.Curve", "Vector3d CurvatureAt(System.Double t)"], ["Rhino.Geometry.Curve", "System.Boolean IsLinear()"], ["Rhino.Geometry.Curve", "System.Boolean IsPlanar()"], ["Rhino.Geometry.Curve", "System.Boolean IsPolyline()"], ["Rhino.Geometry.Curve", "Point3d PointAt(System.Double t)"], - ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddRadialDimension(RadialDimension dimension)"] ] }, @@ -244,10 +243,10 @@ "name": "Addtruncatedcone.cs", "code": "using System;\nusing Rhino.Geometry;\n\npartial class Examples\n{\n public static Rhino.Commands.Result AddTruncatedCone(Rhino.RhinoDoc doc)\n {\n Point3d bottom_pt = new Point3d(0,0,0);\n const double bottom_radius = 2;\n Circle bottom_circle = new Circle(bottom_pt, bottom_radius);\n\n Point3d top_pt = new Point3d(0,0,10);\n const double top_radius = 6;\n Circle top_circle = new Circle(top_pt, top_radius);\n\n LineCurve shapeCurve = new LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0));\n Line axis = new Line(bottom_circle.Center, top_circle.Center);\n RevSurface revsrf = RevSurface.Create(shapeCurve, axis);\n Brep tcone_brep = Brep.CreateFromRevSurface(revsrf, true, true);\n if( doc.Objects.AddBrep(tcone_brep) != Guid.Empty )\n {\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n return Rhino.Commands.Result.Failure;\n }\n}\n", "members": [ - ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], - ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"], ["Rhino.Geometry.RevSurface", "static RevSurface Create(Curve revoluteCurve, Line axisOfRevolution)"], - ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"] + ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], + ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"], + ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"] ] }, { @@ -282,11 +281,11 @@ "code": "using Rhino;\n\n[System.Runtime.InteropServices.Guid(\"3CDCBB20-B4E4-4AB6-B870-C911C7435BD7\")]\npublic class ArrayByDistanceCommand : Rhino.Commands.Command\n{\n public override string EnglishName\n {\n get { return \"cs_ArrayByDistance\"; }\n }\n \n double m_distance = 1;\n Rhino.Geometry.Point3d m_point_start;\n protected override Rhino.Commands.Result RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode)\n {\n Rhino.DocObjects.ObjRef objref;\n var rc = Rhino.Input.RhinoGet.GetOneObject(\"Select object\", true, Rhino.DocObjects.ObjectType.AnyObject, out objref);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n\n rc = Rhino.Input.RhinoGet.GetPoint(\"Start point\", false, out m_point_start);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n\n var obj = objref.Object();\n if (obj == null)\n return Rhino.Commands.Result.Failure;\n\n // create an instance of a GetPoint class and add a delegate\n // for the DynamicDraw event\n var gp = new Rhino.Input.Custom.GetPoint();\n gp.DrawLineFromPoint(m_point_start, true);\n var optdouble = new Rhino.Input.Custom.OptionDouble(m_distance);\n bool constrain = false;\n var optconstrain = new Rhino.Input.Custom.OptionToggle(constrain, \"Off\", \"On\");\n gp.AddOptionDouble(\"Distance\", ref optdouble);\n gp.AddOptionToggle(\"Constrain\", ref optconstrain);\n gp.DynamicDraw += ArrayByDistanceDraw;\n gp.Tag = obj;\n while (gp.Get() == Rhino.Input.GetResult.Option)\n {\n m_distance = optdouble.CurrentValue;\n if (constrain != optconstrain.CurrentValue)\n {\n constrain = optconstrain.CurrentValue;\n if (constrain)\n {\n var gp2 = new Rhino.Input.Custom.GetPoint();\n gp2.DrawLineFromPoint(m_point_start, true);\n gp2.SetCommandPrompt(\"Second point on constraint line\");\n if (gp2.Get() == Rhino.Input.GetResult.Point)\n gp.Constrain(m_point_start, gp2.Point());\n else\n {\n gp.ClearCommandOptions();\n optconstrain.CurrentValue = false;\n constrain = false;\n gp.AddOptionDouble(\"Distance\", ref optdouble);\n gp.AddOptionToggle(\"Constrain\", ref optconstrain);\n }\n }\n else\n {\n gp.ClearConstraints();\n }\n }\n }\n\n if (gp.CommandResult() == Rhino.Commands.Result.Success)\n {\n m_distance = optdouble.CurrentValue;\n var pt = gp.Point();\n var vec = pt - m_point_start;\n double length = vec.Length;\n vec.Unitize();\n int count = (int)(length / m_distance);\n for (int i = 1; i < count; i++)\n {\n var translate = vec * (i * m_distance);\n var xf = Rhino.Geometry.Transform.Translation(translate);\n doc.Objects.Transform(obj, xf, false);\n }\n doc.Views.Redraw();\n }\n\n return gp.CommandResult();\n }\n\n // this function is called whenever the GetPoint's DynamicDraw\n // event occurs\n void ArrayByDistanceDraw(object sender, Rhino.Input.Custom.GetPointDrawEventArgs e)\n {\n Rhino.DocObjects.RhinoObject rhobj = e.Source.Tag as Rhino.DocObjects.RhinoObject;\n if (rhobj == null)\n return;\n var vec = e.CurrentPoint - m_point_start;\n double length = vec.Length;\n vec.Unitize();\n int count = (int)(length / m_distance);\n for (int i = 1; i < count; i++)\n {\n var translate = vec * (i * m_distance);\n var xf = Rhino.Geometry.Transform.Translation(translate);\n e.Display.DrawObject(rhobj, xf);\n }\n }\n}\n", "members": [ ["Rhino.Display.DisplayPipeline", "System.Void DrawObject(DocObjects.RhinoObject rhinoObject, Transform xform)"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"], ["Rhino.Input.Custom.GetPoint", "object Tag"], ["Rhino.Input.Custom.GetPoint", "System.Void ClearConstraints()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Point3d from, Point3d to)"], - ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"] + ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"] ] }, { @@ -300,9 +299,9 @@ "name": "Booleandifference.cs", "code": "using System.Collections.Generic;\nusing Rhino.Commands;\n\npartial class Examples\n{\n public static Rhino.Commands.Result BooleanDifference(Rhino.RhinoDoc doc)\n {\n Rhino.DocObjects.ObjRef[] objrefs;\n Result rc = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select first set of polysurfaces\",\n false, Rhino.DocObjects.ObjectType.PolysrfFilter, out objrefs);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n if (objrefs == null || objrefs.Length < 1)\n return Rhino.Commands.Result.Failure;\n\n List in_breps0 = new List();\n for (int i = 0; i < objrefs.Length; i++)\n {\n Rhino.Geometry.Brep brep = objrefs[i].Brep();\n if (brep != null)\n in_breps0.Add(brep);\n }\n\n doc.Objects.UnselectAll();\n rc = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select second set of polysurfaces\",\n false, Rhino.DocObjects.ObjectType.PolysrfFilter, out objrefs);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n if (objrefs == null || objrefs.Length < 1)\n return Rhino.Commands.Result.Failure;\n\n List in_breps1 = new List();\n for (int i = 0; i < objrefs.Length; i++)\n {\n Rhino.Geometry.Brep brep = objrefs[i].Brep();\n if (brep != null)\n in_breps1.Add(brep);\n }\n\n double tolerance = doc.ModelAbsoluteTolerance;\n Rhino.Geometry.Brep[] breps = Rhino.Geometry.Brep.CreateBooleanDifference(in_breps0, in_breps1, tolerance);\n if (breps.Length < 1)\n return Rhino.Commands.Result.Nothing;\n for (int i = 0; i < breps.Length; i++)\n doc.Objects.AddBrep(breps[i]);\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ + ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance, System.Boolean manifoldOnly)"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance)"], - ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Input.RhinoGet", "static Result GetMultipleObjects(System.String prompt, System.Boolean acceptNothing, ObjectType filter, out ObjRef[] rhObjects)"] ] }, @@ -360,9 +359,9 @@ "name": "Constrainedcopy.cs", "code": "using System;\n\npartial class Examples\n{\n public static Rhino.Commands.Result ConstrainedCopy(Rhino.RhinoDoc doc)\n {\n // Get a single planar closed curve\n var go = new Rhino.Input.Custom.GetObject();\n go.SetCommandPrompt(\"Select curve\");\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;\n go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve;\n go.Get();\n if( go.CommandResult() != Rhino.Commands.Result.Success )\n return go.CommandResult();\n var objref = go.Object(0);\n var base_curve = objref.Curve();\n var first_point = objref.SelectionPoint();\n if( base_curve==null || !first_point.IsValid )\n return Rhino.Commands.Result.Cancel;\n\n Rhino.Geometry.Plane plane;\n if( !base_curve.TryGetPlane(out plane) )\n return Rhino.Commands.Result.Cancel;\n\n // Get a point constrained to a line passing through the initial selection\n // point and parallel to the plane's normal\n var gp = new Rhino.Input.Custom.GetPoint();\n gp.SetCommandPrompt(\"Offset point\");\n gp.DrawLineFromPoint(first_point, true);\n var line = new Rhino.Geometry.Line(first_point, first_point+plane.Normal);\n gp.Constrain(line);\n gp.Get();\n if( gp.CommandResult() != Rhino.Commands.Result.Success )\n return gp.CommandResult();\n var second_point = gp.Point();\n Rhino.Geometry.Vector3d vec = second_point - first_point;\n if( vec.Length > 0.001 )\n {\n var xf = Rhino.Geometry.Transform.Translation(vec);\n Guid id = doc.Objects.Transform(objref, xf, false);\n if( id!=Guid.Empty )\n {\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n }\n return Rhino.Commands.Result.Cancel;\n }\n}\n", "members": [ + ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Geometry.Curve", "System.Boolean TryGetPlane(out Plane plane)"], ["Rhino.Geometry.Transform", "static Transform Translation(Vector3d motion)"], - ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Line line)"] ] }, @@ -434,8 +433,8 @@ "name": "Curvesurfaceintersect.cs", "code": "using Rhino;\nusing Rhino.Geometry;\nusing Rhino.Geometry.Intersect;\nusing Rhino.Input.Custom;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\n\nnamespace examples_cs\n{\n public class CurveSurfaceIntersectCommand : Command\n {\n public override string EnglishName { get { return \"csCurveSurfaceIntersect\"; } }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n var gs = new GetObject();\n gs.SetCommandPrompt(\"select brep\");\n gs.GeometryFilter = ObjectType.Brep;\n gs.DisablePreSelect();\n gs.SubObjectSelect = false;\n gs.Get();\n if (gs.CommandResult() != Result.Success)\n return gs.CommandResult();\n var brep = gs.Object(0).Brep();\n\n var gc = new GetObject();\n gc.SetCommandPrompt(\"select curve\");\n gc.GeometryFilter = ObjectType.Curve;\n gc.DisablePreSelect();\n gc.SubObjectSelect = false;\n gc.Get();\n if (gc.CommandResult() != Result.Success)\n return gc.CommandResult();\n var curve = gc.Object(0).Curve();\n\n if (brep == null || curve == null)\n return Result.Failure;\n\n var tolerance = doc.ModelAbsoluteTolerance;\n\n Point3d[] intersection_points;\n Curve[] overlap_curves;\n if (!Intersection.CurveBrep(curve, brep, tolerance, out overlap_curves, out intersection_points))\n {\n RhinoApp.WriteLine(\"curve brep intersection failed\");\n return Result.Nothing;\n }\n\n foreach (var overlap_curve in overlap_curves)\n doc.Objects.AddCurve(overlap_curve);\n foreach (var intersection_point in intersection_points)\n doc.Objects.AddPoint(intersection_point);\n\n RhinoApp.WriteLine(\"{0} overlap curves, and {1} intersection points\", overlap_curves.Length, intersection_points.Length);\n doc.Views.Redraw();\n\n return Result.Success;\n }\n }\n}", "members": [ - ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.Geometry.Intersect.IntersectionEvent", "bool IsOverlap"], + ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Int32 Select(IEnumerable objectIds)"] ] }, @@ -459,8 +458,8 @@ "code": "using Rhino;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\nusing Rhino.Geometry;\n\nnamespace examples_cs\n{\n public class ChangeDimensionStyleCommand : Rhino.Commands.Command\n {\n public override string EnglishName\n {\n get { return \"csChangeDimensionStyle\"; }\n }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n foreach (var rhino_object in doc.Objects.GetObjectList(ObjectType.Annotation))\n {\n var annotation_object = rhino_object as AnnotationObjectBase;\n if (annotation_object == null) continue;\n\n var annotation = annotation_object.Geometry as AnnotationBase;\n if (annotation == null) continue;\n\n if (annotation.Index == doc.DimStyles.CurrentDimensionStyleIndex) continue;\n\n annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex;\n annotation_object.CommitChanges();\n }\n\n doc.Views.Redraw();\n\n return Result.Success;\n }\n }\n}", "members": [ ["Rhino.RhinoDoc", "DimStyleTable DimStyles"], - ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"], - ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"] + ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"], + ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"] ] }, { @@ -542,8 +541,8 @@ "name": "Evnormal.cs", "code": "using Rhino;\nusing Rhino.Input.Custom;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\n\nnamespace examples_cs\n{\n public class NormalDirectionOfBrepFaceCommand : Command\n {\n public override string EnglishName { get { return \"csDetermineNormalDirectionOfBrepFace\"; } }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n // select a surface\n var gs = new GetObject();\n gs.SetCommandPrompt(\"select surface\");\n gs.GeometryFilter = ObjectType.Surface;\n gs.DisablePreSelect();\n gs.SubObjectSelect = false;\n gs.Get();\n if (gs.CommandResult() != Result.Success)\n return gs.CommandResult();\n // get the selected face\n var face = gs.Object(0).Face();\n if (face == null)\n return Result.Failure;\n\n // pick a point on the surface. Constain\n // picking to the face.\n var gp = new GetPoint();\n gp.SetCommandPrompt(\"select point on surface\");\n gp.Constrain(face, false);\n gp.Get();\n if (gp.CommandResult() != Result.Success)\n return gp.CommandResult();\n\n // get the parameters of the point on the\n // surface that is clesest to gp.Point()\n double u, v;\n if (face.ClosestPoint(gp.Point(), out u, out v))\n {\n var direction = face.NormalAt(u, v);\n if (face.OrientationIsReversed)\n direction.Reverse();\n RhinoApp.WriteLine(\n string.Format(\n \"Surface normal at uv({0:f},{1:f}) = ({2:f},{3:f},{4:f})\", \n u, v, direction.X, direction.Y, direction.Z));\n }\n return Result.Success;\n }\n }\n}", "members": [ - ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"], - ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"] + ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"], + ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"] ] }, { @@ -557,8 +556,8 @@ "name": "Extendcurve.cs", "code": "using System.Linq;\nusing Rhino;\nusing Rhino.Geometry;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\nusing Rhino.Input;\nusing Rhino.Input.Custom;\n\nnamespace examples_cs\n{\n public class ExtendCurveCommand : Command\n {\n public override string EnglishName { get { return \"csExtendCurve\"; } }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n ObjRef[] boundary_obj_refs;\n var rc = RhinoGet.GetMultipleObjects(\"Select boundary objects\", false, ObjectType.AnyObject, out boundary_obj_refs);\n if (rc != Result.Success)\n return rc;\n if (boundary_obj_refs == null || boundary_obj_refs.Length == 0)\n return Result.Nothing;\n\n var gc = new GetObject();\n gc.SetCommandPrompt(\"Select curve to extend\");\n gc.GeometryFilter = ObjectType.Curve;\n gc.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve;\n gc.Get();\n if (gc.CommandResult() != Result.Success)\n return gc.CommandResult();\n var curve_obj_ref = gc.Object(0);\n\n var curve = curve_obj_ref.Curve();\n if (curve == null) return Result.Failure;\n double t;\n if (!curve.ClosestPoint(curve_obj_ref.SelectionPoint(), out t))\n return Result.Failure;\n var curve_end = t <= curve.Domain.Mid ? CurveEnd.Start : CurveEnd.End;\n\n var geometry = boundary_obj_refs.Select(obj=> obj.Geometry());\n var extended_curve = curve.Extend(curve_end, CurveExtensionStyle.Line, geometry);\n if (extended_curve != null && extended_curve.IsValid)\n {\n if (!doc.Objects.Replace(curve_obj_ref.ObjectId, extended_curve))\n return Result.Failure;\n doc.Views.Redraw();\n }\n else\n {\n RhinoApp.WriteLine(\"No boundary object was intersected so curve not extended\");\n return Result.Nothing;\n }\n\n return Result.Success;\n }\n }\n}", "members": [ - ["Rhino.Geometry.Interval", "double Mid"], - ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"] + ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"], + ["Rhino.Geometry.Interval", "double Mid"] ] }, { @@ -610,10 +609,10 @@ "name": "Hatchcurve.cs", "code": "partial class Examples\n{\n public static Rhino.Commands.Result HatchCurve(Rhino.RhinoDoc doc)\n {\n var go = new Rhino.Input.Custom.GetObject();\n go.SetCommandPrompt(\"Select closed planar curve\");\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;\n go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve;\n go.SubObjectSelect = false;\n go.Get();\n if( go.CommandResult() != Rhino.Commands.Result.Success )\n return go.CommandResult();\n\n var curve = go.Object(0).Curve();\n if( curve==null || !curve.IsClosed || !curve.IsPlanar() )\n return Rhino.Commands.Result.Failure;\n\n string hatch_name = doc.HatchPatterns[doc.HatchPatterns.CurrentHatchPatternIndex].Name;\n var rc = Rhino.Input.RhinoGet.GetString(\"Hatch pattern\", true, ref hatch_name);\n if( rc!= Rhino.Commands.Result.Success )\n return rc;\n hatch_name = hatch_name.Trim();\n if( string.IsNullOrWhiteSpace(hatch_name) )\n return Rhino.Commands.Result.Nothing;\n int index = doc.HatchPatterns.Find(hatch_name, true);\n if( index < 0 )\n {\n Rhino.RhinoApp.WriteLine(\"Hatch pattern does not exist.\");\n return Rhino.Commands.Result.Nothing;\n }\n\n var hatches = Rhino.Geometry.Hatch.Create( curve, index, 0, 1);\n for( int i=0; i0 )\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.ModelComponent", "string Name"], ["Rhino.RhinoDoc", "HatchPatternTable HatchPatterns"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddHatch(Hatch hatch)"], ["Rhino.DocObjects.Tables.HatchPatternTable", "int CurrentHatchPatternIndex"], ["Rhino.DocObjects.Tables.HatchPatternTable", "System.Int32 Find(System.String name, System.Boolean ignoreDeleted)"], @@ -642,9 +641,9 @@ "name": "Intersectcurves.cs", "code": "partial class Examples\n{\n public static Rhino.Commands.Result IntersectCurves(Rhino.RhinoDoc doc)\n {\n // Select two curves to intersect\n var go = new Rhino.Input.Custom.GetObject();\n go.SetCommandPrompt(\"Select two curves\");\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;\n go.GetMultiple(2, 2);\n if (go.CommandResult() != Rhino.Commands.Result.Success)\n return go.CommandResult();\n\n // Validate input\n var curveA = go.Object(0).Curve();\n var curveB = go.Object(1).Curve();\n if (curveA == null || curveB == null)\n return Rhino.Commands.Result.Failure;\n\n // Calculate the intersection\n const double intersection_tolerance = 0.001;\n const double overlap_tolerance = 0.0;\n var events = Rhino.Geometry.Intersect.Intersection.CurveCurve(curveA, curveB, intersection_tolerance, overlap_tolerance);\n\n // Process the results\n if (events != null)\n {\n for (int i = 0; i < events.Count; i++)\n {\n var ccx_event = events[i];\n doc.Objects.AddPoint(ccx_event.PointA);\n if (ccx_event.PointA.DistanceTo(ccx_event.PointB) > double.Epsilon)\n {\n doc.Objects.AddPoint(ccx_event.PointB);\n doc.Objects.AddLine(ccx_event.PointA, ccx_event.PointB);\n }\n }\n doc.Views.Redraw();\n }\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ - ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], - ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], ["Rhino.DocObjects.ObjRef", "Curve Curve()"], + ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], + ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveCurve(Curve curveA, Curve curveB, System.Double tolerance, System.Double overlapTolerance)"] ] }, @@ -659,9 +658,9 @@ "name": "Intersectlines.cs", "code": "using Rhino.Geometry;\n\npartial class Examples\n{\n public static Rhino.Commands.Result IntersectLines(Rhino.RhinoDoc doc)\n {\n Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();\n go.SetCommandPrompt( \"Select lines\" );\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;\n go.GetMultiple( 2, 2);\n if( go.CommandResult() != Rhino.Commands.Result.Success )\n return go.CommandResult();\n if( go.ObjectCount != 2 )\n return Rhino.Commands.Result.Failure;\n\n LineCurve crv0 = go.Object(0).Geometry() as LineCurve;\n LineCurve crv1 = go.Object(1).Geometry() as LineCurve;\n if( crv0==null || crv1==null )\n return Rhino.Commands.Result.Failure;\n\n Line line0 = crv0.Line;\n Line line1 = crv1.Line;\n Vector3d v0 = line0.Direction;\n v0.Unitize();\n Vector3d v1 = line1.Direction;\n v1.Unitize();\n\n if( v0.IsParallelTo(v1) != 0 )\n {\n Rhino.RhinoApp.WriteLine(\"Selected lines are parallel.\");\n return Rhino.Commands.Result.Nothing;\n }\n\n double a, b;\n if( !Rhino.Geometry.Intersect.Intersection.LineLine(line0, line1, out a, out b))\n {\n Rhino.RhinoApp.WriteLine(\"No intersection found.\");\n return Rhino.Commands.Result.Nothing;\n }\n\n Point3d pt0 = line0.PointAt(a);\n Point3d pt1 = line1.PointAt(b);\n // pt0 and pt1 should be equal, so we will only add pt0 to the document\n doc.Objects.AddPoint( pt0 );\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ - ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Line", "Vector3d Direction"], ["Rhino.Geometry.Line", "Point3d PointAt(System.Double t)"], + ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static System.Boolean LineLine(Line lineA, Line lineB, out System.Double a, out System.Double b)"] ] }, @@ -669,8 +668,8 @@ "name": "Isbrepbox.cs", "code": "using System;\n\npartial class Examples\n{\n public static bool IsBrepBox(Rhino.Geometry.Brep brep)\n {\n const double zero_tolerance = 1.0e-6; // or whatever\n bool rc = brep.IsSolid;\n if( rc )\n rc = brep.Faces.Count == 6;\n\n var N = new Rhino.Geometry.Vector3d[6];\n for (int i = 0; rc && i < 6; i++)\n {\n Rhino.Geometry.Plane plane;\n rc = brep.Faces[i].TryGetPlane(out plane, zero_tolerance);\n if( rc )\n {\n N[i] = plane.ZAxis;\n N[i].Unitize();\n }\n }\n \n for (int i = 0; rc && i < 6; i++)\n {\n int count = 0;\n for (int j = 0; rc && j < 6; j++)\n {\n double dot = Math.Abs(N[i] * N[j]);\n if (dot <= zero_tolerance)\n continue;\n if (Math.Abs(dot - 1.0) <= zero_tolerance) \n count++;\n else\n rc = false;\n }\n \n if (rc)\n {\n if (2 != count)\n rc = false;\n }\n }\n return rc;\n }\n\n public static Rhino.Commands.Result TestBrepBox(Rhino.RhinoDoc doc)\n {\n Rhino.DocObjects.ObjRef obj_ref;\n var rc = Rhino.Input.RhinoGet.GetOneObject(\"Select Brep\", true, Rhino.DocObjects.ObjectType.Brep, out obj_ref);\n if (rc == Rhino.Commands.Result.Success)\n {\n var brep = obj_ref.Brep();\n if (brep != null)\n {\n Rhino.RhinoApp.WriteLine(IsBrepBox(brep) ? \"Yes it is a box\" : \"No it is not a box\");\n }\n }\n return rc;\n }\n}\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"], - ["Rhino.Geometry.Brep", "bool IsSolid"] + ["Rhino.Geometry.Brep", "bool IsSolid"], + ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"] ] }, { @@ -684,8 +683,8 @@ "name": "Issurfaceinplane.cs", "code": "using System.Linq;\nusing Rhino;\nusing Rhino.DocObjects;\nusing Rhino.Geometry;\nusing Rhino.Commands;\nusing Rhino.Input;\n\nnamespace examples_cs\n{\n public class IsPlanarSurfaceInPlaneCommand : Command\n {\n public override string EnglishName { get { return \"csIsPlanarSurfaceInPlane\"; } }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n ObjRef obj_ref;\n var rc = RhinoGet.GetOneObject(\"select surface\", true, ObjectType.Surface, out obj_ref);\n if (rc != Result.Success)\n return rc;\n var surface = obj_ref.Surface();\n\n Point3d[] corners;\n rc = RhinoGet.GetRectangle(out corners);\n if (rc != Result.Success)\n return rc;\n\n var plane = new Plane(corners[0], corners[1], corners[2]);\n\n var is_or_isnt = \"\";\n if (IsSurfaceInPlane(surface, plane, doc.ModelAbsoluteTolerance))\n is_or_isnt = \" not \";\n\n RhinoApp.WriteLine(\"Surface is{0} in plane.\", is_or_isnt);\n return Result.Success;\n }\n\n private bool IsSurfaceInPlane(Surface surface, Plane plane, double tolerance)\n {\n if (!surface.IsPlanar(tolerance))\n return false;\n \n var bbox = surface.GetBoundingBox(true);\n return bbox.GetCorners().All(\n corner => System.Math.Abs(plane.DistanceTo(corner)) <= tolerance);\n }\n }\n}", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"], - ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"] + ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"], + ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"] ] }, { @@ -816,11 +815,11 @@ "name": "Orientonsrf.cs", "code": "partial class Examples\n{\n public static Rhino.Commands.Result OrientOnSrf(Rhino.RhinoDoc doc)\n {\n // Select objects to orient\n Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();\n go.SetCommandPrompt(\"Select objects to orient\");\n go.SubObjectSelect = false;\n go.GroupSelect = true;\n go.GetMultiple(1, 0);\n if (go.CommandResult() != Rhino.Commands.Result.Success)\n return go.CommandResult();\n\n // Point to orient from\n Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint();\n gp.SetCommandPrompt(\"Point to orient from\");\n gp.Get();\n if (gp.CommandResult() != Rhino.Commands.Result.Success)\n return gp.CommandResult();\n\n // Define source plane\n Rhino.Display.RhinoView view = gp.View();\n if (view == null)\n {\n view = doc.Views.ActiveView;\n if (view == null)\n return Rhino.Commands.Result.Failure;\n }\n Rhino.Geometry.Plane source_plane = view.ActiveViewport.ConstructionPlane();\n source_plane.Origin = gp.Point();\n\n // Surface to orient on\n Rhino.Input.Custom.GetObject gs = new Rhino.Input.Custom.GetObject();\n gs.SetCommandPrompt(\"Surface to orient on\");\n gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface;\n gs.SubObjectSelect = true;\n gs.DeselectAllBeforePostSelect = false;\n gs.OneByOnePostSelect = true;\n gs.Get();\n if (gs.CommandResult() != Rhino.Commands.Result.Success)\n return gs.CommandResult();\n\n Rhino.DocObjects.ObjRef objref = gs.Object(0);\n // get selected surface object\n Rhino.DocObjects.RhinoObject obj = objref.Object();\n if (obj == null)\n return Rhino.Commands.Result.Failure;\n // get selected surface (face)\n Rhino.Geometry.Surface surface = objref.Surface();\n if (surface == null)\n return Rhino.Commands.Result.Failure;\n // Unselect surface\n obj.Select(false);\n\n // Point on surface to orient to\n gp.SetCommandPrompt(\"Point on surface to orient to\");\n gp.Constrain(surface, false);\n gp.Get();\n if (gp.CommandResult() != Rhino.Commands.Result.Success)\n return gp.CommandResult();\n\n // Do transformation\n Rhino.Commands.Result rc = Rhino.Commands.Result.Failure;\n double u, v;\n if (surface.ClosestPoint(gp.Point(), out u, out v))\n {\n Rhino.Geometry.Plane target_plane;\n if (surface.FrameAt(u, v, out target_plane))\n {\n // Build transformation\n Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.PlaneToPlane(source_plane, target_plane);\n\n // Do the transformation. In this example, we will copy the original objects\n const bool delete_original = false;\n for (int i = 0; i < go.ObjectCount; i++)\n doc.Objects.Transform(go.Object(i), xform, delete_original);\n\n doc.Views.Redraw();\n rc = Rhino.Commands.Result.Success;\n }\n }\n return rc;\n }\n}\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], - ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.DocObjects.RhinoObject", "System.Int32 Select(System.Boolean on)"], ["Rhino.DocObjects.ObjRef", "RhinoObject Object()"], ["Rhino.DocObjects.ObjRef", "Surface Surface()"], + ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], + ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.Input.Custom.GetObject", "bool DeselectAllBeforePostSelect"], ["Rhino.Input.Custom.GetObject", "ObjectType GeometryFilter"], ["Rhino.Input.Custom.GetObject", "bool GroupSelect"], @@ -849,8 +848,8 @@ "name": "Pointatcursor.cs", "code": "using Rhino;\nusing Rhino.Commands;\nusing Rhino.DocObjects;\nusing System;\n\nnamespace examples_cs\n{\n public class PointAtCursorCommand : Command\n {\n public override string EnglishName { get { return \"csPointAtCursor\"; } }\n\n [System.Runtime.InteropServices.DllImport(\"user32.dll\")]\n public static extern bool GetCursorPos(out System.Drawing.Point point);\n \n [System.Runtime.InteropServices.DllImport(\"user32.dll\")]\n public static extern bool ScreenToClient(IntPtr hWnd, ref System.Drawing.Point point);\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n var result = Result.Failure;\n var view = doc.Views.ActiveView;\n if (view == null) return result;\n\n System.Drawing.Point windows_drawing_point;\n if (!GetCursorPos(out windows_drawing_point) || !ScreenToClient(view.Handle, ref windows_drawing_point))\n return result;\n\n var xform = view.ActiveViewport.GetTransform(CoordinateSystem.Screen, CoordinateSystem.World);\n var point = new Rhino.Geometry.Point3d(windows_drawing_point.X, windows_drawing_point.Y, 0.0);\n RhinoApp.WriteLine(\"screen point: ({0})\", point);\n point.Transform(xform);\n RhinoApp.WriteLine(\"world point: ({0})\", point);\n result = Result.Success;\n return result;\n }\n }\n}", "members": [ - ["Rhino.Geometry.Point3d", "System.Void Transform(Transform xform)"], - ["Rhino.Display.RhinoViewport", "Transform GetTransform(DocObjects.CoordinateSystem sourceSystem, DocObjects.CoordinateSystem destinationSystem)"] + ["Rhino.Display.RhinoViewport", "Transform GetTransform(DocObjects.CoordinateSystem sourceSystem, DocObjects.CoordinateSystem destinationSystem)"], + ["Rhino.Geometry.Point3d", "System.Void Transform(Transform xform)"] ] }, { @@ -910,8 +909,8 @@ "name": "Replacehatchpattern.cs", "code": "using Rhino;\nusing Rhino.DocObjects;\nusing Rhino.Commands;\nusing Rhino.Input;\nusing Rhino.Input.Custom;\n\nnamespace examples_cs\n{\n public class ReplaceHatchPatternCommand : Rhino.Commands.Command\n {\n public override string EnglishName\n {\n get { return \"csReplaceHatchPattern\"; }\n }\n\n protected override Result RunCommand(RhinoDoc doc, RunMode mode)\n {\n ObjRef[] obj_refs;\n var rc = RhinoGet.GetMultipleObjects(\"Select hatches to replace\", false, ObjectType.Hatch, out obj_refs);\n if (rc != Result.Success || obj_refs == null)\n return rc;\n\n var gs = new GetString();\n gs.SetCommandPrompt(\"Name of replacement hatch pattern\");\n gs.AcceptNothing(false);\n gs.Get();\n if (gs.CommandResult() != Result.Success)\n return gs.CommandResult();\n var hatch_name = gs.StringResult();\n\n var pattern_index = doc.HatchPatterns.Find(hatch_name, true);\n\n if (pattern_index < 0)\n {\n RhinoApp.WriteLine(\"The hatch pattern '{0}' not found in the document.\", hatch_name);\n return Result.Nothing;\n }\n\n foreach (var obj_ref in obj_refs)\n {\n var hatch_object = obj_ref.Object() as HatchObject;\n if (hatch_object.HatchGeometry.PatternIndex != pattern_index)\n {\n hatch_object.HatchGeometry.PatternIndex = pattern_index;\n hatch_object.CommitChanges();\n }\n }\n doc.Views.Redraw();\n return Result.Success;\n }\n }\n}\n", "members": [ - ["Rhino.Geometry.Hatch", "int PatternIndex"], - ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"] + ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"], + ["Rhino.Geometry.Hatch", "int PatternIndex"] ] }, { @@ -946,8 +945,8 @@ "code": "using Rhino.Commands;\n\npartial class Examples\n{\n public static Rhino.Commands.Result SelLayer(Rhino.RhinoDoc doc)\n {\n // Prompt for a layer name\n string layername = doc.Layers.CurrentLayer.Name;\n Result rc = Rhino.Input.RhinoGet.GetString(\"Name of layer to select objects\", true, ref layername);\n if (rc != Rhino.Commands.Result.Success)\n return rc;\n\n // Get all of the objects on the layer. If layername is bogus, you will\n // just get an empty list back\n Rhino.DocObjects.RhinoObject[] rhobjs = doc.Objects.FindByLayer(layername);\n if (rhobjs == null || rhobjs.Length < 1)\n return Rhino.Commands.Result.Cancel;\n\n for (int i = 0; i < rhobjs.Length; i++)\n rhobjs[i].Select(true);\n doc.Views.Redraw();\n return Rhino.Commands.Result.Success;\n }\n}\n", "members": [ ["Rhino.DocObjects.Layer", "string Name"], - ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"], - ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"] + ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"], + ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"] ] }, { @@ -1029,10 +1028,10 @@ ["Rhino.Input.Custom.GetNumber", "GetNumber()"], ["Rhino.Input.Custom.GetNumber", "GetResult Get()"], ["Rhino.Input.Custom.GetNumber", "System.Void SetLowerLimit(System.Double lowerLimit, System.Boolean strictlyGreaterThan)"], + ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.Input.Custom.GetBaseClass", "Result CommandResult()"], ["Rhino.Input.Custom.GetBaseClass", "System.Double Number()"], ["Rhino.Input.Custom.GetBaseClass", "RhinoView View()"], - ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoView ActiveView"] ] }, @@ -1067,8 +1066,8 @@ "name": "Addclippingplane.py", "code": "import Rhino\nimport scriptcontext\nimport System.Guid\n\ndef AddClippingPlane():\n # Define the corners of the clipping plane\n rc, corners = Rhino.Input.RhinoGet.GetRectangle()\n if rc!=Rhino.Commands.Result.Success: return rc\n\n # Get the active view\n view = scriptcontext.doc.Views.ActiveView\n if view is None: return Rhino.Commands.Result.Failure\n\n p0, p1, p2, p3 = corners\n # Create a plane from the corner points\n plane = Rhino.Geometry.Plane(p0, p1, p3)\n\n # Add a clipping plane object to the document\n id = scriptcontext.doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID)\n if id!=System.Guid.Empty:\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n return Rhino.Commands.Result.Failure\n\nif __name__==\"__main__\":\n AddClippingPlane()\n", "members": [ - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.FileIO.File3dmObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"], + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.Input.RhinoGet", "static Result GetRectangle(out Point3d[] corners)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"] ] @@ -1077,9 +1076,9 @@ "name": "Addcylinder.py", "code": "import Rhino\nimport scriptcontext\nimport System.Guid\n\ndef AddCylinder():\n center_point = Rhino.Geometry.Point3d(0, 0, 0)\n height_point = Rhino.Geometry.Point3d(0, 0, 10)\n zaxis = height_point-center_point\n plane = Rhino.Geometry.Plane(center_point, zaxis)\n radius = 5\n circle = Rhino.Geometry.Circle(plane, radius)\n cylinder = Rhino.Geometry.Cylinder(circle, zaxis.Length)\n brep = cylinder.ToBrep(True, True)\n if brep:\n if scriptcontext.doc.Objects.AddBrep(brep)!=System.Guid.Empty:\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n return Rhino.Commands.Result.Failure\n\nif __name__==\"__main__\":\n AddCylinder()\n", "members": [ + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"], ["Rhino.Geometry.Cylinder", "Cylinder(Circle baseCircle, double height)"], - ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"], - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"] + ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"] ] }, { @@ -1105,14 +1104,14 @@ "name": "Addlayout.py", "code": "import Rhino\nimport scriptcontext\n\n# Generate a layout with a single detail view that zooms\n# to a list of objects\ndef AddLayout():\n scriptcontext.doc.PageUnitSystem = Rhino.UnitSystem.Millimeters\n page_views = scriptcontext.doc.Views.GetPageViews()\n page_number = 1\n if page_views: page_number = len(page_views) + 1\n pageview = scriptcontext.doc.Views.AddPageView(\"A0_{0}\".format(page_number), 1189, 841)\n if pageview:\n top_left = Rhino.Geometry.Point2d(20,821)\n bottom_right = Rhino.Geometry.Point2d(1169, 20)\n detail = pageview.AddDetailView(\"ModelView\", top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top)\n if detail:\n pageview.SetActiveDetail(detail.Id)\n detail.Viewport.ZoomExtents()\n detail.DetailGeometry.IsProjectionLocked = True\n detail.DetailGeometry.SetScale(1, scriptcontext.doc.ModelUnitSystem, 10, scriptcontext.doc.PageUnitSystem)\n # Commit changes tells the document to replace the document's detail object\n # with the modified one that we just adjusted\n detail.CommitChanges()\n pageview.SetPageAsActive()\n scriptcontext.doc.Views.ActiveView = pageview\n scriptcontext.doc.Views.Redraw()\n\nif __name__==\"__main__\":\n AddLayout()", "members": [ - ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], - ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.RhinoObject", "System.Boolean CommitChanges()"], - ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.Display.RhinoPageView", "DetailViewObject AddDetailView(System.String title, Geometry.Point2d corner0, Geometry.Point2d corner1, DefinedViewportProjection initialProjection)"], ["Rhino.Display.RhinoPageView", "System.Boolean SetActiveDetail(System.Guid detailId)"], ["Rhino.Display.RhinoPageView", "System.Void SetPageAsActive()"], + ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.RhinoDoc", "UnitSystem PageUnitSystem"], + ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], + ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView AddPageView(System.String title, System.Double pageWidth, System.Double pageHeight)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView[] GetPageViews()"] ] @@ -1123,12 +1122,12 @@ "members": [ ["Rhino.Geometry.Vector2d", "System.Boolean IsTiny(System.Double tolerance)"], ["Rhino.Geometry.Vector3d", "System.Boolean IsTiny(System.Double tolerance)"], - ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.Input.Custom.GetPoint", "GetPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Void DrawLineFromPoint(Point3d startPoint, System.Boolean showDistanceInStatusBar)"], ["Rhino.Input.Custom.GetPoint", "GetResult Get()"], ["Rhino.Input.Custom.GetPoint", "System.Void SetBasePoint(Point3d basePoint, System.Boolean showDistanceInStatusBar)"], + ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddLine(Point3d from, Point3d to)"] ] }, @@ -1144,8 +1143,8 @@ "name": "Addlineardimension2.py", "code": "import Rhino\nimport scriptcontext\nimport System.Guid\n\ndef AddLinearDimension2():\n origin = Rhino.Geometry.Point3d(1,1,0)\n offset = Rhino.Geometry.Point3d(11,1,0)\n pt = Rhino.Geometry.Point3d((offset.X-origin.X)/2.0,3,0)\n plane = Rhino.Geometry.Plane.WorldXY\n plane.Origin = origin\n \n rc, u, v = plane.ClosestParameter(origin)\n ext1 = Rhino.Geometry.Point2d(u,v)\n rc, u, v = plane.ClosestParameter(offset)\n ext2 = Rhino.Geometry.Point2d(u,v)\n rc, u, v = plane.ClosestParameter(pt)\n linePt = Rhino.Geometry.Point2d(u,v)\n \n dimension = Rhino.Geometry.LinearDimension(plane, ext1, ext2, linePt)\n if scriptcontext.doc.Objects.AddLinearDimension(dimension)!=System.Guid.Empty:\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n return Rhino.Commands.Result.Failure\n\nif __name__==\"__main__\":\n AddLinearDimension2()\n", "members": [ - ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"], - ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"] + ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"], + ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"] ] }, { @@ -1213,12 +1212,12 @@ "name": "Addradialdimension.py", "code": "from Rhino import *\nfrom Rhino.DocObjects import *\nfrom Rhino.Commands import *\nfrom Rhino.Geometry import *\nfrom Rhino.Input import *\nfrom scriptcontext import doc\n\ndef RunCommand():\n rc, obj_ref = RhinoGet.GetOneObject(\"Select curve for radius dimension\", \n True, ObjectType.Curve)\n if rc != Result.Success:\n return rc\n curve, curve_parameter = obj_ref.CurveParameter()\n if curve == None:\n return Result.Failure\n\n if curve.IsLinear() or curve.IsPolyline():\n print \"Curve must be non-linear.\"\n return Result.Nothing\n\n # in this example just deal with planar curves\n if not curve.IsPlanar():\n print \"Curve must be planar.\"\n return Result.Nothing\n\n point_on_curve = curve.PointAt(curve_parameter)\n curvature_vector = curve.CurvatureAt(curve_parameter)\n len = curvature_vector.Length\n if len < RhinoMath.SqrtEpsilon:\n print \"Curve is almost linear and therefore has no curvature.\"\n return Result.Nothing\n\n center = point_on_curve + (curvature_vector/(len*len))\n _, plane = curve.TryGetPlane()\n radial_dimension = \\\n RadialDimension(center, point_on_curve, plane.XAxis, plane.Normal, 5.0)\n doc.Objects.AddRadialDimension(radial_dimension)\n doc.Views.Redraw()\n return Result.Success\n\nif __name__==\"__main__\":\n RunCommand()", "members": [ + ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.Geometry.Curve", "Vector3d CurvatureAt(System.Double t)"], ["Rhino.Geometry.Curve", "System.Boolean IsLinear()"], ["Rhino.Geometry.Curve", "System.Boolean IsPlanar()"], ["Rhino.Geometry.Curve", "System.Boolean IsPolyline()"], ["Rhino.Geometry.Curve", "Point3d PointAt(System.Double t)"], - ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddRadialDimension(RadialDimension dimension)"] ] }, @@ -1250,10 +1249,10 @@ "name": "Addtruncatedcone.py", "code": "import Rhino\nimport scriptcontext\nimport System.Guid\n\ndef AddTruncatedCone():\n bottom_pt = Rhino.Geometry.Point3d(0,0,0)\n bottom_radius = 2\n bottom_circle = Rhino.Geometry.Circle(bottom_pt, bottom_radius)\n\n top_pt = Rhino.Geometry.Point3d(0,0,10)\n top_radius = 6\n top_circle = Rhino.Geometry.Circle(top_pt, top_radius)\n\n shapeCurve = Rhino.Geometry.LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0))\n axis = Rhino.Geometry.Line(bottom_circle.Center, top_circle.Center)\n revsrf = Rhino.Geometry.RevSurface.Create(shapeCurve, axis)\n tcone_brep = Rhino.Geometry.Brep.CreateFromRevSurface(revsrf, True, True)\n\n if scriptcontext.doc.Objects.AddBrep(tcone_brep)!=System.Guid.Empty:\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n return Rhino.Commands.Result.Failure\n\n\nif __name__==\"__main__\":\n AddTruncatedCone()\n", "members": [ - ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], - ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"], ["Rhino.Geometry.RevSurface", "static RevSurface Create(Curve revoluteCurve, Line axisOfRevolution)"], - ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"] + ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], + ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"], + ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"] ] }, { @@ -1279,11 +1278,11 @@ "code": "import Rhino\nimport scriptcontext\n\ndef dynamic_array():\n rc, objref = Rhino.Input.RhinoGet.GetOneObject(\"Select object\", True, Rhino.DocObjects.ObjectType.AnyObject)\n if rc!=Rhino.Commands.Result.Success: return\n \n rc, pt_start = Rhino.Input.RhinoGet.GetPoint(\"Start point\", False)\n if rc!=Rhino.Commands.Result.Success: return\n \n obj = objref.Object()\n if not obj: return\n \n dist = 1\n if scriptcontext.sticky.has_key(\"dynamic_array_distance\"):\n dist = scriptcontext.sticky[\"dynamic_array_distance\"]\n # This is a function that is called whenever the GetPoint's\n # DynamicDraw event occurs\n def ArrayByDistanceDraw( sender, args ):\n rhobj = args.Source.Tag\n if not rhobj: return\n vec = args.CurrentPoint - pt_start\n length = vec.Length\n vec.Unitize()\n count = int(length / dist)\n for i in range(1,count):\n translate = vec * (i*dist)\n xf = Rhino.Geometry.Transform.Translation(translate)\n args.Display.DrawObject(rhobj, xf)\n\n # Create an instance of a GetPoint class and add a delegate\n # for the DynamicDraw event\n gp = Rhino.Input.Custom.GetPoint()\n gp.DrawLineFromPoint(pt_start, True)\n optdouble = Rhino.Input.Custom.OptionDouble(dist)\n constrain = False\n optconstrain = Rhino.Input.Custom.OptionToggle(constrain,\"Off\", \"On\")\n gp.AddOptionDouble(\"Distance\", optdouble)\n gp.AddOptionToggle(\"Constrain\", optconstrain)\n gp.DynamicDraw += ArrayByDistanceDraw\n gp.Tag = obj\n while gp.Get()==Rhino.Input.GetResult.Option:\n dist = optdouble.CurrentValue\n if constrain!=optconstrain.CurrentValue:\n constrain = optconstrain.CurrentValue\n if constrain:\n gp2 = Rhino.Input.Custom.GetPoint()\n gp2.DrawLineFromPoint(pt_start, True)\n gp2.SetCommandPrompt(\"Second point on constraint line\")\n if gp2.Get()==Rhino.Input.GetResult.Point:\n gp.Constrain(pt_start, gp2.Point())\n else:\n gp.ClearCommandOptions()\n optconstrain.CurrentValue = False\n constrain = False\n gp.AddOptionDouble(\"Distance\", optdouble)\n gp.AddOptionToggle(\"Constrain\", optconstrain)\n else:\n gp.ClearConstraints()\n continue\n if gp.CommandResult()==Rhino.Commands.Result.Success:\n scriptcontext.sticky[\"dynamic_array_distance\"] = dist\n pt = gp.Point()\n vec = pt - pt_start\n length = vec.Length\n vec.Unitize()\n count = int(length / dist)\n for i in range(1, count):\n translate = vec * (i*dist)\n xf = Rhino.Geometry.Transform.Translation(translate)\n scriptcontext.doc.Objects.Transform(obj,xf,False)\n scriptcontext.doc.Views.Redraw()\n\n\nif( __name__ == \"__main__\" ):\n dynamic_array()", "members": [ ["Rhino.Display.DisplayPipeline", "System.Void DrawObject(DocObjects.RhinoObject rhinoObject, Transform xform)"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"], ["Rhino.Input.Custom.GetPoint", "object Tag"], ["Rhino.Input.Custom.GetPoint", "System.Void ClearConstraints()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Point3d from, Point3d to)"], - ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"] + ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"] ] }, { @@ -1297,9 +1296,9 @@ "name": "Booleandifference.py", "code": "import Rhino\nimport scriptcontext\n\ndef BooleanDifference():\n filter = Rhino.DocObjects.ObjectType.PolysrfFilter\n rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select first set of polysurfaces\", False, filter)\n if rc != Rhino.Commands.Result.Success: return rc\n if not objrefs: return Rhino.Commands.Result.Failure\n\n in_breps0 = []\n for objref in objrefs:\n brep = objref.Brep()\n if brep: in_breps0.append(brep)\n\n scriptcontext.doc.Objects.UnselectAll()\n rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select second set of polysurfaces\", False, filter)\n if rc != Rhino.Commands.Result.Success: return rc\n if not objrefs: return Rhino.Commands.Result.Failure\n\n in_breps1 = []\n for objref in objrefs:\n brep = objref.Brep()\n if brep: in_breps1.append(brep)\n\n tolerance = scriptcontext.doc.ModelAbsoluteTolerance\n breps = Rhino.Geometry.Brep.CreateBooleanDifference(in_breps0, in_breps1, tolerance)\n if not breps: return Rhino.Commands.Result.Nothing\n for brep in breps: scriptcontext.doc.Objects.AddBrep(brep)\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n\nif __name__==\"__main__\":\n BooleanDifference()", "members": [ + ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance, System.Boolean manifoldOnly)"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance)"], - ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Input.RhinoGet", "static Result GetMultipleObjects(System.String prompt, System.Boolean acceptNothing, ObjectType filter, out ObjRef[] rhObjects)"] ] }, @@ -1357,9 +1356,9 @@ "name": "Constrainedcopy.py", "code": "import Rhino\nimport scriptcontext\n\ndef constrainedcopy():\n #get a single closed curve\n go = Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select curve\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve\n go.Get()\n if go.CommandResult() != Rhino.Commands.Result.Success: return\n objref = go.Object(0)\n base_curve = objref.Curve()\n first_point = objref.SelectionPoint()\n if not base_curve or not first_point.IsValid:\n return\n isplanar, plane = base_curve.TryGetPlane()\n if not isplanar: return\n \n gp = Rhino.Input.Custom.GetPoint()\n gp.SetCommandPrompt(\"Offset point\")\n gp.DrawLineFromPoint(first_point, True)\n line = Rhino.Geometry.Line(first_point, first_point + plane.Normal)\n gp.Constrain(line)\n gp.Get()\n if gp.CommandResult() != Rhino.Commands.Result.Success:\n return\n second_point = gp.Point()\n vec = second_point - first_point\n if vec.Length > 0.001:\n xf = Rhino.Geometry.Transform.Translation(vec)\n id = scriptcontext.doc.Objects.Transform(objref, xf, False)\n scriptcontext.doc.Views.Redraw()\n return id\n\nif __name__==\"__main__\":\n constrainedcopy()\n", "members": [ + ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Geometry.Curve", "System.Boolean TryGetPlane(out Plane plane)"], ["Rhino.Geometry.Transform", "static Transform Translation(Vector3d motion)"], - ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Line line)"] ] }, @@ -1431,8 +1430,8 @@ "name": "Curvesurfaceintersect.py", "code": "import rhinoscriptsyntax as rs\nfrom scriptcontext import *\nimport Rhino\nimport System.Collections.Generic as scg\nimport System as s\n\ndef RunCommand():\n srfid = rs.GetObject(\"select surface\", rs.filter.surface | rs.filter.polysurface)\n if not srfid: return\n \n crvid = rs.GetObject(\"select curve\", rs.filter.curve)\n if not crvid: return\n\n result = rs.CurveBrepIntersect(crvid, srfid)\n if result == None:\n print \"no intersection\"\n return\n \n curves, points = result\n for curve in curves:\n doc.Objects.AddCurve(rs.coercecurve(curve))\n for point in points:\n rs.AddPoint(point)\n\n doc.Views.Redraw()\n\nif __name__ == \"__main__\":\n RunCommand()\n", "members": [ - ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.Geometry.Intersect.IntersectionEvent", "bool IsOverlap"], + ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Int32 Select(IEnumerable objectIds)"] ] }, @@ -1456,8 +1455,8 @@ "code": "from Rhino import *\nfrom Rhino.DocObjects import *\nfrom Rhino.Commands import *\nfrom Rhino.Geometry import *\nfrom scriptcontext import doc\n\ndef RunCommand():\n for annotation_object in doc.Objects.GetObjectList(ObjectType.Annotation):\n if not isinstance (annotation_object, AnnotationObjectBase):\n continue\n\n annotation = annotation_object.Geometry\n\n if annotation.Index == doc.DimStyles.CurrentDimensionStyleIndex:\n continue\n\n annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex\n annotation_object.CommitChanges()\n\n doc.Views.Redraw()\n return Result.Success\n\nif __name__ == \"__main__\":\n RunCommand()", "members": [ ["Rhino.RhinoDoc", "DimStyleTable DimStyles"], - ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"], - ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"] + ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"], + ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"] ] }, { @@ -1539,8 +1538,8 @@ "name": "Evnormal.py", "code": "import rhinoscriptsyntax as rs\nfrom scriptcontext import *\nimport Rhino\nfrom Rhino.Commands import Result\n\ndef RunCommand():\n # select a surface\n gs = Rhino.Input.Custom.GetObject()\n gs.SetCommandPrompt(\"select surface\")\n gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface\n gs.DisablePreSelect()\n gs.SubObjectSelect = False\n gs.Get()\n if gs.CommandResult() != Result.Success:\n return gs.CommandResult()\n\n # get the selected face\n face = gs.Object(0).Face()\n if face == None:\n return\n\n # pick a point on the surface. Constain\n # picking to the face.\n gp = Rhino.Input.Custom.GetPoint()\n gp.SetCommandPrompt(\"select point on surface\")\n gp.Constrain(face, False)\n gp.Get()\n if gp.CommandResult() != Result.Success:\n return gp.CommandResult()\n\n # get the parameters of the point on the\n # surface that is clesest to gp.Point()\n b, u, v = face.ClosestPoint(gp.Point())\n if b:\n dir = face.NormalAt(u, v)\n if face.OrientationIsReversed:\n dir.Reverse()\n print \"Surface normal at uv({0:f},{1:f}) = ({2:f},{3:f},{4:f})\".format(\n u, v, dir.X, dir.Y, dir.Z)\n\nif __name__ == \"__main__\":\n RunCommand()\n", "members": [ - ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"], - ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"] + ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"], + ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"] ] }, { @@ -1554,8 +1553,8 @@ "name": "Extendcurve.py", "code": "from Rhino import *\nfrom Rhino.Geometry import *\nfrom Rhino.DocObjects import *\nfrom Rhino.Commands import *\nfrom Rhino.Input import *\nfrom Rhino.Input.Custom import *\nfrom scriptcontext import doc\n\ndef RunCommand():\n \n rc, boundary_obj_refs = RhinoGet.GetMultipleObjects(\"Select boundary objects\", False, ObjectType.AnyObject)\n if rc <> Result.Success:\n return rc\n if boundary_obj_refs == None or boundary_obj_refs.Length == 0:\n return Result.Nothing\n\n gc = GetObject()\n gc.SetCommandPrompt(\"Select curve to extend\")\n gc.GeometryFilter = ObjectType.Curve\n gc.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve\n gc.Get()\n if gc.CommandResult() <> Result.Success:\n return gc.CommandResult()\n curve_obj_ref = gc.Object(0)\n\n curve = curve_obj_ref.Curve()\n if curve == None: return Result.Failure\n b, t = curve.ClosestPoint(curve_obj_ref.SelectionPoint())\n if not b: return Result.Failure\n curve_end = CurveEnd.Start if t <= curve.Domain.Mid else CurveEnd.End\n\n geometry = [obj.Geometry() for obj in boundary_obj_refs]\n extended_curve = curve.Extend(curve_end, CurveExtensionStyle.Line, geometry)\n if extended_curve <> None and extended_curve.IsValid:\n if not doc.Objects.Replace(curve_obj_ref.ObjectId, extended_curve):\n return Result.Failure\n doc.Views.Redraw()\n return Result.Success\n else:\n RhinoApp.WriteLine(\"No boundary object was intersected so curve not extended\")\n return Result.Nothing\n\nif __name__ == \"__main__\":\n RunCommand()", "members": [ - ["Rhino.Geometry.Interval", "double Mid"], - ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"] + ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"], + ["Rhino.Geometry.Interval", "double Mid"] ] }, { @@ -1607,10 +1606,10 @@ "name": "Hatchcurve.py", "code": "import Rhino\nimport scriptcontext\n\ndef HatchCurve():\n go = Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select closed planar curve\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve\n go.SubObjectSelect = False\n go.Get()\n if go.CommandResult()!=Rhino.Commands.Result.Success: return\n\n curve = go.Object(0).Curve()\n if (not curve or not curve.IsClosed or not curve.IsPlanar()): return\n\n hatch_name = scriptcontext.doc.HatchPatterns[scriptcontext.doc.HatchPatterns.CurrentHatchPatternIndex].Name\n rc, hatch_name = Rhino.Input.RhinoGet.GetString(\"Hatch pattern\", True, hatch_name)\n if rc!=Rhino.Commands.Result.Success or not hatch_name: return\n\n index = scriptcontext.doc.HatchPatterns.Find(hatch_name, True)\n if index<0:\n print \"Hatch pattern does not exist.\"\n return\n\n hatches = Rhino.Geometry.Hatch.Create(curve, index, 0, 1)\n for hatch in hatches:\n scriptcontext.doc.Objects.AddHatch(hatch)\n if hatches: scriptcontext.doc.Views.Redraw()\n\nif __name__==\"__main__\":\n HatchCurve()", "members": [ - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.ModelComponent", "string Name"], ["Rhino.RhinoDoc", "HatchPatternTable HatchPatterns"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddHatch(Hatch hatch)"], ["Rhino.DocObjects.Tables.HatchPatternTable", "int CurrentHatchPatternIndex"], ["Rhino.DocObjects.Tables.HatchPatternTable", "System.Int32 Find(System.String name, System.Boolean ignoreDeleted)"], @@ -1639,9 +1638,9 @@ "name": "Intersectcurves.py", "code": "import Rhino\nimport scriptcontext\n\ndef IntersectCurves():\n # Select two curves to intersect\n go = Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select two curves\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GetMultiple(2, 2)\n if go.CommandResult()!=Rhino.Commands.Result.Success: return\n\n # Validate input\n curveA = go.Object(0).Curve()\n curveB = go.Object(1).Curve()\n if not curveA or not curveB: return\n\n # Calculate the intersection\n intersection_tolerance = 0.001\n overlap_tolerance = 0.0\n events = Rhino.Geometry.Intersect.Intersection.CurveCurve(curveA, curveB, intersection_tolerance, overlap_tolerance)\n\n # Process the results\n if not events: return\n for ccx_event in events:\n scriptcontext.doc.Objects.AddPoint(ccx_event.PointA)\n if ccx_event.PointA.DistanceTo(ccx_event.PointB) > float.Epsilon:\n scriptcontext.doc.Objects.AddPoint(ccx_event.PointB)\n scriptcontext.doc.Objects.AddLine(ccx_event.PointA, ccx_event.PointB)\n scriptcontext.doc.Views.Redraw()\n\nif __name__==\"__main__\":\n IntersectCurves()", "members": [ - ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], - ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], ["Rhino.DocObjects.ObjRef", "Curve Curve()"], + ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], + ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveCurve(Curve curveA, Curve curveB, System.Double tolerance, System.Double overlapTolerance)"] ] }, @@ -1656,9 +1655,9 @@ "name": "Intersectlines.py", "code": "import Rhino\nimport scriptcontext\n\ndef IntersectLines():\n go = Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt( \"Select lines\" )\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GetMultiple( 2, 2)\n if go.CommandResult()!=Rhino.Commands.Result.Success:\n return go.CommandResult()\n if go.ObjectCount!=2: return Rhino.Commands.Result.Failure\n\n crv0 = go.Object(0).Geometry()\n crv1 = go.Object(1).Geometry()\n if not crv0 or not crv1: return Rhino.Commands.Result.Failure\n\n line0 = crv0.Line\n line1 = crv1.Line\n v0 = line0.Direction\n v0.Unitize()\n v1 = line1.Direction\n v1.Unitize()\n\n if v0.IsParallelTo(v1)!=0:\n print \"Selected lines are parallel.\"\n return Rhino.Commands.Result.Nothing\n\n rc, a, b = Rhino.Geometry.Intersect.Intersection.LineLine(line0, line1)\n if not rc:\n print \"No intersection found.\"\n return Rhino.Commands.Result.Nothing\n\n pt0 = line0.PointAt(a)\n pt1 = line1.PointAt(b)\n # pt0 and pt1 should be equal, so we will only add pt0 to the document\n scriptcontext.doc.Objects.AddPoint(pt0)\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n\nif __name__==\"__main__\":\n IntersectLines()", "members": [ - ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Line", "Vector3d Direction"], ["Rhino.Geometry.Line", "Point3d PointAt(System.Double t)"], + ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static System.Boolean LineLine(Line lineA, Line lineB, out System.Double a, out System.Double b)"] ] }, @@ -1666,8 +1665,8 @@ "name": "Isbrepbox.py", "code": "import Rhino\n\ndef IsBrepBox(brep):\n zero_tolerance = 1.0e-6 #or whatever\n rc = brep.IsSolid\n if rc: rc = brep.Faces.Count == 6\n\n N = []\n for i in range(6):\n if not rc: break\n rc, plane = brep.Faces[i].TryGetPlane(zero_tolerance)\n if rc:\n v = plane.ZAxis\n v.Unitize()\n N.append(v)\n \n for i in range(6):\n count = 0\n for j in range(6):\n if not rc: break\n dot = abs(N[i] * N[j])\n if dot<=zero_tolerance: continue\n if abs(dot-1.0)<=zero_tolerance:\n count += 1\n else:\n rc = False\n\n if rc:\n if 2!=count: rc = False\n return rc\n\n\nif __name__==\"__main__\":\n rc, objref = Rhino.Input.RhinoGet.GetOneObject(\"Select Brep\", True, Rhino.DocObjects.ObjectType.Brep)\n if rc==Rhino.Commands.Result.Success:\n brep = objref.Brep()\n if brep:\n if IsBrepBox(brep): print \"Yes it is a box\"\n else: print \"No it is not a box\"\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"], - ["Rhino.Geometry.Brep", "bool IsSolid"] + ["Rhino.Geometry.Brep", "bool IsSolid"], + ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"] ] }, { @@ -1681,8 +1680,8 @@ "name": "Issurfaceinplane.py", "code": "import Rhino\nfrom Rhino.Geometry import *\nimport rhinoscriptsyntax as rs\nfrom scriptcontext import doc\nimport math\n\ndef RunCommand():\n surface_id = rs.GetSurfaceObject()[0]\n if surface_id == None:\n return\n surface = rs.coercesurface(surface_id)\n\n corners = rs.GetRectangle()\n if corners == None:\n return\n \n plane = Plane(corners[0], corners[1], corners[2])\n\n is_or_isnt = \"\" if IsSurfaceInPlane(surface, plane, doc.ModelAbsoluteTolerance) else \" not \"\n print \"Surface is{0} in plane.\".format(is_or_isnt)\n\ndef IsSurfaceInPlane(surface, plane, tolerance):\n if not surface.IsPlanar(tolerance):\n return False\n \n bbox = surface.GetBoundingBox(True)\n rc = True\n for corner in bbox.GetCorners():\n if math.fabs(plane.DistanceTo(corner)) > tolerance:\n rc = False\n break\n \n return rc\n\nif __name__ == \"__main__\":\n RunCommand()", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"], - ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"] + ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"], + ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"] ] }, { @@ -1805,11 +1804,11 @@ "name": "Orientonsrf.py", "code": "import Rhino\nimport scriptcontext\nimport System.Guid\n\ndef OrientOnSrf():\n # Select objects to orient\n go = Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select objects to orient\")\n go.SubObjectSelect = False\n go.GroupSelect = True\n go.GetMultiple(1, 0)\n if go.CommandResult()!=Rhino.Commands.Result.Success:\n return go.CommandResult()\n\n # Point to orient from\n gp = Rhino.Input.Custom.GetPoint()\n gp.SetCommandPrompt(\"Point to orient from\")\n gp.Get()\n if gp.CommandResult()!=Rhino.Commands.Result.Success:\n return gp.CommandResult()\n \n # Define source plane\n view = gp.View()\n if not view:\n view = doc.Views.ActiveView\n if not view: return Rhino.Commands.Result.Failure\n\n source_plane = view.ActiveViewport.ConstructionPlane()\n source_plane.Origin = gp.Point()\n\n # Surface to orient on\n gs = Rhino.Input.Custom.GetObject()\n gs.SetCommandPrompt(\"Surface to orient on\")\n gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface\n gs.SubObjectSelect = True\n gs.DeselectAllBeforePostSelect = False\n gs.OneByOnePostSelect = True\n gs.Get()\n if gs.CommandResult()!=Rhino.Commands.Result.Success:\n return gs.CommandResult()\n\n objref = gs.Object(0)\n # get selected surface object\n obj = objref.Object()\n if not obj: return Rhino.Commands.Result.Failure\n # get selected surface (face)\n surface = objref.Surface()\n if not surface: return Rhino.Commands.Result.Failure\n # Unselect surface\n obj.Select(False)\n\n # Point on surface to orient to\n gp.SetCommandPrompt(\"Point on surface to orient to\")\n gp.Constrain(surface, False)\n gp.Get()\n if gp.CommandResult()!=Rhino.Commands.Result.Success:\n return gp.CommandResult()\n\n # Do transformation\n rc = Rhino.Commands.Result.Failure\n getrc, u, v = surface.ClosestPoint(gp.Point())\n if getrc:\n getrc, target_plane = surface.FrameAt(u,v)\n if getrc:\n # Build transformation\n xform = Rhino.Geometry.Transform.PlaneToPlane(source_plane, target_plane)\n # Do the transformation. In this example, we will copy the original objects\n delete_original = False\n for i in range(go.ObjectCount):\n rhobj = go.Object(i)\n scriptcontext.doc.Objects.Transform(rhobj, xform, delete_original)\n scriptcontext.doc.Views.Redraw()\n rc = Rhino.Commands.Result.Success\n return rc\n\n\nif __name__==\"__main__\":\n OrientOnSrf()\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], - ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.DocObjects.RhinoObject", "System.Int32 Select(System.Boolean on)"], ["Rhino.DocObjects.ObjRef", "RhinoObject Object()"], ["Rhino.DocObjects.ObjRef", "Surface Surface()"], + ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], + ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.Input.Custom.GetObject", "bool DeselectAllBeforePostSelect"], ["Rhino.Input.Custom.GetObject", "ObjectType GeometryFilter"], ["Rhino.Input.Custom.GetObject", "bool GroupSelect"], @@ -1891,8 +1890,8 @@ "name": "Replacehatchpattern.py", "code": "from Rhino import *\nfrom Rhino.DocObjects import *\nfrom Rhino.Commands import *\nfrom Rhino.Input import *\nfrom Rhino.Input.Custom import *\nfrom scriptcontext import doc\n\ndef RunCommand():\n rc, obj_refs = RhinoGet.GetMultipleObjects(\"Select hatches to replace\", False, ObjectType.Hatch)\n if rc <> Result.Success or obj_refs == None:\n return rc\n\n gs = GetString()\n gs.SetCommandPrompt(\"Name of replacement hatch pattern\")\n gs.AcceptNothing(False)\n gs.Get()\n if gs.CommandResult() <> Result.Success:\n return gs.CommandResult()\n hatch_name = gs.StringResult()\n\n pattern_index = doc.HatchPatterns.Find(hatch_name, True)\n\n if pattern_index < 0:\n RhinoApp.WriteLine(\"The hatch pattern \"{0}\" not found in the document.\", hatch_name)\n return Result.Nothing\n\n for obj_ref in obj_refs:\n hatch_object = obj_ref.Object()\n if hatch_object.HatchGeometry.PatternIndex <> pattern_index:\n hatch_object.HatchGeometry.PatternIndex = pattern_index\n hatch_object.CommitChanges()\n\n doc.Views.Redraw()\n return Result.Success\n\nif __name__ == \"__main__\":\n RunCommand()", "members": [ - ["Rhino.Geometry.Hatch", "int PatternIndex"], - ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"] + ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"], + ["Rhino.Geometry.Hatch", "int PatternIndex"] ] }, { @@ -1920,8 +1919,8 @@ "code": "import Rhino\nimport scriptcontext\nimport System.Guid, System.Drawing.Color\n\ndef SelLayer():\n # Prompt for a layer name\n layername = scriptcontext.doc.Layers.CurrentLayer.Name\n rc, layername = Rhino.Input.RhinoGet.GetString(\"Name of layer to select objects\", True, layername)\n if rc!=Rhino.Commands.Result.Success: return rc\n \n # Get all of the objects on the layer. If layername is bogus, you will\n # just get an empty list back\n rhobjs = scriptcontext.doc.Objects.FindByLayer(layername)\n if not rhobjs: Rhino.Commands.Result.Cancel\n \n for obj in rhobjs: obj.Select(True)\n scriptcontext.doc.Views.Redraw()\n return Rhino.Commands.Result.Success\n\nif __name__==\"__main__\":\n SelLayer()\n", "members": [ ["Rhino.DocObjects.Layer", "string Name"], - ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"], - ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"] + ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"], + ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"] ] }, { @@ -2003,10 +2002,10 @@ ["Rhino.Input.Custom.GetNumber", "GetNumber()"], ["Rhino.Input.Custom.GetNumber", "GetResult Get()"], ["Rhino.Input.Custom.GetNumber", "System.Void SetLowerLimit(System.Double lowerLimit, System.Boolean strictlyGreaterThan)"], + ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.Input.Custom.GetBaseClass", "Result CommandResult()"], ["Rhino.Input.Custom.GetBaseClass", "System.Double Number()"], ["Rhino.Input.Custom.GetBaseClass", "RhinoView View()"], - ["Rhino.Input.Custom.GetPoint", "System.Boolean ConstrainToConstructionPlane(System.Boolean throughBasePoint)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoView ActiveView"] ] }, @@ -2041,8 +2040,8 @@ "name": "Addclippingplane.vb", "code": "Partial Class Examples\n Public Shared Function AddClippingPlane(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n ' Define the corners of the clipping plane\n Dim corners As Rhino.Geometry.Point3d() = Nothing\n Dim rc As Rhino.Commands.Result = Rhino.Input.RhinoGet.GetRectangle(corners)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n\n ' Get the active view\n Dim view As Rhino.Display.RhinoView = doc.Views.ActiveView\n If view Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim p0 As Rhino.Geometry.Point3d = corners(0)\n Dim p1 As Rhino.Geometry.Point3d = corners(1)\n Dim p3 As Rhino.Geometry.Point3d = corners(3)\n\n ' Create a plane from the corner points\n Dim plane As New Rhino.Geometry.Plane(p0, p1, p3)\n\n ' Add a clipping plane object to the document\n Dim id As Guid = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID)\n If id <> Guid.Empty Then\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End If\n Return Rhino.Commands.Result.Failure\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.FileIO.File3dmObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"], + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Point3d xPoint, Point3d yPoint)"], ["Rhino.Input.RhinoGet", "static Result GetRectangle(out Point3d[] corners)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddClippingPlane(Plane plane, System.Double uMagnitude, System.Double vMagnitude, System.Guid clippedViewportId)"] ] @@ -2051,9 +2050,9 @@ "name": "Addcylinder.vb", "code": "Partial Class Examples\n Public Shared Function AddCylinder(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim center_point As New Rhino.Geometry.Point3d(0, 0, 0)\n Dim height_point As New Rhino.Geometry.Point3d(0, 0, 10)\n Dim zaxis As Rhino.Geometry.Vector3d = height_point - center_point\n Dim plane As New Rhino.Geometry.Plane(center_point, zaxis)\n Const radius As Double = 5\n Dim circle As New Rhino.Geometry.Circle(plane, radius)\n Dim cylinder As New Rhino.Geometry.Cylinder(circle, zaxis.Length)\n Dim brep As Rhino.Geometry.Brep = cylinder.ToBrep(True, True)\n If brep IsNot Nothing Then\n doc.Objects.AddBrep(brep)\n doc.Views.Redraw()\n End If\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ + ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"], ["Rhino.Geometry.Cylinder", "Cylinder(Circle baseCircle, double height)"], - ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"], - ["Rhino.Geometry.Plane", "Plane(Point3d origin, Vector3d normal)"] + ["Rhino.Geometry.Cylinder", "Brep ToBrep(System.Boolean capBottom, System.Boolean capTop)"] ] }, { @@ -2079,14 +2078,14 @@ "name": "Addlayout.vb", "code": "Partial Class Examples\n ''' \n ''' Generate a layout with a single detail view that zooms to a list of objects\n ''' \n ''' \n ''' \n Public Shared Function AddLayout(doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n doc.PageUnitSystem = Rhino.UnitSystem.Millimeters\n Dim page_views = doc.Views.GetPageViews()\n Dim page_number As Integer = If((page_views Is Nothing), 1, page_views.Length + 1)\n Dim pageview = doc.Views.AddPageView(String.Format(\"A0_{0}\", page_number), 1189, 841)\n If pageview IsNot Nothing Then\n Dim top_left As New Rhino.Geometry.Point2d(20, 821)\n Dim bottom_right As New Rhino.Geometry.Point2d(1169, 20)\n Dim detail = pageview.AddDetailView(\"ModelView\", top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top)\n If detail IsNot Nothing Then\n pageview.SetActiveDetail(detail.Id)\n detail.Viewport.ZoomExtents()\n detail.DetailGeometry.IsProjectionLocked = True\n detail.DetailGeometry.SetScale(1, doc.ModelUnitSystem, 10, doc.PageUnitSystem)\n ' Commit changes tells the document to replace the document's detail object\n ' with the modified one that we just adjusted\n detail.CommitChanges()\n End If\n pageview.SetPageAsActive()\n doc.Views.ActiveView = pageview\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End If\n Return Rhino.Commands.Result.Failure\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], - ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.RhinoObject", "System.Boolean CommitChanges()"], - ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.Display.RhinoPageView", "DetailViewObject AddDetailView(System.String title, Geometry.Point2d corner0, Geometry.Point2d corner1, DefinedViewportProjection initialProjection)"], ["Rhino.Display.RhinoPageView", "System.Boolean SetActiveDetail(System.Guid detailId)"], ["Rhino.Display.RhinoPageView", "System.Void SetPageAsActive()"], + ["Rhino.Display.RhinoViewport", "System.Boolean ZoomExtents()"], ["Rhino.RhinoDoc", "UnitSystem PageUnitSystem"], + ["Rhino.Geometry.DetailView", "bool IsProjectionLocked"], + ["Rhino.Geometry.DetailView", "System.Boolean SetScale(System.Double modelLength, Rhino.UnitSystem modelUnits, System.Double pageLength, Rhino.UnitSystem pageUnits)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView AddPageView(System.String title, System.Double pageWidth, System.Double pageHeight)"], ["Rhino.DocObjects.Tables.ViewTable", "RhinoPageView[] GetPageViews()"] ] @@ -2097,12 +2096,12 @@ "members": [ ["Rhino.Geometry.Vector2d", "System.Boolean IsTiny(System.Double tolerance)"], ["Rhino.Geometry.Vector3d", "System.Boolean IsTiny(System.Double tolerance)"], - ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.Input.Custom.GetPoint", "GetPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Void DrawLineFromPoint(Point3d startPoint, System.Boolean showDistanceInStatusBar)"], ["Rhino.Input.Custom.GetPoint", "GetResult Get()"], ["Rhino.Input.Custom.GetPoint", "System.Void SetBasePoint(Point3d basePoint, System.Boolean showDistanceInStatusBar)"], + ["Rhino.Input.Custom.GetBaseClass", "Point3d Point()"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void SetCommandPrompt(System.String prompt)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddLine(Point3d from, Point3d to)"] ] }, @@ -2118,8 +2117,8 @@ "name": "Addlineardimension2.vb", "code": "Imports Rhino.Geometry\n\nPartial Class Examples\n Public Shared Function AddLinearDimension2(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim origin As New Point3d(1, 1, 0)\n Dim offset As New Point3d(11, 1, 0)\n Dim pt As New Point3d((offset.X - origin.X) / 2, 3, 0)\n\n Dim plane__1 As Plane = Plane.WorldXY\n plane__1.Origin = origin\n\n Dim u As Double, v As Double\n plane__1.ClosestParameter(origin, u, v)\n Dim ext1 As New Point2d(u, v)\n\n plane__1.ClosestParameter(offset, u, v)\n Dim ext2 As New Point2d(u, v)\n\n plane__1.ClosestParameter(pt, u, v)\n Dim linePt As New Point2d(u, v)\n\n Dim dimension As New LinearDimension(plane__1, ext1, ext2, linePt)\n If doc.Objects.AddLinearDimension(dimension) <> Guid.Empty Then\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End If\n Return Rhino.Commands.Result.Failure\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"], - ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"] + ["Rhino.Geometry.Plane", "System.Boolean ClosestParameter(Point3d testPoint, out System.Double s, out System.Double t)"], + ["Rhino.Geometry.LinearDimension", "LinearDimension(Plane dimensionPlane, Point2d extensionLine1End, Point2d extensionLine2End, Point2d pointOnDimensionLine)"] ] }, { @@ -2187,12 +2186,12 @@ "name": "Addradialdimension.vb", "code": "Imports Rhino\nImports Rhino.DocObjects\nImports Rhino.Commands\nImports Rhino.Geometry\nImports Rhino.Input\n\nNamespace examples_vb\n Public Class AddRadialDimensionCommand\n Inherits Rhino.Commands.Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbAddRadialDimension\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim obj_ref As ObjRef = Nothing\n Dim rc = RhinoGet.GetOneObject(\"Select curve for radius dimension\", True, ObjectType.Curve, obj_ref)\n If rc <> Result.Success Then\n Return rc\n End If\n Dim curve_parameter As Double\n Dim curve = obj_ref.CurveParameter(curve_parameter)\n If curve Is Nothing Then\n Return Result.Failure\n End If\n\n If curve.IsLinear() OrElse curve.IsPolyline() Then\n RhinoApp.WriteLine(\"Curve must be non-linear.\")\n Return Result.[Nothing]\n End If\n\n ' in this example just deal with planar curves\n If Not curve.IsPlanar() Then\n RhinoApp.WriteLine(\"Curve must be planar.\")\n Return Result.[Nothing]\n End If\n\n Dim point_on_curve = curve.PointAt(curve_parameter)\n Dim curvature_vector = curve.CurvatureAt(curve_parameter)\n Dim len = curvature_vector.Length\n If len < RhinoMath.SqrtEpsilon Then\n RhinoApp.WriteLine(\"Curve is almost linear and therefore has no curvature.\")\n Return Result.[Nothing]\n End If\n\n Dim center = point_on_curve + (curvature_vector / (len * len))\n Dim plane As Plane\n curve.TryGetPlane(plane)\n Dim radial_dimension = New RadialDimension(center, point_on_curve, plane.XAxis, plane.Normal, 5.0)\n doc.Objects.AddRadialDimension(radial_dimension)\n doc.Views.Redraw()\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ + ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.Geometry.Curve", "Vector3d CurvatureAt(System.Double t)"], ["Rhino.Geometry.Curve", "System.Boolean IsLinear()"], ["Rhino.Geometry.Curve", "System.Boolean IsPlanar()"], ["Rhino.Geometry.Curve", "System.Boolean IsPolyline()"], ["Rhino.Geometry.Curve", "Point3d PointAt(System.Double t)"], - ["Rhino.DocObjects.ObjRef", "Curve CurveParameter(out System.Double parameter)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddRadialDimension(RadialDimension dimension)"] ] }, @@ -2224,10 +2223,10 @@ "name": "Addtruncatedcone.vb", "code": "Imports Rhino.Geometry\n\nPartial Class Examples\n Public Shared Function AddTruncatedCone(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim bottom_pt As New Point3d(0, 0, 0)\n Const bottom_radius As Double = 2\n Dim bottom_circle As New Circle(bottom_pt, bottom_radius)\n\n Dim top_pt As New Point3d(0, 0, 10)\n Const top_radius As Double = 6\n Dim top_circle As New Circle(top_pt, top_radius)\n\n Dim shapeCurve As New LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0))\n Dim axis As New Line(bottom_circle.Center, top_circle.Center)\n Dim revsrf As RevSurface = RevSurface.Create(shapeCurve, axis)\n Dim tcone_brep As Brep = Brep.CreateFromRevSurface(revsrf, True, True)\n If doc.Objects.AddBrep(tcone_brep) <> Guid.Empty Then\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End If\n Return Rhino.Commands.Result.Failure\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], - ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"], ["Rhino.Geometry.RevSurface", "static RevSurface Create(Curve revoluteCurve, Line axisOfRevolution)"], - ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"] + ["Rhino.Geometry.Circle", "Circle(Point3d center, double radius)"], + ["Rhino.Geometry.Brep", "static Brep CreateFromRevSurface(RevSurface surface, System.Boolean capStart, System.Boolean capEnd)"], + ["Rhino.Geometry.LineCurve", "LineCurve(Point3d from, Point3d to)"] ] }, { @@ -2262,11 +2261,11 @@ "code": "Imports Rhino\n\n _\nPublic Class ArrayByDistanceCommand\n Inherits Rhino.Commands.Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vb_ArrayByDistance\"\n End Get\n End Property\n\n Private m_distance As Double = 1\n Private m_point_start As Rhino.Geometry.Point3d\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As Rhino.Commands.RunMode) As Rhino.Commands.Result\n Dim objref As Rhino.DocObjects.ObjRef = Nothing\n Dim rc = Rhino.Input.RhinoGet.GetOneObject(\"Select object\", True, Rhino.DocObjects.ObjectType.AnyObject, objref)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n\n rc = Rhino.Input.RhinoGet.GetPoint(\"Start point\", False, m_point_start)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n\n Dim obj = objref.Object()\n If obj Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n\n ' create an instance of a GetPoint class and add a delegate\n ' for the DynamicDraw event\n Dim gp = New Rhino.Input.Custom.GetPoint()\n gp.DrawLineFromPoint(m_point_start, True)\n Dim optdouble = New Rhino.Input.Custom.OptionDouble(m_distance)\n Dim constrain As Boolean = False\n Dim optconstrain = New Rhino.Input.Custom.OptionToggle(constrain, \"Off\", \"On\")\n gp.AddOptionDouble(\"Distance\", optdouble)\n gp.AddOptionToggle(\"Constrain\", optconstrain)\n AddHandler gp.DynamicDraw, AddressOf ArrayByDistanceDraw\n gp.Tag = obj\n While gp.Get() = Rhino.Input.GetResult.Option\n m_distance = optdouble.CurrentValue\n If constrain <> optconstrain.CurrentValue Then\n constrain = optconstrain.CurrentValue\n If constrain Then\n Dim gp2 = New Rhino.Input.Custom.GetPoint()\n gp2.DrawLineFromPoint(m_point_start, True)\n gp2.SetCommandPrompt(\"Second point on constraint line\")\n If gp2.Get() = Rhino.Input.GetResult.Point Then\n gp.Constrain(m_point_start, gp2.Point())\n Else\n gp.ClearCommandOptions()\n optconstrain.CurrentValue = False\n constrain = False\n gp.AddOptionDouble(\"Distance\", optdouble)\n gp.AddOptionToggle(\"Constrain\", optconstrain)\n End If\n Else\n gp.ClearConstraints()\n End If\n End If\n End While\n\n If gp.CommandResult() = Rhino.Commands.Result.Success Then\n m_distance = optdouble.CurrentValue\n Dim pt = gp.Point()\n Dim vec = pt - m_point_start\n Dim length As Double = vec.Length\n vec.Unitize()\n Dim count As Integer = CInt(Math.Truncate(length / m_distance))\n For i As Integer = 1 To count - 1\n Dim translate = vec * (i * m_distance)\n Dim xf = Rhino.Geometry.Transform.Translation(translate)\n doc.Objects.Transform(obj, xf, False)\n Next\n doc.Views.Redraw()\n End If\n\n Return gp.CommandResult()\n End Function\n\n ' this function is called whenever the GetPoint's DynamicDraw\n ' event occurs\n Private Sub ArrayByDistanceDraw(sender As Object, e As Rhino.Input.Custom.GetPointDrawEventArgs)\n Dim rhobj As Rhino.DocObjects.RhinoObject = TryCast(e.Source.Tag, Rhino.DocObjects.RhinoObject)\n If rhobj Is Nothing Then\n Return\n End If\n Dim vec = e.CurrentPoint - m_point_start\n Dim length As Double = vec.Length\n vec.Unitize()\n Dim count As Integer = CInt(Math.Truncate(length / m_distance))\n For i As Integer = 1 To count - 1\n Dim translate = vec * (i * m_distance)\n Dim xf = Rhino.Geometry.Transform.Translation(translate)\n e.Display.DrawObject(rhobj, xf)\n Next\n End Sub\nEnd Class\n", "members": [ ["Rhino.Display.DisplayPipeline", "System.Void DrawObject(DocObjects.RhinoObject rhinoObject, Transform xform)"], - ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"], ["Rhino.Input.Custom.GetPoint", "object Tag"], ["Rhino.Input.Custom.GetPoint", "System.Void ClearConstraints()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Point3d from, Point3d to)"], - ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"] + ["Rhino.Input.Custom.GetPointDrawEventArgs", "GetPoint Source"], + ["Rhino.Input.Custom.GetBaseClass", "System.Void ClearCommandOptions()"] ] }, { @@ -2280,9 +2279,9 @@ "name": "Booleandifference.vb", "code": "Imports System.Collections.Generic\n\nPartial Class Examples\n Public Shared Function BooleanDifference(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim rc As Rhino.Commands.Result\n Dim objrefs As Rhino.DocObjects.ObjRef() = Nothing\n rc = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select first set of polysurfaces\", False, Rhino.DocObjects.ObjectType.PolysrfFilter, objrefs)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n If objrefs Is Nothing OrElse objrefs.Length < 1 Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim in_breps0 As New List(Of Rhino.Geometry.Brep)()\n For i As Integer = 0 To objrefs.Length - 1\n Dim brep As Rhino.Geometry.Brep = objrefs(i).Brep()\n If brep IsNot Nothing Then\n in_breps0.Add(brep)\n End If\n Next\n\n doc.Objects.UnselectAll()\n rc = Rhino.Input.RhinoGet.GetMultipleObjects(\"Select second set of polysurfaces\", False, Rhino.DocObjects.ObjectType.PolysrfFilter, objrefs)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n If objrefs Is Nothing OrElse objrefs.Length < 1 Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim in_breps1 As New List(Of Rhino.Geometry.Brep)()\n For i As Integer = 0 To objrefs.Length - 1\n Dim brep As Rhino.Geometry.Brep = objrefs(i).Brep()\n If brep IsNot Nothing Then\n in_breps1.Add(brep)\n End If\n Next\n\n Dim tolerance As Double = doc.ModelAbsoluteTolerance\n Dim breps As Rhino.Geometry.Brep() = Rhino.Geometry.Brep.CreateBooleanDifference(in_breps0, in_breps1, tolerance)\n If breps.Length < 1 Then\n Return Rhino.Commands.Result.[Nothing]\n End If\n For i As Integer = 0 To breps.Length - 1\n doc.Objects.AddBrep(breps(i))\n Next\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ + ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance, System.Boolean manifoldOnly)"], ["Rhino.Geometry.Brep", "static Brep[] CreateBooleanDifference(IEnumerable firstSet, IEnumerable secondSet, System.Double tolerance)"], - ["Rhino.DocObjects.ObjRef", "Brep Brep()"], ["Rhino.Input.RhinoGet", "static Result GetMultipleObjects(System.String prompt, System.Boolean acceptNothing, ObjectType filter, out ObjRef[] rhObjects)"] ] }, @@ -2340,9 +2339,9 @@ "name": "Constrainedcopy.vb", "code": "Partial Class Examples\n Public Shared Function ConstrainedCopy(doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n ' Get a single planar closed curve\n Dim go = New Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select curve\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve\n go.Get()\n If go.CommandResult() <> Rhino.Commands.Result.Success Then\n Return go.CommandResult()\n End If\n Dim objref = go.Object(0)\n Dim base_curve = objref.Curve()\n Dim first_point = objref.SelectionPoint()\n If base_curve Is Nothing OrElse Not first_point.IsValid Then\n Return Rhino.Commands.Result.Cancel\n End If\n\n Dim plane As Rhino.Geometry.Plane\n If Not base_curve.TryGetPlane(plane) Then\n Return Rhino.Commands.Result.Cancel\n End If\n\n ' Get a point constrained to a line passing through the initial selection\n ' point and parallel to the plane's normal\n Dim gp = New Rhino.Input.Custom.GetPoint()\n gp.SetCommandPrompt(\"Offset point\")\n gp.DrawLineFromPoint(first_point, True)\n Dim line = New Rhino.Geometry.Line(first_point, first_point + plane.Normal)\n gp.Constrain(line)\n gp.Get()\n If gp.CommandResult() <> Rhino.Commands.Result.Success Then\n Return gp.CommandResult()\n End If\n Dim second_point = gp.Point()\n Dim vec As Rhino.Geometry.Vector3d = second_point - first_point\n If vec.Length > 0.001 Then\n Dim xf = Rhino.Geometry.Transform.Translation(vec)\n Dim id As Guid = doc.Objects.Transform(objref, xf, False)\n If id <> Guid.Empty Then\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End If\n End If\n Return Rhino.Commands.Result.Cancel\n End Function\nEnd Class\n", "members": [ + ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Geometry.Curve", "System.Boolean TryGetPlane(out Plane plane)"], ["Rhino.Geometry.Transform", "static Transform Translation(Vector3d motion)"], - ["Rhino.DocObjects.ObjRef", "Point3d SelectionPoint()"], ["Rhino.Input.Custom.GetPoint", "System.Boolean Constrain(Line line)"] ] }, @@ -2414,8 +2413,8 @@ "name": "Curvesurfaceintersect.vb", "code": "Imports Rhino\nImports Rhino.Geometry\nImports Rhino.Geometry.Intersect\nImports Rhino.Input.Custom\nImports Rhino.DocObjects\nImports Rhino.Commands\n\nNamespace examples_vb\n Public Class CurveSurfaceIntersectCommand\n Inherits Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbCurveSurfaceIntersect\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim gs = New GetObject()\n gs.SetCommandPrompt(\"select brep\")\n gs.GeometryFilter = ObjectType.Brep\n gs.DisablePreSelect()\n gs.SubObjectSelect = False\n gs.Get()\n If gs.CommandResult() <> Result.Success Then\n Return gs.CommandResult()\n End If\n Dim brep = gs.[Object](0).Brep()\n\n Dim gc = New GetObject()\n gc.SetCommandPrompt(\"select curve\")\n gc.GeometryFilter = ObjectType.Curve\n gc.DisablePreSelect()\n gc.SubObjectSelect = False\n gc.Get()\n If gc.CommandResult() <> Result.Success Then\n Return gc.CommandResult()\n End If\n Dim curve = gc.Object(0).Curve()\n\n If brep Is Nothing OrElse curve Is Nothing Then\n Return Result.Failure\n End If\n\n Dim tolerance = doc.ModelAbsoluteTolerance\n\n Dim intersectionPoints As Point3d() = Nothing\n Dim overlapCurves As Curve() = Nothing\n If Not Intersection.CurveBrep(curve, brep, tolerance, overlapCurves, intersectionPoints) Then\n RhinoApp.WriteLine(\"curve brep intersection failed\")\n Return Result.Nothing\n End If\n\n For Each overlapCurve As Curve In overlapCurves\n doc.Objects.AddCurve(overlapCurve)\n Next\n For Each intersectionPoint As Point3d In intersectionPoints\n doc.Objects.AddPoint(intersectionPoint)\n Next\n\n RhinoApp.WriteLine(\"{0} overlap curves, and {1} intersection points\", overlapCurves.Length, intersectionPoints.Length)\n doc.Views.Redraw()\n\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.Geometry.Intersect.IntersectionEvent", "bool IsOverlap"], + ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveSurface(Curve curve, Surface surface, System.Double tolerance, System.Double overlapTolerance)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Int32 Select(IEnumerable objectIds)"] ] }, @@ -2439,8 +2438,8 @@ "code": "Imports Rhino\nImports Rhino.DocObjects\nImports Rhino.Commands\nImports Rhino.Geometry\n\nNamespace examples_vb\n Public Class ChangeDimensionStyleCommand\n Inherits Rhino.Commands.Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbChangeDimensionStyle\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n For Each rhino_object As RhinoObject In doc.Objects.GetObjectList(ObjectType.Annotation)\n Dim annotation_object = TryCast(rhino_object, AnnotationObjectBase)\n If annotation_object Is Nothing Then\n Continue For\n End If\n\n Dim annotation = TryCast(annotation_object.Geometry, AnnotationBase)\n If annotation Is Nothing Then\n Continue For\n End If\n\n If annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex Then\n Continue For\n End If\n\n annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex\n annotation_object.CommitChanges()\n Next\n\n doc.Views.Redraw()\n\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ ["Rhino.RhinoDoc", "DimStyleTable DimStyles"], - ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"], - ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"] + ["Rhino.DocObjects.Tables.DimStyleTable", "int CurrentIndex"], + ["Rhino.DocObjects.Tables.ObjectTable", "IEnumerable GetObjectList(System.Type typeFilter)"] ] }, { @@ -2522,8 +2521,8 @@ "name": "Evnormal.vb", "code": "Imports Rhino\nImports Rhino.Input.Custom\nImports Rhino.DocObjects\nImports Rhino.Commands\n\nNamespace examples_vb\n Public Class NormalDirectionOfBrepFaceCommand\n Inherits Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbDetermineNormDirectionOfBrepFace\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n ' select a surface\n Dim gs = New GetObject()\n gs.SetCommandPrompt(\"select surface\")\n gs.GeometryFilter = ObjectType.Surface\n gs.DisablePreSelect()\n gs.SubObjectSelect = False\n gs.[Get]()\n If gs.CommandResult() <> Result.Success Then\n Return gs.CommandResult()\n End If\n ' get the selected face\n Dim face = gs.[Object](0).Face()\n If face Is Nothing Then\n Return Result.Failure\n End If\n\n ' pick a point on the surface. Constain\n ' picking to the face.\n Dim gp = New GetPoint()\n gp.SetCommandPrompt(\"select point on surface\")\n gp.Constrain(face, False)\n gp.[Get]()\n If gp.CommandResult() <> Result.Success Then\n Return gp.CommandResult()\n End If\n\n ' get the parameters of the point on the\n ' surface that is clesest to gp.Point()\n Dim u As Double, v As Double\n If face.ClosestPoint(gp.Point(), u, v) Then\n Dim direction = face.NormalAt(u, v)\n If face.OrientationIsReversed Then\n direction.Reverse()\n End If\n RhinoApp.WriteLine(String.Format(\"Surface normal at uv({0:f},{1:f}) = ({2:f},{3:f},{4:f})\", u, v, direction.X, direction.Y, direction.Z))\n End If\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"], - ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"] + ["Rhino.Geometry.BrepFace", "bool OrientationIsReversed"], + ["Rhino.Geometry.Surface", "Vector3d NormalAt(System.Double u, System.Double v)"] ] }, { @@ -2537,8 +2536,8 @@ "name": "Extendcurve.vb", "code": "Imports System.Linq\nImports Rhino\nImports Rhino.Geometry\nImports Rhino.DocObjects\nImports Rhino.Commands\nImports Rhino.Input\nImports Rhino.Input.Custom\n\nNamespace examples_vb\n Public Class ExtendCurveCommand\n Inherits Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbExtendCurve\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim boundary_obj_refs As ObjRef() = Nothing\n Dim rc = RhinoGet.GetMultipleObjects(\"Select boundary objects\", False, ObjectType.AnyObject, boundary_obj_refs)\n If rc <> Result.Success Then\n Return rc\n End If\n If boundary_obj_refs Is Nothing OrElse boundary_obj_refs.Length = 0 Then\n Return Result.[Nothing]\n End If\n\n Dim gc = New GetObject()\n gc.SetCommandPrompt(\"Select curve to extend\")\n gc.GeometryFilter = ObjectType.Curve\n gc.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve\n gc.[Get]()\n If gc.CommandResult() <> Result.Success Then\n Return gc.CommandResult()\n End If\n Dim curve_obj_ref = gc.[Object](0)\n\n Dim curve = curve_obj_ref.Curve()\n If curve Is Nothing Then\n Return Result.Failure\n End If\n Dim t As Double\n If Not curve.ClosestPoint(curve_obj_ref.SelectionPoint(), t) Then\n Return Result.Failure\n End If\n Dim curve_end = If(t <= curve.Domain.Mid, CurveEnd.Start, CurveEnd.[End])\n\n Dim geometry = boundary_obj_refs.[Select](Function(obj) obj.Geometry())\n Dim extended_curve = curve.Extend(curve_end, CurveExtensionStyle.Line, geometry)\n If extended_curve IsNot Nothing AndAlso extended_curve.IsValid Then\n If Not doc.Objects.Replace(curve_obj_ref.ObjectId, extended_curve) Then\n Return Result.Failure\n End If\n doc.Views.Redraw()\n Else\n RhinoApp.WriteLine(\"No boundary object was intersected so curve not extended\")\n Return Result.[Nothing]\n End If\n\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Interval", "double Mid"], - ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"] + ["Rhino.Geometry.Curve", "Curve Extend(CurveEnd side, CurveExtensionStyle style, IEnumerable geometry)"], + ["Rhino.Geometry.Interval", "double Mid"] ] }, { @@ -2590,10 +2589,10 @@ "name": "Hatchcurve.vb", "code": "Partial Class Examples\n Public Shared Function HatchCurve(doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim go = New Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select closed planar curve\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GeometryAttributeFilter = Rhino.Input.[Custom].GeometryAttributeFilter.ClosedCurve\n go.SubObjectSelect = False\n go.Get()\n If go.CommandResult() <> Rhino.Commands.Result.Success Then\n Return go.CommandResult()\n End If\n\n Dim curve = go.Object(0).Curve()\n If curve Is Nothing OrElse Not curve.IsClosed OrElse Not curve.IsPlanar() Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim hatch_name As String = doc.HatchPatterns(doc.HatchPatterns.CurrentHatchPatternIndex).Name\n Dim rc = Rhino.Input.RhinoGet.GetString(\"Hatch pattern\", True, hatch_name)\n If rc <> Rhino.Commands.Result.Success Then\n Return rc\n End If\n hatch_name = hatch_name.Trim()\n If String.IsNullOrWhiteSpace(hatch_name) Then\n Return Rhino.Commands.Result.Nothing\n End If\n Dim index As Integer = doc.HatchPatterns.Find(hatch_name, True)\n If index < 0 Then\n Rhino.RhinoApp.WriteLine(\"Hatch pattern does not exist.\")\n Return Rhino.Commands.Result.Nothing\n End If\n\n Dim hatches = Rhino.Geometry.Hatch.Create(curve, index, 0, 1)\n For i As Integer = 0 To hatches.Length - 1\n doc.Objects.AddHatch(hatches(i))\n Next\n If hatches.Length > 0 Then\n doc.Views.Redraw()\n End If\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], - ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.ModelComponent", "string Name"], ["Rhino.RhinoDoc", "HatchPatternTable HatchPatterns"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale, System.Double tolerance)"], + ["Rhino.Geometry.Hatch", "static Hatch[] Create(Curve curve, System.Int32 hatchPatternIndex, System.Double rotationRadians, System.Double scale)"], ["Rhino.DocObjects.Tables.ObjectTable", "System.Guid AddHatch(Hatch hatch)"], ["Rhino.DocObjects.Tables.HatchPatternTable", "int CurrentHatchPatternIndex"], ["Rhino.DocObjects.Tables.HatchPatternTable", "System.Int32 Find(System.String name, System.Boolean ignoreDeleted)"], @@ -2622,9 +2621,9 @@ "name": "Intersectcurves.vb", "code": "Partial Class Examples\n Public Shared Function IntersectCurves(doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n ' Select two curves to intersect\n Dim go = New Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select two curves\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GetMultiple(2, 2)\n If go.CommandResult() <> Rhino.Commands.Result.Success Then\n Return go.CommandResult()\n End If\n\n ' Validate input\n Dim curveA = go.[Object](0).Curve()\n Dim curveB = go.[Object](1).Curve()\n If curveA Is Nothing OrElse curveB Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n\n ' Calculate the intersection\n Const intersection_tolerance As Double = 0.001\n Const overlap_tolerance As Double = 0.0\n Dim events = Rhino.Geometry.Intersect.Intersection.CurveCurve(curveA, curveB, intersection_tolerance, overlap_tolerance)\n\n ' Process the results\n If events IsNot Nothing Then\n For i As Integer = 0 To events.Count - 1\n Dim ccx_event = events(i)\n doc.Objects.AddPoint(ccx_event.PointA)\n If ccx_event.PointA.DistanceTo(ccx_event.PointB) > Double.Epsilon Then\n doc.Objects.AddPoint(ccx_event.PointB)\n doc.Objects.AddLine(ccx_event.PointA, ccx_event.PointB)\n End If\n Next\n doc.Views.Redraw()\n End If\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], - ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], ["Rhino.DocObjects.ObjRef", "Curve Curve()"], + ["Rhino.Geometry.Point3f", "System.Double DistanceTo(Point3f other)"], + ["Rhino.Geometry.Point3d", "System.Double DistanceTo(Point3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static CurveIntersections CurveCurve(Curve curveA, Curve curveB, System.Double tolerance, System.Double overlapTolerance)"] ] }, @@ -2639,9 +2638,9 @@ "name": "Intersectlines.vb", "code": "Imports Rhino.Geometry\n\nPartial Class Examples\n Public Shared Function IntersectLines(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim go As New Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select lines\")\n go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve\n go.GetMultiple(2, 2)\n If go.CommandResult() <> Rhino.Commands.Result.Success Then\n Return go.CommandResult()\n End If\n If go.ObjectCount <> 2 Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim crv0 As LineCurve = TryCast(go.Object(0).Geometry(), LineCurve)\n Dim crv1 As LineCurve = TryCast(go.Object(1).Geometry(), LineCurve)\n If crv0 Is Nothing OrElse crv1 Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n\n Dim line0 As Line = crv0.Line\n Dim line1 As Line = crv1.Line\n Dim v0 As Vector3d = line0.Direction\n v0.Unitize()\n Dim v1 As Vector3d = line1.Direction\n v1.Unitize()\n\n If v0.IsParallelTo(v1) <> 0 Then\n Rhino.RhinoApp.WriteLine(\"Selected lines are parallel.\")\n Return Rhino.Commands.Result.[Nothing]\n End If\n\n Dim a As Double, b As Double\n If Not Rhino.Geometry.Intersect.Intersection.LineLine(line0, line1, a, b) Then\n Rhino.RhinoApp.WriteLine(\"No intersection found.\")\n Return Rhino.Commands.Result.[Nothing]\n End If\n\n Dim pt0 As Point3d = line0.PointAt(a)\n Dim pt1 As Point3d = line1.PointAt(b)\n ' pt0 and pt1 should be equal, so we will only add pt0 to the document\n doc.Objects.AddPoint(pt0)\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Line", "Vector3d Direction"], ["Rhino.Geometry.Line", "Point3d PointAt(System.Double t)"], + ["Rhino.Geometry.Vector3d", "System.Int32 IsParallelTo(Vector3d other)"], ["Rhino.Geometry.Intersect.Intersection", "static System.Boolean LineLine(Line lineA, Line lineB, out System.Double a, out System.Double b)"] ] }, @@ -2649,8 +2648,8 @@ "name": "Isbrepbox.vb", "code": "Partial Class Examples\n Public Shared Function IsBrepBox(brep As Rhino.Geometry.Brep) As Boolean\n Const zero_tolerance As Double = 0.000001 ' or whatever\n Dim rc As Boolean = brep.IsSolid\n If rc Then\n rc = brep.Faces.Count = 6\n End If\n\n Dim N = New Rhino.Geometry.Vector3d(5) {}\n Dim i As Integer = 0\n While rc AndAlso i < 6\n Dim plane As Rhino.Geometry.Plane\n rc = brep.Faces(i).TryGetPlane(plane, zero_tolerance)\n If rc Then\n N(i) = plane.ZAxis\n N(i).Unitize()\n End If\n i += 1\n End While\n\n i = 0\n While rc AndAlso i < 6\n Dim count As Integer = 0\n Dim j As Integer = 0\n While rc AndAlso j < 6\n Dim dot As Double = Math.Abs(N(i) * N(j))\n If dot <= zero_tolerance Then\n Continue While\n End If\n If Math.Abs(dot - 1.0) <= zero_tolerance Then\n count += 1\n Else\n rc = False\n End If\n j += 1\n End While\n\n If rc Then\n If 2 <> count Then\n rc = False\n End If\n End If\n i += 1\n End While\n Return rc\n End Function\n\n Public Shared Function TestBrepBox(doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim obj_ref As Rhino.DocObjects.ObjRef = Nothing\n Dim rc = Rhino.Input.RhinoGet.GetOneObject(\"Select Brep\", True, Rhino.DocObjects.ObjectType.Brep, obj_ref)\n If rc = Rhino.Commands.Result.Success Then\n Dim brep = obj_ref.Brep()\n If brep IsNot Nothing Then\n If IsBrepBox(brep) Then\n Rhino.RhinoApp.WriteLine(\"Yes it is a box\")\n Else\n Rhino.RhinoApp.WriteLine(\"No it is not a box\")\n End If\n End If\n End If\n Return rc\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"], - ["Rhino.Geometry.Brep", "bool IsSolid"] + ["Rhino.Geometry.Brep", "bool IsSolid"], + ["Rhino.Geometry.Surface", "System.Boolean TryGetPlane(out Plane plane, System.Double tolerance)"] ] }, { @@ -2664,8 +2663,8 @@ "name": "Issurfaceinplane.vb", "code": "Imports System.Linq\nImports Rhino\nImports Rhino.DocObjects\nImports Rhino.Geometry\nImports Rhino.Commands\nImports Rhino.Input\n\nNamespace examples_vb\n Public Class IsPlanarSurfaceInPlaneCommand\n Inherits Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbIsPlanarSurfaceInPlane\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim obj_ref As ObjRef = Nothing\n Dim rc = RhinoGet.GetOneObject(\"select surface\", True, ObjectType.Surface, obj_ref)\n If rc <> Result.Success Then\n Return rc\n End If\n Dim surface = obj_ref.Surface()\n\n Dim corners As Point3d() = Nothing\n rc = RhinoGet.GetRectangle(corners)\n If rc <> Result.Success Then\n Return rc\n End If\n\n Dim plane = New Plane(corners(0), corners(1), corners(2))\n\n Dim is_or_isnt = If(IsSurfaceInPlane(surface, plane, doc.ModelAbsoluteTolerance), \"\", \" not \")\n RhinoApp.WriteLine(\"Surface is{0} in plane.\", is_or_isnt)\n Return Result.Success\n End Function\n\n Private Function IsSurfaceInPlane(surface As Surface, plane As Plane, tolerance As Double) As Boolean\n If Not surface.IsPlanar(tolerance) Then\n Return False\n End If\n\n Dim bbox = surface.GetBoundingBox(True)\n Return bbox.GetCorners().All(Function(corner) Math.Abs(plane.DistanceTo(corner)) <= tolerance)\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"], - ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"] + ["Rhino.Geometry.Plane", "System.Double DistanceTo(Point3d testPoint)"], + ["Rhino.Geometry.Surface", "System.Boolean IsPlanar()"] ] }, { @@ -2788,11 +2787,11 @@ "name": "Orientonsrf.vb", "code": "Partial Class Examples\n Public Shared Function OrientOnSrf(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n ' Select objects to orient\n Dim go As New Rhino.Input.Custom.GetObject()\n go.SetCommandPrompt(\"Select objects to orient\")\n go.SubObjectSelect = False\n go.GroupSelect = True\n go.GetMultiple(1, 0)\n If go.CommandResult() <> Rhino.Commands.Result.Success Then\n Return go.CommandResult()\n End If\n\n ' Point to orient from\n Dim gp As New Rhino.Input.Custom.GetPoint()\n gp.SetCommandPrompt(\"Point to orient from\")\n gp.Get()\n If gp.CommandResult() <> Rhino.Commands.Result.Success Then\n Return gp.CommandResult()\n End If\n\n ' Define source plane\n Dim view As Rhino.Display.RhinoView = gp.View()\n If view Is Nothing Then\n view = doc.Views.ActiveView\n If view Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n End If\n Dim source_plane As Rhino.Geometry.Plane = view.ActiveViewport.ConstructionPlane()\n source_plane.Origin = gp.Point()\n\n ' Surface to orient on\n Dim gs As New Rhino.Input.Custom.GetObject()\n gs.SetCommandPrompt(\"Surface to orient on\")\n gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface\n gs.SubObjectSelect = True\n gs.DeselectAllBeforePostSelect = False\n gs.OneByOnePostSelect = True\n gs.Get()\n If gs.CommandResult() <> Rhino.Commands.Result.Success Then\n Return gs.CommandResult()\n End If\n\n Dim objref As Rhino.DocObjects.ObjRef = gs.[Object](0)\n ' get selected surface object\n Dim obj As Rhino.DocObjects.RhinoObject = objref.[Object]()\n If obj Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n ' get selected surface (face)\n Dim surface As Rhino.Geometry.Surface = objref.Surface()\n If surface Is Nothing Then\n Return Rhino.Commands.Result.Failure\n End If\n ' Unselect surface\n obj.[Select](False)\n\n ' Point on surface to orient to\n gp.SetCommandPrompt(\"Point on surface to orient to\")\n gp.Constrain(surface, False)\n gp.Get()\n If gp.CommandResult() <> Rhino.Commands.Result.Success Then\n Return gp.CommandResult()\n End If\n\n ' Do transformation\n Dim rc As Rhino.Commands.Result = Rhino.Commands.Result.Failure\n Dim u As Double, v As Double\n If surface.ClosestPoint(gp.Point(), u, v) Then\n Dim target_plane As Rhino.Geometry.Plane\n If surface.FrameAt(u, v, target_plane) Then\n ' Build transformation\n Dim xform As Rhino.Geometry.Transform = Rhino.Geometry.Transform.PlaneToPlane(source_plane, target_plane)\n\n ' Do the transformation. In this example, we will copy the original objects\n Const delete_original As Boolean = False\n For i As Integer = 0 To go.ObjectCount - 1\n doc.Objects.Transform(go.[Object](i), xform, delete_original)\n Next\n\n doc.Views.Redraw()\n rc = Rhino.Commands.Result.Success\n End If\n End If\n Return rc\n End Function\nEnd Class\n", "members": [ - ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], - ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.DocObjects.RhinoObject", "System.Int32 Select(System.Boolean on)"], ["Rhino.DocObjects.ObjRef", "RhinoObject Object()"], ["Rhino.DocObjects.ObjRef", "Surface Surface()"], + ["Rhino.Geometry.Surface", "System.Boolean ClosestPoint(Point3d testPoint, out System.Double u, out System.Double v)"], + ["Rhino.Geometry.Surface", "System.Boolean FrameAt(System.Double u, System.Double v, out Plane frame)"], ["Rhino.Input.Custom.GetObject", "bool DeselectAllBeforePostSelect"], ["Rhino.Input.Custom.GetObject", "ObjectType GeometryFilter"], ["Rhino.Input.Custom.GetObject", "bool GroupSelect"], @@ -2821,8 +2820,8 @@ "name": "Pointatcursor.vb", "code": "Imports Rhino\nImports Rhino.Commands\nImports Rhino.DocObjects\n\nNamespace examples_vb\n Public Class PointAtCursorCommand\n Inherits Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbPointAtCursor\"\n End Get\n End Property\n\n _\n Public Shared Function GetCursorPos(ByRef point As System.Drawing.Point) As Boolean\n End Function\n\n _\n Public Shared Function ScreenToClient(hWnd As IntPtr, ByRef point As System.Drawing.Point) As Boolean\n End Function\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim result__1 = Result.Failure\n Dim view = doc.Views.ActiveView\n If view Is Nothing Then\n Return result__1\n End If\n\n Dim windowsDrawingPoint As System.Drawing.Point\n If Not GetCursorPos(windowsDrawingPoint) OrElse Not ScreenToClient(view.Handle, windowsDrawingPoint) Then\n Return result__1\n End If\n\n Dim xform = view.ActiveViewport.GetTransform(CoordinateSystem.Screen, CoordinateSystem.World)\n Dim point = New Rhino.Geometry.Point3d(windowsDrawingPoint.X, windowsDrawingPoint.Y, 0.0)\n RhinoApp.WriteLine([String].Format(\"screen point: ({0}, {1}, {2})\", point.X, point.Y, point.Z))\n point.Transform(xform)\n RhinoApp.WriteLine([String].Format(\"world point: ({0}, {1}, {2})\", point.X, point.Y, point.Z))\n result__1 = Result.Success\n Return result__1\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Point3d", "System.Void Transform(Transform xform)"], - ["Rhino.Display.RhinoViewport", "Transform GetTransform(DocObjects.CoordinateSystem sourceSystem, DocObjects.CoordinateSystem destinationSystem)"] + ["Rhino.Display.RhinoViewport", "Transform GetTransform(DocObjects.CoordinateSystem sourceSystem, DocObjects.CoordinateSystem destinationSystem)"], + ["Rhino.Geometry.Point3d", "System.Void Transform(Transform xform)"] ] }, { @@ -2882,8 +2881,8 @@ "name": "Replacehatchpattern.vb", "code": "Imports Rhino\nImports Rhino.DocObjects\nImports Rhino.Commands\nImports Rhino.Input\nImports Rhino.Input.Custom\n\nNamespace examples_vb\n Public Class ReplaceHatchPatternCommand\n Inherits Rhino.Commands.Command\n Public Overrides ReadOnly Property EnglishName() As String\n Get\n Return \"vbReplaceHatchPattern\"\n End Get\n End Property\n\n Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result\n Dim obj_refs As ObjRef() = Nothing\n Dim rc = RhinoGet.GetMultipleObjects(\"Select hatches to replace\", False, ObjectType.Hatch, obj_refs)\n If rc <> Result.Success OrElse obj_refs Is Nothing Then\n Return rc\n End If\n\n Dim gs = New GetString()\n gs.SetCommandPrompt(\"Name of replacement hatch pattern\")\n gs.AcceptNothing(False)\n gs.[Get]()\n If gs.CommandResult() <> Result.Success Then\n Return gs.CommandResult()\n End If\n Dim hatch_name = gs.StringResult()\n\n Dim pattern_index = doc.HatchPatterns.Find(hatch_name, True)\n\n If pattern_index < 0 Then\n RhinoApp.WriteLine(\"The hatch pattern \"\"{0}\"\" not found in the document.\", hatch_name)\n Return Result.[Nothing]\n End If\n\n For Each obj_ref As ObjRef In obj_refs\n Dim hatch_object = TryCast(obj_ref.[Object](), HatchObject)\n If hatch_object.HatchGeometry.PatternIndex <> pattern_index Then\n hatch_object.HatchGeometry.PatternIndex = pattern_index\n hatch_object.CommitChanges()\n End If\n Next\n doc.Views.Redraw()\n Return Result.Success\n End Function\n End Class\nEnd Namespace", "members": [ - ["Rhino.Geometry.Hatch", "int PatternIndex"], - ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"] + ["Rhino.DocObjects.HatchObject", "Hatch HatchGeometry"], + ["Rhino.Geometry.Hatch", "int PatternIndex"] ] }, { @@ -2918,8 +2917,8 @@ "code": "Partial Class Examples\n Public Shared Function SelLayer(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result\n Dim rc As Rhino.Commands.Result\n ' Prompt for a layer name\n Dim layername As String = doc.Layers.CurrentLayer.Name\n rc = Rhino.Input.RhinoGet.GetString(\"Name of layer to select objects\", True, layername)\n If rc <> Rhino.Commands.Result.Success Then Return rc\n\n ' Get all of the objects on the layer. If layername is bogus, you will\n ' just get an empty list back\n Dim rhobjs As Rhino.DocObjects.RhinoObject() = doc.Objects.FindByLayer(layername)\n If rhobjs Is Nothing OrElse rhobjs.Length < 1 Then\n Return Rhino.Commands.Result.Cancel\n End If\n\n For i As Integer = 0 To rhobjs.Length - 1\n rhobjs(i).Select(True)\n Next\n doc.Views.Redraw()\n Return Rhino.Commands.Result.Success\n End Function\nEnd Class\n", "members": [ ["Rhino.DocObjects.Layer", "string Name"], - ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"], - ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"] + ["Rhino.DocObjects.Tables.LayerTable", "Layer CurrentLayer"], + ["Rhino.DocObjects.Tables.ObjectTable", "RhinoObject[] FindByLayer(System.String layerName)"] ] }, {