Exemplo n.º 1
0
        public override void DrawViewportWires(IGH_PreviewArgs args)
        {
            base.DrawViewportWires(args);

            if (texts.Count == 0)
            {
                return;
            }

            Plane plane;

            args.Viewport.GetFrustumFarPlane(out plane);

            for (int i = 0; i < texts.Count; i++)
            {
                string  text     = texts[i];
                double  size     = sizes[i];
                Point3d location = locations[i];
                plane.Origin = location;

                // Figure out the size. This means measuring the visible size in the viewport AT the current location.
                double pixPerUnit;
                Rhino.Display.RhinoViewport viewport = args.Viewport;
                viewport.GetWorldToScreenScale(location, out pixPerUnit);

                size = size / pixPerUnit;

                Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(text, plane, size);

                args.Display.Draw3dText(drawText, args.WireColour);
                drawText.Dispose();
            }
        }
Exemplo n.º 2
0
        public override void DrawViewportWires(IGH_PreviewArgs args)
        {
            if (_text.Count == 0)
            {
                return;
            }

            //Plane plane;
            //args.Viewport.GetFrustumFarPlane(out plane);

            for (int i = 0; i < _text.Count; i++)
            {
                string   text  = _text[i];
                Point3d  point = _point[i];
                double   size  = _size[i];
                Polyline tile  = _tile[i];

                Plane plane;
                args.Viewport.GetFrustumFarPlane(out plane);
                plane.Origin = point;

                Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(text, plane, size);
                args.Display.Draw3dText(text, Color.Black, plane, size, null, false, false, Rhino.DocObjects.TextHorizontalAlignment.Center, Rhino.DocObjects.TextVerticalAlignment.Middle);
                args.Display.DrawPolyline(tile, Color.Black, 2);
                drawText.Dispose();
            }
        }
Exemplo n.º 3
0
 public override void DrawViewportWires(IGH_PreviewArgs args)
 {
     args.Viewport.GetFrustumFarPlane(out Plane plane);
     Rhino.Display.RhinoViewport viewport = args.Viewport;
     //X軸
     for (int i = 0; i < _xline.Count; i++)
     {
         if (x_guideline == 1)
         {
             args.Display.DrawPatternedLine(_xline[i], Color.Black, 0x00001111, 1);
             double size = fontsize; Point3d point = _xline[i].From; plane.Origin = point;
             viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit;
             Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(_xlabel[i], plane, size);
             drawText.HorizontalAlignment = TextHorizontalAlignment.Center; drawText.VerticalAlignment = TextVerticalAlignment.Top;
             args.Display.Draw3dText(drawText, Color.Black);
             drawText.Dispose();
         }
     }
     //Y軸
     for (int i = 0; i < _yline.Count; i++)
     {
         if (y_guideline == 1)
         {
             args.Display.DrawPatternedLine(_yline[i], Color.Black, 0x00001111, 1);
             double size = fontsize; Point3d point = _yline[i].From; plane.Origin = point;
             viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit;
             Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(_ylabel[i], plane, size);
             drawText.HorizontalAlignment = TextHorizontalAlignment.Right; drawText.VerticalAlignment = TextVerticalAlignment.Middle;
             args.Display.Draw3dText(drawText, Color.Black);
             drawText.Dispose();
         }
     }
     //Z軸
     for (int i = 0; i < _zline.Count; i++)
     {
         if (z_guideline == 1)
         {
             args.Display.DrawPatternedLine(_zline[i], Color.Black, 0x00001111, 1);
             double size = fontsize; Point3d point = _zline[i].From; plane.Origin = point;
             viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit;
             Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(_zlabel[i], plane, size);
             drawText.HorizontalAlignment = TextHorizontalAlignment.Right; drawText.VerticalAlignment = TextVerticalAlignment.Middle;
             args.Display.Draw3dText(drawText, Color.Black);
             drawText.Dispose();
         }
     }
 }///ここからGUIの作成*****************************************************************************************