Exemplo n.º 1
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //draw clippingbox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null))
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                else
                {
                    drawInfoPanel(args.Pipeline, args.Viewport);
                }

                args.Pipeline.DrawCurve(Value, DrawUtil.DrawColorLoads, args.Thickness + 1);

                if (DrawUtil.ScaleFactorLoads > 0.0001 && !(Forces.IsTiny() && Moments.IsTiny()))
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            var height = Height;

            if (double.IsNaN(height))
            {
                return;
            }

            if (args.Viewport.IsParallelProjection)
            {
                if (args.Viewport.CameraDirection.IsPerpendicularTo(Vector3d.ZAxis))
                {
                    var viewportBBox = args.Viewport.GetFrustumBoundingBox();
                    var length       = viewportBBox.Diagonal.Length;
                    args.Viewport.GetFrustumCenter(out var center);

                    var point = new Point3d(center.X, center.Y, height);
                    var from  = point - args.Viewport.CameraX * length;
                    var to    = point + args.Viewport.CameraX * length;

                    args.Pipeline.DrawPatternedLine(from, to, args.Color, 0x00000F0F, args.Thickness);
                }
            }
        }
Exemplo n.º 3
0
 public override void DrawViewportWires(IGH_PreviewArgs args)
 {
     if ((this.m_items != null))
     {
         if (this.Attributes.Selected)
         {
             GH_PreviewWireArgs args2 = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour_Selected, args.DefaultCurveThickness);
             foreach (GH_CustomPreviewItem item in this.m_items)
             {
                 if (!(item.m_obj is GH_Mesh) || CentralSettings.PreviewMeshEdges)
                 {
                     item.m_obj.DrawViewportWires(args2);
                 }
             }
         }
         else
         {
             foreach (GH_CustomPreviewItem item2 in this.m_items)
             {
                 if (!(item2.m_obj is GH_Mesh) || CentralSettings.PreviewMeshEdges)
                 {
                     GH_PreviewWireArgs args3 = new GH_PreviewWireArgs(args.Viewport, args.Display, item2.m_col, args.DefaultCurveThickness);
                     item2.m_obj.DrawViewportWires(args3);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (Value is DB.BasePoint point)
            {
                var location = Location;
                point.Category.Id.TryGetBuiltInCategory(out var builtInCategory);
                var pointStyle    = default(Rhino.Display.PointStyle);
                var angle         = default(float);
                var radius        = 6.0f;
                var secondarySize = 3.5f;
                switch (builtInCategory)
                {
                case DB.BuiltInCategory.OST_IOS_GeoSite:
                    pointStyle = Rhino.Display.PointStyle.ActivePoint;
                    break;

                case DB.BuiltInCategory.OST_ProjectBasePoint:
                    pointStyle = Rhino.Display.PointStyle.RoundActivePoint;
                    angle      = (float)Rhino.RhinoMath.ToRadians(45);
                    break;

                case DB.BuiltInCategory.OST_SharedBasePoint:
                    pointStyle    = Rhino.Display.PointStyle.Triangle;
                    radius        = 12.0f;
                    secondarySize = 7.0f;
                    break;
                }

                var strokeColor = (System.Drawing.Color)Rhino.Display.ColorRGBA.ApplyGamma(new Rhino.Display.ColorRGBA(args.Color), 2.0);
                args.Pipeline.DrawPoint(location.Origin, pointStyle, strokeColor, args.Color, radius, 2.0f, secondarySize, angle, true, true);
            }
        }
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (Value == null)
            {
                return;
            }



            //Draw lines
            if (Value.Line != null)
            {
                if (args.Color == System.Drawing.Color.FromArgb(255, 150, 0, 0)) // this is a workaround to change colour between selected and not
                {
                    args.Pipeline.DrawCurve(Value.Line, UI.Colour.Element1d, 2);
                    args.Pipeline.DrawPoint(Value.Line.PointAtStart, Rhino.Display.PointStyle.RoundSimple, 3, UI.Colour.Element1dNode);
                    args.Pipeline.DrawPoint(Value.Line.PointAtEnd, Rhino.Display.PointStyle.RoundSimple, 3, UI.Colour.Element1dNode);
                }
                else
                {
                    args.Pipeline.DrawCurve(Value.Line, UI.Colour.Element1dSelected, 2);
                    args.Pipeline.DrawPoint(Value.Line.PointAtStart, Rhino.Display.PointStyle.RoundControlPoint, 3, UI.Colour.Element1dNodeSelected);
                    args.Pipeline.DrawPoint(Value.Line.PointAtEnd, Rhino.Display.PointStyle.RoundControlPoint, 3, UI.Colour.Element1dNodeSelected);
                }
            }
        }
Exemplo n.º 6
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!_cplCond.isValid)
            {
                updateECoupling();
            }

            System.Drawing.Color col = args.Color;
            if (!DrawUtil.CheckSelection(col))
            {
                col = System.Drawing.Color.DarkViolet;
            }
            else
            {
                _cplCond.DrawInfo(args);
            }

            _cplCond.Draw(args.Pipeline, col);

            /*
             * if (Value.IsACurve)
             * args.Pipeline.DrawCurve(Value.CurveA, col, args.Thickness + 1);
             * else
             * args.Pipeline.DrawPoint(Value.PointA.Location, Rhino.Display.PointStyle.X, 5, col);
             * if (Value.IsBCurve)
             * args.Pipeline.DrawCurve(Value.CurveB, col, args.Thickness + 1);
             * else
             * args.Pipeline.DrawPoint(Value.PointB.Location, Rhino.Display.PointStyle.X, 5, col);
             */
        }
