Exemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //---variables---

            int          surfNo   = 0;
            Vector3d     forceVec = new Vector3d();
            BrepGeometry brp      = new BrepGeometry();
            MeshGeometry mesh     = new MeshGeometry();

            //---input---

            if (!DA.GetData(0, ref surfNo))
            {
                return;
            }
            if (!DA.GetData(1, ref forceVec))
            {
                return;
            }
            if (!DA.GetData(2, ref mesh))
            {
                return;
            }

            //---solve---

            brp = mesh.GetBrep();
            Brep        surface = mesh.GetSurfaceAsBrep(surfNo);
            double      area    = surface.GetArea();
            List <Node> nodes   = mesh.GetNodeList();

            (List <string> pointLoads, double maxLoad) = FindPointLoads(surfNo, area, forceVec, nodes, brp);

            // For previewing of loads

            double      refLength = brp.GetRefLength();
            List <Line> arrows    = DrawLoads(pointLoads, refLength, maxLoad);
            Color       color     = Color.FromArgb(135, 206, 255);

            //---output---

            DA.SetDataList(0, pointLoads);
            DA.SetDataList(1, arrows);
            DA.SetData(2, color);
        }