public override bool LoadGeometry(Rhino.RhinoDoc doc) { RhinoObject obj = doc.Objects.Find(ReferenceID); if (obj == null) { return(false); } //if (obj.Geometry.ObjectType == ObjectType.Curve) //{ // var c = (Curve)obj.Geometry; // // m_value = RhinoMeshSupport.ExtractTMesh(c); // ClearCaches(); // return true; //} if (obj.Geometry.ObjectType == ObjectType.Mesh) { var m = (Mesh)obj.Geometry; m_value = RhinoSupport.ToPlanktonMesh(m); ClearCaches(); return(true); } return(false); }
public static Rhino.Commands.Result FindObjectsByName(Rhino.RhinoDoc doc) { const string name = "abc"; Rhino.DocObjects.ObjectEnumeratorSettings settings = new Rhino.DocObjects.ObjectEnumeratorSettings(); settings.NameFilter = name; System.Collections.Generic.List <Guid> ids = new System.Collections.Generic.List <Guid>(); foreach (Rhino.DocObjects.RhinoObject rhObj in doc.Objects.GetObjectList(settings)) { ids.Add(rhObj.Id); } if (ids.Count == 0) { Rhino.RhinoApp.WriteLine("No objects with the name " + name); return(Rhino.Commands.Result.Failure); } Rhino.RhinoApp.WriteLine("Found {0} objects", ids.Count); foreach (Guid id in ids) { Rhino.RhinoApp.WriteLine(" {0}", id); } return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result Stretch(Rhino.RhinoDoc doc) { ObjectType filter = SpaceMorphObjectFilter(); Rhino.DocObjects.ObjRef objref; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select object to stretch", false, filter, out objref); if (rc != Rhino.Commands.Result.Success || objref == null) { return(rc); } Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane(); Rhino.Geometry.Line axis; rc = Rhino.Input.RhinoGet.GetLine(out axis); if (rc != Rhino.Commands.Result.Success || axis == null) { return(rc); } Rhino.Geometry.Morphs.StretchSpaceMorph morph = new Rhino.Geometry.Morphs.StretchSpaceMorph(axis.From, axis.To, axis.Length * 1.5); Rhino.Geometry.GeometryBase geom = objref.Geometry().Duplicate(); if (morph.Morph(geom)) { doc.Objects.Add(geom); doc.Views.Redraw(); } return(Rhino.Commands.Result.Success); }
public FindForm(List <Rhino.DocObjects.RhinoObject> input, Rhino.RhinoDoc _doc) { InitializeComponent(); objects = input; doc = _doc; setfocustoitem(index); }
public static Rhino.Commands.Result AddMesh(Rhino.RhinoDoc doc) { Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh(); mesh.Vertices.Add(0.0, 0.0, 1.0); //0 mesh.Vertices.Add(1.0, 0.0, 1.0); //1 mesh.Vertices.Add(2.0, 0.0, 1.0); //2 mesh.Vertices.Add(3.0, 0.0, 0.0); //3 mesh.Vertices.Add(0.0, 1.0, 1.0); //4 mesh.Vertices.Add(1.0, 1.0, 2.0); //5 mesh.Vertices.Add(2.0, 1.0, 1.0); //6 mesh.Vertices.Add(3.0, 1.0, 0.0); //7 mesh.Vertices.Add(0.0, 2.0, 1.0); //8 mesh.Vertices.Add(1.0, 2.0, 1.0); //9 mesh.Vertices.Add(2.0, 2.0, 1.0); //10 mesh.Vertices.Add(3.0, 2.0, 1.0); //11 mesh.Faces.AddFace(0, 1, 5, 4); mesh.Faces.AddFace(1, 2, 6, 5); mesh.Faces.AddFace(2, 3, 7, 6); mesh.Faces.AddFace(4, 5, 9, 8); mesh.Faces.AddFace(5, 6, 10, 9); mesh.Faces.AddFace(6, 7, 11, 10); mesh.Normals.ComputeNormals(); mesh.Compact(); if (doc.Objects.AddMesh(mesh) != Guid.Empty) { doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
public static Rhino.Commands.Result AddLine(Rhino.RhinoDoc doc) { Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint(); gp.SetCommandPrompt("Start of line"); gp.Get(); if (gp.CommandResult() != Rhino.Commands.Result.Success) { return(gp.CommandResult()); } Rhino.Geometry.Point3d pt_start = gp.Point(); gp.SetCommandPrompt("End of line"); gp.SetBasePoint(pt_start, false); gp.DrawLineFromPoint(pt_start, true); gp.Get(); if (gp.CommandResult() != Rhino.Commands.Result.Success) { return(gp.CommandResult()); } Rhino.Geometry.Point3d pt_end = gp.Point(); Rhino.Geometry.Vector3d v = pt_end - pt_start; if (v.IsTiny(Rhino.RhinoMath.ZeroTolerance)) { return(Rhino.Commands.Result.Nothing); } if (doc.Objects.AddLine(pt_start, pt_end) != Guid.Empty) { doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode) { var type = typeof(MyPanel); Rhino.UI.Panels.OpenPanel(type.GUID); return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result ArcLengthPoint(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef objref; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select curve", true, Rhino.DocObjects.ObjectType.Curve, out objref); if (rc != Rhino.Commands.Result.Success) { return(rc); } Rhino.Geometry.Curve crv = objref.Curve(); if (crv == null) { return(Rhino.Commands.Result.Failure); } double crv_length = crv.GetLength(); double length = 0; rc = Rhino.Input.RhinoGet.GetNumber("Length from start", true, ref length, 0, crv_length); if (rc != Rhino.Commands.Result.Success) { return(rc); } Rhino.Geometry.Point3d pt = crv.PointAtLength(length); if (pt.IsValid) { doc.Objects.AddPoint(pt); doc.Views.Redraw(); } return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result AddObjectsToGroup(Rhino.RhinoDoc doc) { Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject(); go.SetCommandPrompt("Select objects to group"); go.GroupSelect = true; go.GetMultiple(1, 0); if (go.CommandResult() != Rhino.Commands.Result.Success) { return(go.CommandResult()); } List <Guid> ids = new List <Guid>(); for (int i = 0; i < go.ObjectCount; i++) { ids.Add(go.Object(i).ObjectId); } int index = doc.Groups.Add(ids); doc.Views.Redraw(); if (index >= 0) { return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
public static Rhino.Commands.Result EditText(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef objref; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select text", false, Rhino.DocObjects.ObjectType.Annotation, out objref); if (rc != Rhino.Commands.Result.Success || objref == null) { return(rc); } Rhino.DocObjects.TextObject textobj = objref.Object() as Rhino.DocObjects.TextObject; if (textobj == null) { return(Rhino.Commands.Result.Failure); } Rhino.Geometry.TextEntity textentity = textobj.Geometry as Rhino.Geometry.TextEntity; if (textentity == null) { return(Rhino.Commands.Result.Failure); } string str = textentity.Text; rc = Rhino.Input.RhinoGet.GetString("New text", false, ref str); if (rc != Rhino.Commands.Result.Success) { return(rc); } textentity.Text = str; textobj.CommitChanges(); doc.Views.Redraw(); return(Rhino.Commands.Result.Success); }
/// <summary> /// Generate a layout with a single detail view that zooms to a list of objects /// </summary> /// <param name="doc"></param> /// <returns></returns> public static Rhino.Commands.Result AddLayout(Rhino.RhinoDoc doc) { doc.PageUnitSystem = Rhino.UnitSystem.Millimeters; var page_views = doc.Views.GetPageViews(); int page_number = (page_views == null) ? 1 : page_views.Length + 1; var pageview = doc.Views.AddPageView(string.Format("A0_{0}", page_number), 1189, 841); if (pageview != null) { Rhino.Geometry.Point2d top_left = new Rhino.Geometry.Point2d(20, 821); Rhino.Geometry.Point2d bottom_right = new Rhino.Geometry.Point2d(1169, 20); var detail = pageview.AddDetailView("ModelView", top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top); if (detail != null) { pageview.SetActiveDetail(detail.Id); detail.Viewport.ZoomExtents(); detail.DetailGeometry.IsProjectionLocked = true; detail.DetailGeometry.SetScale(1, doc.ModelUnitSystem, 10, doc.PageUnitSystem); // Commit changes tells the document to replace the document's detail object // with the modified one that we just adjusted detail.CommitChanges(); } pageview.SetPageAsActive(); doc.Views.ActiveView = pageview; doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
///<summary> This gets called when when the user runs this command.</summary> protected override Result RunCommand(Rhino.RhinoDoc doc, RunMode mode) { Pach_Absorption_Designer PAD = new Pach_Absorption_Designer(); PAD.Show(); return(Result.Success); }
///<summary>Creates a bitmap preview image of model.</summary> ///<param name='imagePath'> ///[in] The name of the bitmap file to create. The extension of the imagePath controls ///the format of the bitmap file created (bmp, tga, jpg, pcx, png, tif). ///</param> ///<param name='size'>[in] The width and height of the bitmap in pixels.</param> ///<param name="ignoreHighlights">true if highlighted elements should be drawn normally.</param> ///<param name="drawConstructionPlane">true if the CPlane should be drawn.</param> /// <param name="useGhostedShading">true if ghosted shading (partially transparent shading) should be used.</param> ///<returns>true if successful.</returns> public bool CreateShadedPreviewImage(string imagePath, System.Drawing.Size size, bool ignoreHighlights, bool drawConstructionPlane, bool useGhostedShading) { int settings = 0; if (ignoreHighlights) { settings |= 0x1; } if (drawConstructionPlane) { settings |= 0x2; } if (useGhostedShading) { settings |= 0x4; } Rhino.RhinoDoc doc = Document; Guid id = MainViewport.Id; // 11-Apr-2013 Dale Fugier, http://mcneel.myjetbrains.com/youtrack/issue/RH-18332 // return doc.CreatePreviewImage(imagePath, id, size, settings, true); return(doc.CreatePreviewImage(imagePath, id, size, settings, false)); }
public static Rhino.Commands.Result TweenCurve(Rhino.RhinoDoc doc) { Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject(); go.SetCommandPrompt("Select two curves"); go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve; go.GetMultiple(2, 2); if (go.CommandResult() != Rhino.Commands.Result.Success) { return(go.CommandResult()); } Rhino.Geometry.Curve curve0 = go.Object(0).Curve(); Rhino.Geometry.Curve curve1 = go.Object(1).Curve(); if (null != curve0 && null != curve1) { Rhino.Geometry.Curve[] curves = Rhino.Geometry.Curve.CreateTweenCurves(curve0, curve1, 1); if (null != curves) { for (int i = 0; i < curves.Length; i++) { doc.Objects.AddCurve(curves[i]); } doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } } return(Rhino.Commands.Result.Failure); }
public static Rhino.Commands.Result ZoomToObject(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef rhObject; var rc = Rhino.Input.RhinoGet.GetOneObject("Select object to zoom", false, Rhino.DocObjects.ObjectType.None, out rhObject); if (rc != Rhino.Commands.Result.Success) { return(rc); } var obj = rhObject.Object(); var view = doc.Views.ActiveView; if (obj == null || view == null) { return(Rhino.Commands.Result.Failure); } var bbox = obj.Geometry.GetBoundingBox(true); const double pad = 0.05; // A little padding... double dx = (bbox.Max.X - bbox.Min.X) * pad; double dy = (bbox.Max.Y - bbox.Min.Y) * pad; double dz = (bbox.Max.Z - bbox.Min.Z) * pad; bbox.Inflate(dx, dy, dz); view.ActiveViewport.ZoomBoundingBox(bbox); view.Redraw(); return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result InstanceDefinitionObjects(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef objref; var rc = Rhino.Input.RhinoGet.GetOneObject("Select instance", false, Rhino.DocObjects.ObjectType.InstanceReference, out objref); if (rc != Rhino.Commands.Result.Success) { return(rc); } var iref = objref.Object() as Rhino.DocObjects.InstanceObject; if (iref != null) { var idef = iref.InstanceDefinition; if (idef != null) { var rhino_objects = idef.GetObjects(); for (int i = 0; i < rhino_objects.Length; i++) { Rhino.RhinoApp.WriteLine("Object {0} = {1}", i, rhino_objects[i].Id); } } } return(Rhino.Commands.Result.Success); }
protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode) { string filename = string.Empty; if (mode == Rhino.Commands.RunMode.Interactive) { filename = Rhino.Input.RhinoGet.GetFileName(Rhino.Input.Custom.GetFileNameMode.OpenRhinoOnly, null, "Import", Rhino.RhinoApp.MainWindow()); } else { Rhino.Input.RhinoGet.GetString("Name of Rhino file to import", false, ref filename); } filename = filename.Trim(); if (string.IsNullOrEmpty(filename)) { return(Rhino.Commands.Result.Cancel); } if (!System.IO.File.Exists(filename)) { Rhino.RhinoApp.WriteLine("File not found."); return(Rhino.Commands.Result.Failure); } // Make sure to surround filename string with double-quote characters // in case the path contains spaces. string script = string.Format("_-Import \"{0}\" _Enter", filename); Rhino.RhinoApp.RunScript(script, false); return(Rhino.Commands.Result.Success); }
//If any ON_BinaryArchive::Write*() functions return false than you should //immediately return false otherwise return true if all data was written //successfully. Returning false will cause Rhino to stop writing this document. protected override void WriteDocument(Rhino.RhinoDoc doc, Rhino.FileIO.BinaryArchiveWriter archive, Rhino.FileIO.FileWriteOptions options) { //This function is called because ShouldCallWriteDocument returned True. //Write your plug-in data to the document string date_string = System.DateTime.Now.ToShortDateString(); string time_string = System.DateTime.Now.ToShortTimeString(); //It is a good idea to always start with a version number //so you can modify your document read/write code in the future archive.Write3dmChunkVersion(1, 0); archive.WriteString(date_string); archive.WriteString(time_string); UI.Pach_Source_Object S_command = Pach_Source_Object.Instance; UI.Pach_Receiver_Object R_command = Pach_Receiver_Object.Instance; foreach (System.Guid ID in SourceConduit.Instance.UUID) { System.Guid N_ID = new System.Guid(ID.ToString()); archive.WriteGuid(N_ID); archive.WriteString("Source"); } foreach (System.Guid ID in ReceiverConduit.Instance.UUID) { System.Guid N_ID = new System.Guid(ID.ToString()); archive.WriteGuid(N_ID); archive.WriteString("Receiver"); } }
public static Rhino.Commands.Result DupBorder(Rhino.RhinoDoc doc) { const ObjectType filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter; Rhino.DocObjects.ObjRef objref; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", false, filter, out objref); if (rc != Rhino.Commands.Result.Success || objref == null) { return(rc); } Rhino.DocObjects.RhinoObject rhobj = objref.Object(); Rhino.Geometry.Brep brep = objref.Brep(); if (rhobj == null || brep == null) { return(Rhino.Commands.Result.Failure); } rhobj.Select(false); Rhino.Geometry.Curve[] curves = brep.DuplicateEdgeCurves(true); double tol = doc.ModelAbsoluteTolerance * 2.1; curves = Rhino.Geometry.Curve.JoinCurves(curves, tol); for (int i = 0; i < curves.Length; i++) { Guid id = doc.Objects.AddCurve(curves[i]); doc.Objects.Select(id); } doc.Views.Redraw(); return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result AddClippingPlane(Rhino.RhinoDoc doc) { // Define the corners of the clipping plane Rhino.Geometry.Point3d[] corners; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetRectangle(out corners); if (rc != Rhino.Commands.Result.Success) { return(rc); } // Get the active view Rhino.Display.RhinoView view = doc.Views.ActiveView; if (view == null) { return(Rhino.Commands.Result.Failure); } Rhino.Geometry.Point3d p0 = corners[0]; Rhino.Geometry.Point3d p1 = corners[1]; Rhino.Geometry.Point3d p3 = corners[3]; // Create a plane from the corner points Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(p0, p1, p3); // Add a clipping plane object to the document Guid id = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID); if (id != Guid.Empty) { doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
public override void BakeGeometry(Rhino.RhinoDoc doc, Rhino.DocObjects.ObjectAttributes att, List <Guid> obj_ids) { if (this.BKGT != null) { this.BKGT(doc, att, obj_ids); } }
public override void BakeGeometry(Rhino.RhinoDoc doc, Rhino.DocObjects.ObjectAttributes att, List <Guid> obj_ids) { if (lpS != null) { foreach (GH_particleSystem pS in lpS) { if (pS != null) { if (pS.BKGT != null) { pS.BKGT(doc, att, obj_ids); } } } } if (_VN) { var x = FriedChiken.getParticles(); for (int i = 0; i < FriedChiken.nParticles; i++) { Rhino.DocObjects.ObjectAttributes a2 = att.Duplicate(); a2.LayerIndex = 2; obj_ids.Add(doc.Objects.AddTextDot(new Rhino.Geometry.TextDot(i.ToString("000"), new Rhino.Geometry.Point3d(x[i, 0] + __dist, x[i, 1], x[i, 2])), a2)); } } base.BakeGeometry(doc, att, obj_ids); }
public static Rhino.Commands.Result AddLinearDimension2(Rhino.RhinoDoc doc) { Point3d origin = new Point3d(1, 1, 0); Point3d offset = new Point3d(11, 1, 0); Point3d pt = new Point3d((offset.X - origin.X) / 2, 3, 0); Plane plane = Plane.WorldXY; plane.Origin = origin; double u, v; plane.ClosestParameter(origin, out u, out v); Point2d ext1 = new Point2d(u, v); plane.ClosestParameter(offset, out u, out v); Point2d ext2 = new Point2d(u, v); plane.ClosestParameter(pt, out u, out v); Point2d linePt = new Point2d(u, v); LinearDimension dimension = new LinearDimension(plane, ext1, ext2, linePt); if (doc.Objects.AddLinearDimension(dimension) != Guid.Empty) { doc.Views.Redraw(); return(Rhino.Commands.Result.Success); } return(Rhino.Commands.Result.Failure); }
public static Rhino.Commands.Result SelLayer(Rhino.RhinoDoc doc) { // Prompt for a layer name string layername = doc.Layers.CurrentLayer.Name; Result rc = Rhino.Input.RhinoGet.GetString("Name of layer to select objects", true, ref layername); if (rc != Rhino.Commands.Result.Success) { return(rc); } // Get all of the objects on the layer. If layername is bogus, you will // just get an empty list back Rhino.DocObjects.RhinoObject[] rhobjs = doc.Objects.FindByLayer(layername); if (rhobjs == null || rhobjs.Length < 1) { return(Rhino.Commands.Result.Cancel); } for (int i = 0; i < rhobjs.Length; i++) { rhobjs[i].Select(true); } doc.Views.Redraw(); return(Rhino.Commands.Result.Success); }
public static Rhino.Commands.Result ShowSurfaceDirection(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef objref; var rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface for direction display", false, Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter, out objref); if (rc != Rhino.Commands.Result.Success) { return(rc); } var brep = objref.Brep(); if (brep == null) { return(Rhino.Commands.Result.Failure); } bool bIsSolid = brep.IsSolid; TestSurfaceDirConduit conduit = new TestSurfaceDirConduit(brep); conduit.Enabled = true; doc.Views.Redraw(); var gf = new Rhino.Input.Custom.GetOption(); gf.SetCommandPrompt("Press enter when done"); gf.AcceptNothing(true); if (!bIsSolid) { gf.AddOption("Flip"); } for (; ;) { var res = gf.Get(); if (res == Rhino.Input.GetResult.Option) { conduit.Flip = !conduit.Flip; doc.Views.Redraw(); continue; } if (res == Rhino.Input.GetResult.Nothing) { if (!bIsSolid && conduit.Flip) { brep.Flip(); doc.Objects.Replace(objref, brep); } } break; } conduit.Enabled = false; doc.Views.Redraw(); return(Rhino.Commands.Result.Success); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Plane plane = Plane.WorldXY; Curve perimCrv = null; coreCrvs = new List <Curve>(); rectangles = new List <Rectangle3d>(); obstacleCrvs = new List <Curve>(); DA.GetData(IN_autoColor, ref autoColor); DA.GetData(IN_plane, ref plane); DA.GetData(IN_perimCrv, ref perimCrv); DA.GetDataList(IN_voxelRects, rectangles); DA.GetDataList(IN_obstacleCrvs, obstacleCrvs); bool coreReceived = DA.GetDataList(IN_coreCrvs, coreCrvs); _plan = new SmartPlan(perimCrv, coreCrvs, rectangles, obstacleCrvs, plane); Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc; Rhino.UnitSystem system = doc.ModelUnitSystem; _plan.projectUnits = system.ToString() == "Meters" ? 0 : 1; _plan.ComputeCovid(); compromisedMetric = _plan.GetCovidMetric(); DA.SetDataList(OUT_hit, compromisedMetric); DA.SetDataTree(OUT_lines, _plan.covidLines); }
public static void UpdateDocumentUnits(Rhino.RhinoDoc rhinoDoc, Document revitDoc = null) { bool docModified = rhinoDoc.Modified; if (revitDoc == null) { rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.None; rhinoDoc.ModelAbsoluteTolerance = Revit.VertexTolerance; rhinoDoc.ModelAngleToleranceRadians = Revit.AngleTolerance; } else if (rhinoDoc.ModelUnitSystem == Rhino.UnitSystem.None) { var units = revitDoc.GetUnits(); var lengthFormatoptions = units.GetFormatOptions(UnitType.UT_Length); switch (lengthFormatoptions.DisplayUnits) { case DisplayUnitType.DUT_METERS: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Meters; break; case DisplayUnitType.DUT_METERS_CENTIMETERS: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Meters; break; case DisplayUnitType.DUT_DECIMETERS: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Decimeters; break; case DisplayUnitType.DUT_CENTIMETERS: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Centimeters; break; case DisplayUnitType.DUT_MILLIMETERS: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Millimeters; break; case DisplayUnitType.DUT_FRACTIONAL_INCHES: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Inches; break; case DisplayUnitType.DUT_DECIMAL_INCHES: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Inches; break; case DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Feet; break; case DisplayUnitType.DUT_DECIMAL_FEET: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.Feet; break; default: rhinoDoc.ModelUnitSystem = Rhino.UnitSystem.None; break; } bool imperial = rhinoDoc.ModelUnitSystem == Rhino.UnitSystem.Feet || rhinoDoc.ModelUnitSystem == Rhino.UnitSystem.Inches; rhinoDoc.ModelAngleToleranceRadians = Revit.AngleTolerance; rhinoDoc.ModelDistanceDisplayPrecision = ((int)-Math.Log10(lengthFormatoptions.Accuracy)).Clamp(0, 7); rhinoDoc.ModelAbsoluteTolerance = Revit.VertexTolerance * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Feet, rhinoDoc.ModelUnitSystem); //switch (rhinoDoc.ModelUnitSystem) //{ // case Rhino.UnitSystem.None: break; // case Rhino.UnitSystem.Feet: // case Rhino.UnitSystem.Inches: // newDoc.ModelAbsoluteTolerance = (1.0 / 160.0) * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Inches, newDoc.ModelUnitSystem); // break; // default: // newDoc.ModelAbsoluteTolerance = 0.1 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Millimeters, newDoc.ModelUnitSystem); // break; //} UpdateViewConstructionPlanes(rhinoDoc, revitDoc); } rhinoDoc.Modified = docModified; }
protected override Result RunCommand(Rhino.RhinoDoc doc, RunMode mode) { var panel_id = SampleCsPanelUserControl.PanelId; var visible = Panels.IsPanelVisible(panel_id); var prompt = visible ? "Sample panel is visible. New value" : "Sample Manager panel is hidden. New value"; var go = new GetOption(); go.SetCommandPrompt(prompt); var hide_index = go.AddOption("Hide"); var show_index = go.AddOption("Show"); var toggle_index = go.AddOption("Toggle"); go.Get(); if (go.CommandResult() != Result.Success) { return(go.CommandResult()); } var option = go.Option(); if (null == option) { return(Result.Failure); } var index = option.Index; if (index == hide_index) { if (visible) { Panels.ClosePanel(panel_id); } } else if (index == show_index) { if (!visible) { Panels.OpenPanel(panel_id); } } else if (index == toggle_index) { if (visible) { Panels.ClosePanel(panel_id); } else { Panels.OpenPanel(panel_id); } } return(Result.Success); }
public override void BakeGeometry(Rhino.RhinoDoc doc, List <Guid> obj_ids) { /*if(this.BKGT!=null) * { * this.BKGT(doc,obj_ids); * }*/ base.BakeGeometry(doc, obj_ids); }
protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode) { // Hide my custom panel var type = typeof(MyPanel); Rhino.UI.Panels.ClosePanel(type.GUID); return(Rhino.Commands.Result.Success); }
// Only access to this class is through the Sun property on the document's light table. // That property calls CheckForRdk so we don't need to "recheck" for functions/properties // in this class. internal Sun(Rhino.RhinoDoc doc) { m_doc = doc; }
// Only access to this class is through the Sun property on the document's light table. // That property calls CheckForRdk so we don't need to "recheck" for functions/properties // in this class. internal Sun(Rhino.RhinoDoc doc) { m_doc = doc; m_pLocalSun = IntPtr.Zero; GC.SuppressFinalize(this); }
/// <summary> /// Create a non-document controlled Sun /// </summary> public Sun() { m_pLocalSun = UnsafeNativeMethods.Rdk_SunNew(); m_doc = null; }
internal GroundPlane(Rhino.RhinoDoc doc) { m_doc = doc; }
internal Skylight(Rhino.RhinoDoc doc) { m_doc = doc; }
internal RenderSettings(RhinoDoc doc) { m_doc = doc; }