public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); time++; Rhino.DocObjects.RhinoObject obj = RhinoDoc.ActiveDoc.Objects.Find(ID); TextObject T = (TextObject)obj; TextEntity t = T.TextGeometry; m_tags = new Rhino.Display.Text3d(t.Text + " " + time.ToString() , t.Plane, t.TextHeight + 1); if (this.m_tags != null) { Color defaultColour = Color.Blue; args.Display.Draw3dText(this.m_tags, defaultColour); } }
/// <summary> /// Adds a new 3D text object to the display list. /// </summary> /// <param name="text">Text object to add.</param> /// <param name="color">Color of text object.</param> public void AddText(Text3d text, Color color) { if (m_disposed) { throw new ObjectDisposedException("This CustomDisplay instance has been disposed and cannot be modified"); } if (text == null) { return; } CDU_Text cdu = new CDU_Text(); cdu.m_color = Color.FromArgb(255, color); cdu.m_text = new Text3d(text.Text, text.TextPlane, text.Height); cdu.m_text.Bold = text.Bold; cdu.m_text.Italic = text.Italic; cdu.m_text.FontFace = text.FontFace; m_text.Add(cdu); m_clip.Union(text.BoundingBox); }
/// <summary> /// Draws 3d text using the Text3d plane with an adjusted origin. /// </summary> /// <param name="text">The string to draw.</param> /// <param name="color">Text color.</param> /// <param name="textPlaneOrigin">The origin of the plane to draw.</param> public void Draw3dText(Text3d text, System.Drawing.Color color, Point3d textPlaneOrigin) { IntPtr pThis = NonConstPointer(); IntPtr pAnnotationText = text.NonConstPointer(); UnsafeNativeMethods.CRhinoDisplayPipeline_Draw3dText4(pThis, pAnnotationText, text.FontFace, color.ToArgb(), text.Bold, text.Italic, textPlaneOrigin); }
private void RunScript(List<Object> x, ref object A, ref object B, ref object C) { try { m_tags = new List<Rhino.Display.Text3d>(); // List<int> index = new List<int>(); List<Point3d> pos = new List<Point3d>(); for (int i = 0; i < x.Count; i++) { Point3d p; // index.Add(i); if (x[i].GetType() == typeof(Line)) { Line l = (Line)(x[i]); p = (l.From + l.To) / 2; } else { Rhino.Geometry.GeometryBase base1 = (Rhino.Geometry.GeometryBase)x[i]; // pos.Add(base1.GetBoundingBox(true).Center); p = base1.GetBoundingBox(true).Center; } Rhino.Display.Text3d text = new Rhino.Display.Text3d(i.ToString(), new Plane(p, Vector3d.ZAxis), 1); m_tags.Add(text); } //A = m_tags; } catch (Exception ex) { Print(ex.ToString()); } ////////////////////////////////////////////////////// }
private void RunScript(object x, object y, ref object A) { try { if (sign) { sign = false; Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject(); go.Get(); Rhino.DocObjects.ObjRef or = go.Object(0); ID = or.ObjectId; Rhino.DocObjects.RhinoObject obj = RhinoDoc.ActiveDoc.Objects.Find(ID); TextObject T = (TextObject)obj; TextEntity t = T.TextGeometry; m_tags = new Rhino.Display.Text3d(t.Text, t.Plane, t.TextHeight + 1); } } catch (Exception ex) { Print(ex.ToString()); } }