Exemplo n.º 7
0
 public void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Value?.GetGeometry() != null)
     {
         args.Pipeline.DrawMeshWires(PanelMesh, args.Color);
     }
 }
Exemplo n.º 8
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (Value == null)
            {
                return;
            }

            //Draw lines
            if (Value.Mesh != null)
            {
                if (args.Color == System.Drawing.Color.FromArgb(255, 150, 0, 0)) // this is a workaround to change colour between selected and not
                {
                    for (int i = 0; i < Value.Mesh.TopologyEdges.Count; i++)
                    {
                        args.Pipeline.DrawLine(Value.Mesh.TopologyEdges.EdgeLine(i), UI.Colour.Element2dEdge, 2);
                    }
                }
                else
                {
                    for (int i = 0; i < Value.Mesh.TopologyEdges.Count; i++)
                    {
                        args.Pipeline.DrawLine(Value.Mesh.TopologyEdges.EdgeLine(i), UI.Colour.Element2dEdgeSelected, 3);
                    }
                }
            }
        }
 public override void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Curve is Curve curve)
     {
         args.Pipeline.DrawCurve(curve, args.Color, args.Thickness);
     }
 }
Exemplo n.º 10
0
 public void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Value != null)
     {
         args.Pipeline.DrawCurve(Value, System.Drawing.Color.Red);
     }
 }
Exemplo n.º 11
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null)) //if no point or, force AND moment are zero, nothing to draw
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                else
                {
                    drawInfoPanel(args.Pipeline, args.Viewport);
                }

                args.Pipeline.DrawPoint(Value.Location, Rhino.Display.PointStyle.X, 5, DrawUtil.DrawColorLoads);

                if (!(Forces.IsTiny() && Moments.IsTiny() && Displacement.IsTiny() && DisplacementRotational.IsTiny()) && DrawUtil.ScaleFactorLoads > 0.0001)
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
Exemplo n.º 12
0
 public void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Value != null)
     {
         args.Pipeline.DrawPoint(Value.Location, Rhino.Display.PointStyle.X, 5, System.Drawing.Color.Red);
     }
 }
Exemplo n.º 13
0
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (!IsValid)
            {
                return;
            }

            if (!args.Pipeline.DisplayPipelineAttributes.ShowSurfaceEdges)
            {
                return;
            }

            int       thickness = 1; //args.Thickness;
            const int factor    = 3;

            var color   = args.Color;
            var element = Document?.GetElement(Id);

            if (element is null)
            {
                // Erased element
                color = System.Drawing.Color.FromArgb(args.Color.R / factor, args.Color.G / factor, args.Color.B / factor);
            }
            else if (!element.Pinned)
            {
                // Unpinned element
                if (args.Thickness <= 1 && args.Pipeline.DisplayPipelineAttributes.UseAssignedObjectMaterial)
                {
                    color = System.Drawing.Color.Black;
                }
            }

            var wires = TryGetPreviewWires();

            if (wires is object && wires.Length > 0)
            {
                foreach (var wire in wires)
                {
                    args.Pipeline.DrawCurve(wire, color, thickness);
                }
            }
            else
            {
                var meshes = TryGetPreviewMeshes();
                if (meshes is object)
                {
                    // Grasshopper does not show mesh wires.
                    //foreach (var mesh in meshes)
                    //  args.Pipeline.DrawMeshWires(mesh, color, thickness);
                }
                else
                {
                    foreach (var edge in ClippingBox.GetEdges() ?? Enumerable.Empty <Line>())
                    {
                        args.Pipeline.DrawPatternedLine(edge.From, edge.To, System.Drawing.Color.Black /*color*/, 0x00001111, thickness);
                    }
                }
            }
        }
