コード例 #1
0
        /// <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)
        {
            ghdoc = this.OnPingDocument();
            ghdoc.ContextChanged += new GH_Document.ContextChangedEventHandler(CheckDisplay);

            Model model = null;

            DA.GetData(0, ref model);
            if (model.Mesh == null)
            {
                return;
            }

            bool showNds, showThk, showEdgs, showLCS, showLoads, showSupports, showCNs, showNNs, showENs, showLVals;

            showNds = showThk = showEdgs = showLCS = showLoads = showSupports = showCNs = showNNs = showENs = showLVals = false;
            double TFactor, GFactor;

            TFactor = GFactor = 0;
            DA.GetData(1, ref showNds);
            DA.GetData(2, ref showThk);
            DA.GetData(3, ref showEdgs);
            DA.GetData(4, ref showLCS);
            DA.GetData(5, ref showLoads);
            DA.GetData(6, ref showSupports);
            DA.GetData(7, ref showCNs);
            DA.GetData(8, ref showNNs);
            DA.GetData(9, ref showENs);
            DA.GetData(10, ref showLVals);
            DA.GetData(11, ref TFactor);
            DA.GetData(12, ref GFactor);

            List <int> panelIds = new List <int>();
            List <int> barIds   = new List <int>();

            DA.GetDataList(13, barIds);
            DA.GetDataList(14, panelIds);

            double[] sizeFactors = model.sizeFactors();
            double   EFactor     = sizeFactors[0];
            double   FFactor     = sizeFactors[1];

            m_display = new Rhino.Display.CustomDisplay(!this.Hidden);

            HashSet <int> nodeIds = new HashSet <int>();
            HashSet <int> barNodeIds;
            HashSet <int> panelNodeIds;

            m_display.AddBarPreview(model, barIds, out barNodeIds, GFactor, EFactor, TFactor, showCNs, showENs, showLCS, showThk);
            m_display.AddPanelPreview(model, panelIds, out panelNodeIds, GFactor, EFactor, TFactor, FFactor, showCNs, showENs, showLCS, showLoads, showLVals, showEdgs, showThk);

            nodeIds.UnionWith(panelNodeIds);
            nodeIds.UnionWith(barNodeIds);
            m_display.AddNodePreview(model, nodeIds, GFactor, EFactor, TFactor, FFactor, showNds, showNNs, showLoads, showLVals);

            if (showSupports)
            {
                m_display.AddSupportPreview(model, nodeIds, EFactor, GFactor);
            }
        }
コード例 #2
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of a translation support.
        public static void PreviewTanslationSupport(this Rhino.Display.CustomDisplay display, Node n, Vector3d axis, double displayFactor)
        {
            Point3d  ptc    = n.Location - axis * displayFactor;
            Point3d  pbc    = n.Location - axis * 1.1 * displayFactor;
            Vector3d localX = new Vector3d(axis.Z, axis.X, axis.Y);
            Vector3d localY = new Vector3d(axis.Y, axis.Z, axis.X);
            Vector3d Xt     = localX * 0.5 * displayFactor;
            Vector3d Yt     = localY * 0.5 * displayFactor;
            Vector3d Xb     = localX * 0.55 * displayFactor;
            Vector3d Yb     = localY * 0.55 * displayFactor;

            List <Point3d> pts = new List <Point3d> {
                ptc + Xt + Yt, ptc + Xt - Yt, ptc - Xt - Yt, ptc - Xt + Yt
            };
            List <Point3d> pbs = new List <Point3d> {
                pbc + Xb + Yb, pbc + Xb - Yb, pbc - Xb - Yb, pbc - Xb + Yb
            };

            display.AddPolygon(pbs, Color.Brown, Color.Black, true, true);
            display.AddPolygon(pts, Color.Brown, Color.Black, true, true);

            for (int i = 0; i < 4; i++)
            {
                display.AddPolygon(new Point3d[] { pts[i], pts[(i + 1) % 4], n.Location }, Color.Brown, Color.Black, true, true);
            }
        }