Exemplo n.º 14
0
    void IGH_PreviewData.DrawViewportWires(GH_PreviewWireArgs args)
    {
      if (!IsValid)
        return;

      if(Curve is Rhino.Geometry.Curve curve)
        args.Pipeline.DrawCurve(curve, args.Color, args.Thickness);
    }
Exemplo n.º 15
0
    void IGH_PreviewData.DrawViewportWires(GH_PreviewWireArgs args)
    {
      if (!IsValid)
        return;

      if (Point is Rhino.Geometry.Point point)
        args.Pipeline.DrawPoint(point.Location, CentralSettings.PreviewPointStyle, CentralSettings.PreviewPointRadius, args.Color);
    }
Exemplo n.º 16
0
 public void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Value == null)
     {
         return;
     }
     args.Pipeline.DrawLines(Value.ToLines().ToArray(), args.Color, args.Thickness);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Render voxel grid wires
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="e">The e.</param>
 private void RenderVoxelGridWires(IGH_PreviewArgs args, GH_PreviewWireArgs e)
 {
     args.Display.DrawLines(RenderLines, e.Color);
     foreach (var l in RenderDottedLines)
     {
         args.Display.DrawDottedLine(l, e.Color);
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// Render the voxel grid mesh
 /// </summary>
 /// <param name="m">The m.</param>
 /// <param name="args">The arguments.</param>
 /// <param name="e">The e.</param>
 private void RenderVoxelGridMesh(Mesh m, IGH_PreviewArgs args, GH_PreviewWireArgs e)
 {
     RenderVoxelGridWires(args, e);
     for (var i = 0; i < RenderGrid.Count; i++)
     {
         args.Display.DrawMeshWires(RenderMesh[i], e.Color);
     }
 }
Exemplo n.º 19
0
 void IGH_PreviewData.DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (m_value == null)
     {
         return;
     }
     args.Pipeline.Draw3dText(m_value, args.Color);
 }
Exemplo n.º 20
0
    void IGH_PreviewData.DrawViewportWires(GH_PreviewWireArgs args)
    {
      if (!IsValid)
        return;

      foreach (var curve in Curves ?? Enumerable.Empty<Rhino.Geometry.Curve>())
        args.Pipeline.DrawCurve(curve, args.Color, args.Thickness);
    }
Exemplo n.º 21
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (Value == null)
            {
                return;
            }

            //Draw lines
            if (Value.Line != null)
            {
                if (args.Color == System.Drawing.Color.FromArgb(255, 150, 0, 0)) // this is a workaround to change colour between selected and not
                {
                    if (Value.Element.IsDummy)
                    {
                        args.Pipeline.DrawDottedLine(Value.Line.PointAtStart, Value.Line.PointAtEnd, UI.Colour.Dummy1D);
                    }
                    else
                    {
                        if ((System.Drawing.Color)Value.Colour != System.Drawing.Color.FromArgb(0, 0, 0))
                        {
                            args.Pipeline.DrawCurve(Value.Line, Value.Colour, 2);
                        }
                        else
                        {
                            System.Drawing.Color col = UI.Colour.ElementType(Value.Element.Type);
                            args.Pipeline.DrawCurve(Value.Line, col, 2);
                        }
                        args.Pipeline.DrawPoint(Value.Line.PointAtStart, Rhino.Display.PointStyle.RoundSimple, 3, UI.Colour.Element1dNode);
                        args.Pipeline.DrawPoint(Value.Line.PointAtEnd, Rhino.Display.PointStyle.RoundSimple, 3, UI.Colour.Element1dNode);
                    }
                }
                else
                {
                    if (Value.Element.IsDummy)
                    {
                        args.Pipeline.DrawDottedLine(Value.Line.PointAtStart, Value.Line.PointAtEnd, UI.Colour.Element1dSelected);
                    }
                    else
                    {
                        args.Pipeline.DrawCurve(Value.Line, UI.Colour.Element1dSelected, 2);
                        args.Pipeline.DrawPoint(Value.Line.PointAtStart, Rhino.Display.PointStyle.RoundControlPoint, 3, UI.Colour.Element1dNodeSelected);
                        args.Pipeline.DrawPoint(Value.Line.PointAtEnd, Rhino.Display.PointStyle.RoundControlPoint, 3, UI.Colour.Element1dNodeSelected);
                    }
                }
            }
            //Draw releases
            if (!Value.Element.IsDummy)
            {
                PolyCurve crv = new PolyCurve();
                crv.Append(Value.Line);
                double   angle = Value.Element.OrientationAngle;
                GsaBool6 start = Value.ReleaseStart;
                GsaBool6 end   = Value.ReleaseEnd;

                UI.Display.DrawReleases(args, crv, angle, start, end);
            }
        }