コード例 #3
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of a rotation support.
        public static void PreviewRotationSupport(this Rhino.Display.CustomDisplay display, Node node, Vector3d axis, double displayFactor)
        {
            double   circRadius = Math.Sqrt(0.5) * displayFactor;
            Plane    p          = new Plane(node.Location, axis);
            Circle   c          = new Circle(p, displayFactor);
            Vector3d v1         = (new Vector3d(1, 1, 1) - axis) * circRadius;
            Vector3d v2         = v1.X == 0 ? new Vector3d(0, -v1.Y, v1.Z) : new Vector3d(-v1.X, v1.Y, v1.Z);
            Point3d  s1         = node.Location - v1;
            Point3d  s2         = node.Location - v2;
            Line     l1         = new Line(s1, v1 * 2);
            Line     l2         = new Line(s2, v2 * 2);

            display.AddLine(l1);
            display.AddLine(l2);
            display.AddCircle(c);
        }
コード例 #4
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of supports.
        public static void AddSupportPreview(this Rhino.Display.CustomDisplay display, Model model, HashSet <int> ids, double elementFactor, double graphicFactor)
        {
            double translationSupportFactor = 0.7 * elementFactor * graphicFactor;
            double rotationSupportFactor    = 0.35 * elementFactor * graphicFactor;

            foreach (Support s in model.Supports)
            {
                foreach (int id in ids.Intersect(s.Nodes.Select(n => n.Id.AsInteger)))
                {
                    Node n = model.Mesh.Nodes[id];
                    foreach (int dof in s.SupportType.DOFs)
                    {
                        switch (dof)
                        {
                        case 1:
                            display.PreviewTanslationSupport(n, Vector3d.XAxis, translationSupportFactor);
                            break;

                        case 2:
                            display.PreviewTanslationSupport(n, Vector3d.YAxis, translationSupportFactor);
                            break;

                        case 3:
                            display.PreviewTanslationSupport(n, Vector3d.ZAxis, translationSupportFactor);
                            break;

                        case 4:
                            display.PreviewRotationSupport(n, Vector3d.XAxis, rotationSupportFactor);
                            break;

                        case 5:
                            display.PreviewRotationSupport(n, Vector3d.YAxis, rotationSupportFactor);
                            break;

                        case 6:
                            display.PreviewRotationSupport(n, Vector3d.ZAxis, rotationSupportFactor);
                            break;
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of nodes.
        public static void AddNodePreview(this Rhino.Display.CustomDisplay display, Model model, IEnumerable <int> ids, double graphicFactor, double elementFactor, double textFactor, double forceFactor, bool showNodes, bool showNodeNumbers, bool showLoads, bool showLoadValues, Grasshopper.GUI.Gradient.GH_Gradient gradient = null, string nodeResultType = "None", bool showResultValues = false)
        {
            if (model.Mesh == null || model.Mesh.Nodes.Count == 0)
            {
                return;
            }

            List <double> nodeResults = new List <double>();
            double        nodeMax     = 0;
            double        nodeMin     = 0;

            if (nodeResultType != "None")
            {
                nodeResults = model.Mesh.GetNodeDisplacement(nodeResultType);
                nodeMax     = nodeResults.Max();
                nodeMin     = nodeResults.Min();
            }

            foreach (int i in ids)
            {
                Node n = model.Mesh.Nodes[i];
                if (!n.Primary)
                {
                    continue;
                }

                if (showNodes)
                {
                    if (nodeResults.Count > 0)
                    {
                        display.AddPoint(n.Location, gradient.ColourAt((nodeResults[i] - nodeMin) / (nodeMax - nodeMin)), Rhino.Display.PointStyle.Simple, Math.Max(1, Convert.ToInt32(5 * elementFactor * graphicFactor)));
                    }
                    else
                    {
                        display.AddPoint(n.Location, Color.DarkRed, Rhino.Display.PointStyle.Simple, Math.Max(1, Convert.ToInt32(5 * elementFactor * graphicFactor)));
                    }
                }

                if (showResultValues && nodeResults.Count > 0)
                {
                    Plane p = new Plane(n.Location + Vector3d.ZAxis * elementFactor, Vector3d.XAxis, Vector3d.ZAxis);
                    Rhino.Display.Text3d t = new Rhino.Display.Text3d(nodeResults[i].ToString("G2"), p, elementFactor * 0.4 * textFactor);
                    t.Bold = true;
                    display.AddText(t, Color.Black);
                }

                if (showLoads && n.ForceLoad.Length != 0)
                {
                    Vector3d dLoad = n.ForceLoad / forceFactor * elementFactor * 5 * graphicFactor;
                    display.AddVector(n.Location - dLoad, dLoad);

                    if (showLoadValues)
                    {
                        Plane p = new Plane(n.Location - dLoad * 1.1, Vector3d.XAxis, Vector3d.ZAxis);
                        Rhino.Display.Text3d t = new Rhino.Display.Text3d(n.ForceLoad.Length.ToString("G2"), p, elementFactor * 0.4 * textFactor);
                        t.Bold = true;
                        display.AddText(t, Color.Magenta);
                    }
                }

                if (showLoads && n.MomentLoad.Length != 0)
                {
                    Vector3d mLoad = n.MomentLoad;
                    Vector3d axis  = new Vector3d(mLoad.X, mLoad.Y, mLoad.Z);
                    Plane    ap    = new Plane(n.Location, axis);
                    Arc      mArc  = new Arc(new Circle(ap, 2.5 * elementFactor * graphicFactor), Math.PI * 1.5);
                    display.AddArc(mArc);
                    display.AddVector(mArc.EndPoint, mArc.TangentAt(Math.PI * 1.5));

                    if (showLoadValues)
                    {
                        Plane p = new Plane(n.Location - n.MomentLoad / forceFactor * elementFactor * 5 * graphicFactor * 1.1, Vector3d.XAxis, Vector3d.ZAxis);
                        Rhino.Display.Text3d t = new Rhino.Display.Text3d(n.MomentLoad.Length.ToString("G2"), p, elementFactor * 0.4 * textFactor);
                        t.Bold = true;
                        display.AddText(t, Color.Magenta);
                    }
                }

                if (showNodeNumbers)
                {
                    Plane p = new Plane(n.Location, Vector3d.XAxis, Vector3d.ZAxis);
                    Rhino.Display.Text3d t = new Rhino.Display.Text3d(n.CCXId(), p, elementFactor * 0.4 * textFactor);
                    t.Bold = true;
                    display.AddText(t, Color.Purple);
                }
            }
        }
コード例 #6
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of bars.
        public static void AddBarPreview(this Rhino.Display.CustomDisplay display, Model model, IEnumerable <int> ids, out HashSet <int> nodeIds, double graphicFactor, double elementFactor, double textFactor, bool showComponentNumbers, bool showElementNumbers, bool showLCS, bool showThk = false, string barResultType = "None", bool showResultValues = false)
        {
            nodeIds = new HashSet <int>();
            if (model.Bars.Count == 0)
            {
                return;
            }

            // Take all results out first to determine min & max, otherwise could be done inside the loop.
            Dictionary <int, double[]> barResults = new Dictionary <int, double[]>();
            double BFactor = 0;

            if (barResultType != "None")
            {
                barResults = model.Mesh.GetElementResults(barResultType);
                double barExtreme = barResults.Values.Select(r => Math.Max(Math.Abs(r[0]), Math.Abs(r[1]))).Max();
                BFactor = elementFactor / barExtreme * 10;
            }

            ids = ids.Count() == 0 ? Enumerable.Range(0, model.Bars.Count) : ids.Select(i => i - 1);

            foreach (int i in ids)
            {
                Bar   bar    = model.Bars[i];
                Plane locLCS = new Plane(bar.LCS);
                locLCS.Rotate(bar.Rotation, locLCS.ZAxis);
                locLCS.Translate(locLCS.XAxis * bar.Offset.X);
                locLCS.Translate(locLCS.YAxis * bar.Offset.Y);

                Vector3d hOffset = locLCS.XAxis * (bar.Profile.GetHeight() * 0.5);
                if (showThk)
                {
                    hOffset *= 2;
                }

                Plane tp = new Plane(locLCS.Origin, bar.LCS.YAxis, Vector3d.ZAxis);
                tp.Translate(hOffset);
                Curve[] profileCurves = bar.Profile.ToRhinoProfile();

                if (showComponentNumbers)
                {
                    Rhino.Display.Text3d t = new Rhino.Display.Text3d("Bar " + bar.CCXId(), tp, elementFactor * 0.6 * textFactor);
                    t.Bold = true;
                    display.AddText(t, Color.DarkRed);
                }

                foreach (Element element in bar.Elements)
                {
                    Element1D e   = element as Element1D;
                    int       eId = e.Id.AsInteger;

                    nodeIds.Add(e.Nodes.First().Id.AsInteger);
                    nodeIds.Add(e.Nodes.Last().Id.AsInteger);

                    Point3d[] endPts = e.GetVertices().ToArray();
                    Point3d   c      = (endPts[0] + endPts[1]) * 0.5;

                    display.AddLine(new Line(endPts[0], endPts[1]), Color.Aqua);

                    if (showThk)
                    {
                        Plane          eP = new Plane(locLCS);
                        List <Point3d> elementVertices = e.GetVertices().ToList();
                        eP.Translate(elementVertices[0] - bar.LCS.Origin);
                        Transform ptp = Transform.PlaneToPlane(Plane.WorldXY, eP);

                        // Use DisplayPipeline to get surface preview! Now a temporary solution given.
                        foreach (Curve pc in profileCurves)
                        {
                            Curve opc = pc.DuplicateCurve();
                            opc.Transform(ptp);
                            display.AddCurve(opc);
                            opc.Translate(elementVertices[1] - elementVertices[0]);
                            display.AddCurve(opc);
                        }
                    }

                    if (barResultType != "None")
                    {
                        Vector3d graphDir;
                        switch (barResultType)
                        {
                        case "Myy":
                            graphDir = locLCS.XAxis;
                            break;

                        case "Mxx":
                            graphDir = locLCS.YAxis;
                            break;

                        default:
                            string barResDir = barResultType.ToString().Substring(1, 1);
                            graphDir = barResDir == "y" ? locLCS.YAxis : locLCS.XAxis;
                            break;
                        }

                        graphDir *= BFactor * graphicFactor;
                        Point3d[] cPts = new Point3d[] { endPts[0], endPts[1], endPts[1] + graphDir * barResults[eId][1], endPts[0] + graphDir * barResults[eId][0] };
                        display.AddPolygon(cPts, Color.CornflowerBlue, Color.Black, true, true);

                        if (showResultValues && barResults.Count != 0)
                        {
                            Plane tp1 = new Plane(tp);
                            tp1.Translate(endPts[0] - tp1.Origin + graphDir * barResults[eId][0]);
                            Rhino.Display.Text3d t1 = new Rhino.Display.Text3d(barResults[eId][0].ToString("G2"), tp1, elementFactor * 0.4 * textFactor);
                            t1.Bold = true;
                            display.AddText(t1, Color.Black);
                            Plane tp2 = new Plane(tp);
                            tp2.Translate(endPts[1] - tp2.Origin + graphDir * barResults[eId][1]);
                            Rhino.Display.Text3d t2 = new Rhino.Display.Text3d(barResults[eId][1].ToString("G2"), tp2, elementFactor * 0.4 * textFactor);
                            t2.Bold = true;
                            display.AddText(t2, Color.Black);
                        }
                    }

                    if (showLCS)
                    {
                        display.AddVector(c, locLCS.XAxis * elementFactor * graphicFactor, Color.Red);
                        display.AddVector(c, locLCS.YAxis * elementFactor * graphicFactor, Color.Green);
                        display.AddVector(c, locLCS.ZAxis * elementFactor * graphicFactor, Color.Blue);
                    }

                    if (showElementNumbers)
                    {
                        Plane etp = new Plane(tp);
                        etp.Translate(c - bar.LCS.Origin);
                        Rhino.Display.Text3d t = new Rhino.Display.Text3d(e.CCXId(), etp, elementFactor * 0.4 * textFactor);
                        t.Bold = true;
                        display.AddText(t, Color.Black);
                    }
                }
            }
        }
コード例 #7
0
ファイル: PreviewUtil.cs プロジェクト: PawelBee/Guanaco
        /***************************************************/

        // Create the preview of panels.
        public static void AddPanelPreview(this Rhino.Display.CustomDisplay display, Model model, IEnumerable <int> ids, out HashSet <int> nodeIds, double graphicFactor, double elementFactor, double textFactor, double forceFactor, bool showComponentNumbers, bool showElementNumbers, bool showLCS, bool showLoads, bool showLoadValues, bool showEdges, bool showThk = false, Grasshopper.GUI.Gradient.GH_Gradient gradient = null, string panelResultType = "None", bool showResultValues = false)
        {
            nodeIds = new HashSet <int>();
            if (model.Panels.Count == 0)
            {
                return;
            }

            // Take all results out first to determine min & max, otherwise could be done inside the loop.
            Dictionary <int, double> panelTopResults    = new Dictionary <int, double>();
            Dictionary <int, double> panelBottomResults = new Dictionary <int, double>();
            double panelMax = 0;
            double panelMin = 0;

            if (panelResultType != "None")
            {
                Dictionary <int, double[]> panelResults = model.Mesh.GetElementResults(panelResultType);
                foreach (KeyValuePair <int, double[]> elResult in panelResults)
                {
                    int      id              = elResult.Key;
                    double[] results         = elResult.Value;
                    int      halfResultCount = results.Length / 2;

                    panelTopResults.Add(id, results.Skip(halfResultCount).Average());
                    panelBottomResults.Add(id, results.Take(halfResultCount).Average());
                }

                panelMax = Math.Max(panelTopResults.Values.Max(), panelBottomResults.Values.Max());
                panelMin = Math.Min(panelTopResults.Values.Min(), panelBottomResults.Values.Min());
            }

            ids = ids.Count() == 0 ? Enumerable.Range(0, model.Panels.Count) : ids.Select(i => i - 1);

            foreach (int i in ids)
            {
                Panel panel = model.Panels[i];

                if (showComponentNumbers)
                {
                    Vector3d fOffset = panel.LCS.ZAxis * 0.002;
                    if (showThk)
                    {
                        fOffset += panel.LCS.ZAxis * 0.5 * panel.Thickness;
                    }

                    Plane fp = new Plane(panel.LCS.Origin + fOffset, panel.LCS.ZAxis);
                    Plane bp = new Plane(panel.LCS.Origin - fOffset, -panel.LCS.ZAxis);
                    Rhino.Display.Text3d ft = new Rhino.Display.Text3d("Panel " + panel.CCXId(), fp, elementFactor * 0.6 * textFactor);
                    Rhino.Display.Text3d bt = new Rhino.Display.Text3d("Panel " + panel.CCXId(), bp, elementFactor * 0.6 * textFactor);
                    ft.Bold = true;
                    bt.Bold = true;
                    display.AddText(ft, Color.DarkRed);
                    display.AddText(bt, Color.DarkRed);
                }

                foreach (Element element in panel.Elements)
                {
                    Element2D e   = element as Element2D;
                    int       eId = e.Id.AsInteger;
                    foreach (Node n in e.Nodes.Take(e.PrimaryNodeCount))
                    {
                        nodeIds.Add(n.Id.AsInteger);
                    }

                    Color bottomColor;
                    Color topColor;

                    if (panelResultType == "None")
                    {
                        bottomColor = topColor = Color.Aqua;
                    }
                    else
                    {
                        bottomColor = gradient.ColourAt((panelBottomResults[eId] - panelMin) / (panelMax - panelMin));
                        topColor    = gradient.ColourAt((panelTopResults[eId] - panelMin) / (panelMax - panelMin));
                    }

                    Point3d  centroid  = e.GetCentroid();
                    Vector3d normal    = e.GetNormal();
                    Vector3d minOffset = normal * 0.001;
                    Vector3d offset    = showThk ? normal * 0.5 * panel.Thickness : minOffset;

                    List <Point3d> front = new List <Point3d>();
                    List <Point3d> back  = new List <Point3d>();

                    foreach (Point3d v in e.GetVertices())
                    {
                        front.Add(v + offset);
                        back.Add(v - offset);
                    }
                    display.AddPolygon(front, topColor, Color.Black, true, showEdges);
                    display.AddPolygon(back, bottomColor, Color.Black, true, showEdges);

                    if (showThk)
                    {
                        front.Add(front[0]);
                        back.Add(back[0]);
                        for (int j = 0; j < front.Count - 1; j++)
                        {
                            List <Point3d> fv = front.GetRange(j, 2);
                            List <Point3d> bv = back.GetRange(j, 2);
                            bv.Reverse();
                            fv.AddRange(bv);
                            display.AddPolygon(fv, Color.Aqua, Color.Black, true, true);
                        }
                    }

                    Plane tp = new Plane(panel.LCS);
                    tp.Origin = centroid + offset + minOffset;
                    tp.XAxis *= -1;
                    tp.ZAxis *= -1;
                    Plane bp = new Plane(panel.LCS);
                    bp.Origin = centroid - offset - minOffset;

                    if (showResultValues && panelTopResults.Count != 0)
                    {
                        Rhino.Display.Text3d t1 = new Rhino.Display.Text3d(panelTopResults[eId].ToString("G2"), tp, elementFactor * 0.4 * textFactor);
                        t1.Bold = true;
                        display.AddText(t1, Color.Black);
                        Rhino.Display.Text3d t2 = new Rhino.Display.Text3d(panelBottomResults[eId].ToString("G2"), bp, elementFactor * 0.4 * textFactor);
                        t2.Bold = true;
                        display.AddText(t2, Color.Black);
                    }

                    if (showLCS)
                    {
                        display.AddVector(centroid, e.Orientation[0] * elementFactor * graphicFactor, Color.Red);
                        display.AddVector(centroid, e.Orientation[1] * elementFactor * graphicFactor, Color.Green);
                        display.AddVector(centroid, normal * elementFactor * graphicFactor, Color.Blue);
                    }

                    if (showLoads && e.Pressure != 0)
                    {
                        Vector3d       pv             = normal * e.Pressure / forceFactor * elementFactor * 5 * graphicFactor;
                        List <Point3d> pressurePoints = new List <Point3d>();
                        foreach (Point3d pt in e.PopulateWithPoints())
                        {
                            if (e.Pressure > 0)
                            {
                                display.AddVector(pt - pv - offset, pv);
                            }
                            else
                            {
                                display.AddVector(pt - pv + offset, pv);
                            }
                        }

                        if (showLoadValues)
                        {
                            Plane p;
                            if (e.Pressure > 0)
                            {
                                p = new Plane(e.GetCentroid() - pv * 1.1 - offset, Vector3d.XAxis, Vector3d.ZAxis);
                            }
                            else
                            {
                                p = new Plane(e.GetCentroid() - pv * 1.1 + offset, Vector3d.XAxis, Vector3d.ZAxis);
                            }

                            Rhino.Display.Text3d t = new Rhino.Display.Text3d(e.Pressure.ToString("G2"), p, elementFactor * 0.4 * textFactor);
                            t.Bold = true;
                            display.AddText(t, Color.Magenta);
                        }
                    }

                    if (showElementNumbers)
                    {
                        Rhino.Display.Text3d tt = new Rhino.Display.Text3d(e.CCXId(), tp, elementFactor * 0.4 * textFactor);
                        Rhino.Display.Text3d bt = new Rhino.Display.Text3d(e.CCXId(), bp, elementFactor * 0.4 * textFactor);
                        tt.Bold = true;
                        bt.Bold = true;
                        display.AddText(tt, Color.Black);
                        display.AddText(bt, Color.Black);
                    }
                }
            }
        }
コード例 #8
0
        /// <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)
        {
            ghdoc = this.OnPingDocument();
            ghdoc.ContextChanged += new GH_Document.ContextChangedEventHandler(CheckDisplay);

            Model input = null;

            DA.GetData(0, ref input);
            if (input.Mesh == null)
            {
                return;
            }
            Model model = input.Clone() as Model;

            Grasshopper.Kernel.Types.GH_ObjectWrapper type0D = null;
            Grasshopper.Kernel.Types.GH_ObjectWrapper type1D = null;
            Grasshopper.Kernel.Types.GH_ObjectWrapper type2D = null;
            DA.GetData(1, ref type0D);
            DA.GetData(2, ref type1D);
            DA.GetData(3, ref type2D);

            type0D.Value.CheckResultDimension(0);
            type1D.Value.CheckResultDimension(1);
            type2D.Value.CheckResultDimension(2);
            string nodeResultType = type0D.ToString();
            string barResType     = type1D.ToString();
            string panelResType   = type2D.ToString();

            bool showVals, showNds, showEdgs, deformed, showLCS, showLoads, showSupports, showCNs, showNNs, showENs, showLVals;

            showVals = showNds = showEdgs = deformed = showLCS = showLoads = showSupports = showCNs = showNNs = showENs = showLVals = false;
            double TFactor, GFactor, Dfactor;

            TFactor = GFactor = Dfactor = 0;
            DA.GetData(4, ref showVals);
            DA.GetData(5, ref showNds);
            DA.GetData(6, ref showEdgs);
            DA.GetData(7, ref deformed);
            DA.GetData(8, ref showLCS);
            DA.GetData(9, ref showLoads);
            DA.GetData(10, ref showSupports);
            DA.GetData(11, ref showCNs);
            DA.GetData(12, ref showNNs);
            DA.GetData(13, ref showENs);
            DA.GetData(14, ref showLVals);
            DA.GetData(15, ref TFactor);
            DA.GetData(16, ref GFactor);
            DA.GetData(17, ref Dfactor);

            List <int> panelIds = new List <int>();
            List <int> barIds   = new List <int>();

            DA.GetDataList(18, barIds);
            DA.GetDataList(19, panelIds);

            double[] sizeFactors = model.sizeFactors();
            double   EFactor     = sizeFactors[0];
            double   FFactor     = sizeFactors[1];

            if (deformed)
            {
                model.Mesh.Deform(Dfactor);
            }

            m_display = new Rhino.Display.CustomDisplay(!this.Hidden);
            Grasshopper.GUI.Gradient.GH_Gradient gradient = PreviewUtil.CreateStandardGradient();

            HashSet <int> nodeIds = new HashSet <int>();
            HashSet <int> barNodeIds;
            HashSet <int> panelNodeIds;

            m_display.AddBarPreview(model, barIds, out barNodeIds, GFactor, EFactor, TFactor, showCNs, showENs, showLCS, false, barResType, showVals);
            m_display.AddPanelPreview(model, panelIds, out panelNodeIds, GFactor, EFactor, TFactor, FFactor, showCNs, showENs, showLCS, showLoads, showLVals, showEdgs, false, gradient, panelResType, showVals);

            nodeIds.UnionWith(panelNodeIds);
            nodeIds.UnionWith(barNodeIds);
            m_display.AddNodePreview(model, nodeIds, GFactor, EFactor, TFactor, FFactor, showNds, showNNs, showLoads, showLVals, gradient, nodeResultType, showVals);

            if (showSupports)
            {
                m_display.AddSupportPreview(model, nodeIds, EFactor, GFactor);
            }
        }