Exemplo n.º 22
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (Value != null)
            {
                args.Pipeline.DrawPoint(ToRC.Convert(Value.Position), RD.PointStyle.X, 8, args.Color);

                /*Mesh mesh = SupportMesh;
                 * if (mesh != null) args.Pipeline.DrawMeshWires(mesh, args.Color);*/
            }
        }
Exemplo n.º 23
0
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            var curveElement = (DB.CurveElement) this;

            if (curveElement is object)
            {
                var curve = curveElement.GeometryCurve.ToCurve();
                args.Pipeline.DrawCurve(curve, args.Color, args.Thickness);
            }
        }
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            var location = Location;

            if (location.IsValid)
            {
                var strokeColor = (System.Drawing.Color)Rhino.Display.ColorRGBA.ApplyGamma(new Rhino.Display.ColorRGBA(args.Color), 2.0);
                args.Pipeline.DrawPoint(location.Origin, Rhino.Display.PointStyle.Pin, strokeColor, args.Color, 12.0f, 2.0f, 7.0f, 0.0f, true, true);
            }
        }
Exemplo n.º 25
0
 public void DrawViewportWires(GH_PreviewWireArgs args)
 {
     if (Value == null)
     {
         return;
     }
     // TODO: handle colours and thicknesses here.
     args.Pipeline.DrawLines(Value.ToLineArray(), args.Color, args.Thickness);
     // maybe draw nodes too?
 }
Exemplo n.º 26
0
        /***************************************************/

        public virtual void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (m_thickness > 0)
            {
                if (m_RhinoGeometry != null)
                {
                    Render.IRenderRhinoWires(m_RhinoGeometry, args, m_Color, m_thickness);
                }
            }
        }
Exemplo n.º 27
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (RenderMesh == null)
            {
                return;
            }

            // Check high order elements (visualization is not supported with rhino mesh)
            if (!_elementTypes.Contains(-1) && !_elementTypes.Contains(17) && !_elementTypes.Contains(18) &&
                !_elementTypes.Contains(19) && !_elementTypes.Contains(9) && !_elementTypes.Contains(16) &&
                !_elementTypes.Contains(11))
            {
                args.Pipeline.DrawMeshWires(RenderMesh, args.Color);
            }
            else
            {
                int[]     hf;
                Point3d[] pts;
                foreach (IElement e in Elements)
                {
                    if (e.TopologicDimension == 2)
                    {
                        pts = IRhinoGeometry.GetPointsFromElements(e.Vertices, this);
                        args.Pipeline.DrawPolyline(pts, args.Color);
                    }
                    else
                    {
                        if (!IsMultidimensionalMesh)
                        {
                            for (int i = 1; i <= e.HalfFacetsCount; i++)
                            {
                                if (e.IsNakedSiblingHalfFacet(i))
                                {
                                    e.GetHalfFacet(i, out hf);
                                    pts = IRhinoGeometry.GetPointsFromElements(hf, this);
                                    args.Pipeline.DrawPolyline(pts, args.Color);
                                }
                            }
                        }
                        else
                        {
                            if (e.IsBoundaryElement())
                            {
                                for (int i = 1; i <= e.HalfFacetsCount; i++)
                                {
                                    e.GetHalfFacet(i, out hf);
                                    pts = IRhinoGeometry.GetPointsFromElements(hf, this);
                                    args.Pipeline.DrawPolyline(pts, args.Color);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 28
0
        public override void DrawViewportWires(GH_PreviewWireArgs args)
        {
            var location = Location;

            if (!location.IsValid)
            {
                return;
            }

            GH_Plane.DrawPlane(args.Pipeline, Location, Grasshopper.CentralSettings.PreviewPlaneRadius, 4, args.Color, System.Drawing.Color.DarkRed, System.Drawing.Color.DarkGreen);
        }
Exemplo n.º 29
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //if (Value.Geometry is Mesh)
            //    args.Pipeline.DrawMeshWires(Value.Geometry as Mesh, Value.Color);

            if (Value.Geometry is Curve)
            {
                Color color = Value.Material == null ? args.Color : Value.Material.Diffuse;
                args.Pipeline.DrawCurve(Value.Geometry as Curve, Value.Material.Diffuse);
            }
        }
Exemplo n.º 30
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (this.m_value == null || _polylines == null)
            {
                return;
            }

            for (int i = 0; i < _polylines.Length; i++)
            {
                args.Pipeline.DrawPolygon(_polylines[i], args.Color, false);
            }
        }