Beispiel #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            ETABS.SapModel.Analyze.RunAnalysis();

            //try
            //{
            //    int NumberNames = 0;
            //    string[] MyName = string[0];
            //    ETABS.SapModel.PointObj.GetNameList(ref NumberNames, ref MyName);
            //}
            //catch (Exception)
            //{

            //    System.Reflection.Assembly ETABSassembly = System.Reflection.Assembly.GetAssembly(ETABS2013.cOAPI);
            //    ETABS = (ETABS2013.cOAPI)ETABSassembly.CreateInstance("CSI.ETABS.API.ETABSObject");

            //}
            DA.SetData(0, ETABS);
            System.GC.KeepAlive(ETABS);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            List <Point3d>  pts   = new List <Point3d>();
            double          tol   = 0;

            int ret;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetDataList(1, pts))
            {
                return;
            }
            if (!DA.GetData(2, ref tol))
            {
                return;
            }

            for (int i = 0; i < pts.Count; i++)
            {
                ret = ETABS.SapModel.SelectObj.CoordinateRange(pts[i].X - tol, pts[i].X + tol, pts[i].Y - tol, pts[i].Y + tol, pts[i].Z - tol, pts[i].Z + tol);
            }

            DA.SetData(0, ETABS);
        }
Beispiel #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS         = null;
            List <string>   groupNames    = new List <string>();
            string          newColumnName = "";

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetDataList(1, groupNames))
            {
                return;
            }
            if (!DA.GetData(2, ref newColumnName))
            {
                return;
            }

            Tools tools = new Tools();

            for (int i = 0; i < groupNames.Count; i++)
            {
                string[] shells = tools.GetGroupInformation(ETABS, groupNames[i]);
                for (int j = 0; j < shells.Count(); j++)
                {
                    ETABS.SapModel.FrameObj.SetSection(shells[j], newColumnName);
                }
            }

            DA.SetData(0, ETABS);
        }
Beispiel #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            List <Line>     lines = new List <Line>();

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetDataList(1, lines))
            {
                return;
            }


            for (int i = 0; i < lines.Count(); i++)
            {
                double x1   = lines[i].PointAt(0).X;
                double y1   = lines[i].PointAt(0).Y;
                double z1   = lines[i].PointAt(0).Z;
                double x2   = lines[i].PointAt(1).X;
                double y2   = lines[i].PointAt(1).Y;
                double z2   = lines[i].PointAt(1).Z;
                string Name = "";

                ETABS.SapModel.FrameObj.AddByCoord(x1, y1, z1, x2, y2, z2, ref Name);
            }
            DA.SetData(0, ETABS);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            bool   newDocument = new bool();
            string docName     = "empty";

            if (!DA.GetData(0, ref newDocument))
            {
                return;
            }
            if (!DA.GetData(1, ref docName) && newDocument == false)
            {
                return;
            }

            //System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = System.TimeSpan.FromDays(1);
            //System.Runtime.Remoting.Lifetime.LifetimeServices.RenewOnCallTime = System.TimeSpan.FromDays(1);

            //Create ETABS Object
            string   pathtoetabs   = @"C:\Program Files\Computers and Structures\ETABS 2013\ETABS.exe";
            Assembly ETABSassembly = Assembly.LoadFrom(pathtoetabs);

            //ETABS2013.cOAPI test = (ETABS2013.cOAPI)ETABSassembly.GetModule("CSI.ETABS.API.ETABSObject");


            ETABS2013.cOAPI ETABS = (ETABS2013.cOAPI)ETABSassembly.CreateInstance("CSI.ETABS.API.ETABSObject"); //if developer settings checkobx is left checked it stops here (1. Solution exception:Unable to cast object of type 'CSI.ETABS.API.ETABSObject' to type 'ETABS2013.cOAPI'.)
            //Interaction.GetObject(
            //ETABS2013.cOAPI ETABS2 = (ETABS2013.cOAPI)Microsoft.VisualBasic.Interaction.GetObject(@"H:\Entisar Iterations\140409_iteration_model.EDB");


            //Type anExtractedType = ETABSassembly.GetType("CSI.ETABS.API.ETABSObject");
            //object testis = (ETABS2013.cOAPI)Activator.CreateInstance(anExtractedType);

            //object testis = (ETABS2013.cOAPI)Activator.GetObject(anExtractedType, "C:/Program Files/Computers and Structures/ETABS 2013/ETABS.exe");

            //ETABS2013.cOAPI newETABS = (ETABS2013.cOAPI)testis;
            //newETABS.SapModel.InitializeNewModel();

            //Start ETABS and Create New Model
            ETABS.ApplicationStart();

            if (newDocument == true)
            {
                ETABS.SapModel.InitializeNewModel(ETABS2013.eUnits.kN_m_C);
                ETABS.SapModel.File.NewBlank();
                //   ETABS.SapModel.File.NewGridOnly(4,3,3,1,1,24,24);
            }
            else
            {
                ETABS.SapModel.File.OpenFile(docName);
            }

            DA.SetData(0, ETABS);
            //GC.KeepAlive(ETABS);
        }
Beispiel #6
0
 protected override void SolveInstance(IGH_DataAccess DA)
 {
     ETABS2013.cOAPI ETABS = null;
     if (!DA.GetData(0, ref ETABS))
     {
         return;
     }
     ETABS2013.cSapModel sapModel = ETABS.SapModel;
     ETABS.SapModel.SetModelIsLocked(false);
     DA.SetData(0, ETABS);
 }
Beispiel #7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string docName = "empty";

            ETABS2013.cOAPI ETABS = null;

            if (!DA.GetData(1, ref docName))
            {
                return;
            }
            if (!DA.GetData(2, ref ETABS))
            {
                return;
            }

            ETABS.SapModel.File.Save(docName);
        }
Beispiel #8
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS    = null;
            string          loadcase = null;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetData(1, ref loadcase))
            {
                return;
            }

            Rhino.RhinoDoc RhinoDoc = Rhino.RhinoDoc.ActiveDoc;

            Rhino.Display.RhinoView view    = RhinoDoc.Views.ActiveView;
            System.Drawing.Bitmap   picture = view.CaptureToBitmap();
            picture.Save("H:\\printad.bmp");
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }

            Tools tools = new Tools();

            int numberNames = 0;

            string[] myName = new string[0];
            ETABS.SapModel.AreaObj.GetNameList(ref numberNames, ref myName);

            for (int i = 0; i < myName.Count(); i++)
            {
                tools.SetupWalls(ref ETABS, myName[i]);
            }
            DA.SetData(0, ETABS);
        }
Beispiel #10
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS    = null;
            string          loadcase = null;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetData(1, ref loadcase))
            {
                return;
            }

            int numberResults = 0;

            string[] loadcaseArray = new string[1];
            loadcaseArray[0] = loadcase;
            string[] StepType      = new string[100];
            double[] StepNum       = new double[100];
            double[] Period        = new double[100];
            double[] Frequency     = new double[100];
            double[] CirqFrequency = new double[100];
            double[] EigenValue    = new double[100];

            int ret;

            ret = ETABS.SapModel.Results.Setup.SetCaseSelectedForOutput(loadcase);

            ret = ETABS.SapModel.Results.ModalPeriod(ref numberResults, ref loadcaseArray, ref StepType, ref StepNum, ref Period, ref Frequency, ref CirqFrequency, ref EigenValue);

            //outputting the etabsobj even though nothing has changed... to be able to extract other analysis results before next iteration in a loop.
            //Is there a better way to do this?
            DA.SetData(0, ETABS);
            DA.SetDataList(1, Period.ToList());
            DA.SetDataList(2, Frequency.ToList());
            DA.SetDataList(3, CirqFrequency.ToList());
            DA.SetDataList(4, EigenValue.ToList());
        }
Beispiel #11
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS      = null;
            List <string>   groupNames = new List <string>();
            List <double>   modifiers  = new List <double>();

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetDataList(1, groupNames))
            {
                return;
            }
            if (!DA.GetDataList(2, modifiers))
            {
                return;
            }

            if (groupNames.Count != modifiers.Count)
            {
                throw new Exception("Group and wall type lists must match in numbers");
            }

            Tools tools = new Tools();

            for (int i = 0; i < groupNames.Count; i++)
            {
                string[] shells = tools.GetGroupInformation(ETABS, groupNames[i]);
                for (int j = 0; j < shells.Count(); j++)
                {
                    tools.ModifyWall(ref ETABS, modifiers[i], shells[j]);
                }
            }

            DA.SetData(0, ETABS);
        }
Beispiel #12
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }

            //Gets the ETABS geometry
            int numberNames = 0;

            string[] pointList = null;
            ETABS.SapModel.PointObj.GetNameList(ref numberNames, ref pointList);

            List <Point3d> outPoints = new List <Point3d>();
            List <int>     IDs       = new List <int>();

            for (int i = 0; i < pointList.Count(); i++)
            {
                double x1 = 0;
                double y1 = 0;
                double z1 = 0;
                ETABS.SapModel.PointObj.GetCoordCartesian(pointList[i], ref x1, ref y1, ref z1);

                Point3d pt = new Point3d(x1, y1, z1);
                outPoints.Add(pt);

                int ID = Convert.ToInt32(pointList[i]);
                IDs.Add(ID);
            }



            DA.SetDataList(0, IDs);
            DA.SetDataList(1, outPoints);
        }
Beispiel #13
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }

            //Gets the ETABS geometry
            int numberNames = 0;

            string[] frameList = null;
            ETABS.SapModel.FrameObj.GetNameList(ref numberNames, ref frameList);

            //if there are selcted objects only export these
            List <string> selectedFramesList = new List <string>();
            bool          selected           = false;

            for (int i = 0; i < frameList.Count(); i++)
            {
                ETABS.SapModel.FrameObj.GetSelected(frameList[i], ref selected);
                if (selected)
                {
                    selectedFramesList.Add(frameList[i]);
                }
            }

            //if no objects are selected export all
            if (selectedFramesList.Count == null)
            {
                selectedFramesList.AddRange(frameList);
            }

            List <Line> outLines = new List <Line>();
            List <int>  IDs      = new List <int>();

            string  point1 = null;
            string  point2 = null;
            double  x1     = 0;
            double  x2     = 0;
            double  y1     = 0;
            double  y2     = 0;
            double  z1     = 0;
            double  z2     = 0;
            Point3d pt1    = new Point3d();
            Point3d pt2    = new Point3d();

            for (int i = 0; i < selectedFramesList.Count(); i++)
            {
                ETABS.SapModel.FrameObj.GetPoints(selectedFramesList[i], ref point1, ref point2);
                ETABS.SapModel.PointObj.GetCoordCartesian(point1, ref x1, ref y1, ref z1);
                ETABS.SapModel.PointObj.GetCoordCartesian(point2, ref x2, ref y2, ref z2);
                pt1 = new Point3d(x1, y1, z1);
                pt2 = new Point3d(x2, y2, z2);
                Line columnLine = new Line(pt1, pt2);
                outLines.Add(columnLine);

                int ID = Convert.ToInt32(selectedFramesList[i]);
                IDs.Add(ID);
            }



            DA.SetDataList(0, IDs);
            DA.SetDataList(1, outLines);
        }
Beispiel #14
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS    = null;
            string          loadcase = null;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetData(1, ref loadcase))
            {
                return;
            }

            int numberResults = 0;

            ETABS2013.eItemTypeElm ItemTypeElm = new ETABS2013.eItemTypeElm();
            string[] obj           = new string[0];
            string[] elm           = new string[0];
            string[] loadcaseArray = new string[1];
            loadcaseArray[0] = loadcase;
            string[] StepType = new string[100];
            double[] StepNum  = new double[100];
            double[] U1       = new double[100];
            double[] U2       = new double[100];
            double[] U3       = new double[100];
            double[] R1       = new double[100];
            double[] R2       = new double[100];
            double[] R3       = new double[100];

            //Creates output lists
            List <int>    IDs    = new List <int>();
            List <double> U1list = new List <double>();
            List <double> U2list = new List <double>();
            List <double> U3list = new List <double>();
            List <double> R1list = new List <double>();
            List <double> R2list = new List <double>();
            List <double> R3list = new List <double>();

            //Gets point objects
            int numberNames = 0;

            string[] myName = new string[0];
            ETABS.SapModel.PointObj.GetNameList(ref numberNames, ref myName);

            int ret;

            ret = ETABS.SapModel.Results.Setup.SetCaseSelectedForOutput(loadcase);

            int commonto = 0;


            for (int i = 0; i < myName.Count(); i++)
            {
                ETABS.SapModel.PointObj.GetCommonTo(myName[i], ref commonto);
                ETABS.SapModel.Results.JointDispl(myName[i], ItemTypeElm, ref numberResults, ref obj, ref elm, ref loadcaseArray, ref StepType, ref StepNum, ref U1, ref U2, ref U3, ref R1, ref R2, ref R3);
                int ID = Convert.ToInt32(myName[i]);
                IDs.Add(ID);
                U1list.Add(U1[0]);
                U2list.Add(U2[0]);
                U3list.Add(U3[0]);
                R1list.Add(R1[0]);
                R2list.Add(R2[0]);
                R3list.Add(R3[0]);
            }

            //outputting the etabsobj even though nothing has changed... to be able to extract other analysis results before next iteration in a loop.
            //Is there a better way to do this?
            DA.SetData(0, ETABS);
            DA.SetDataList(1, IDs);
            DA.SetDataList(2, U1list);
            DA.SetDataList(3, U2list);
            DA.SetDataList(4, U3list);
            DA.SetDataList(5, R1list);
            DA.SetDataList(6, R2list);
            DA.SetDataList(7, R3list);
        }
Beispiel #15
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS = null;
            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }


            //Gets the ETABS geometry
            int numberNames = 0;

            string [] shellList = null;
            ETABS.SapModel.AreaObj.GetNameList(ref numberNames, ref shellList);

            //if there are selcted objects only export these
            List <string> selectedShellsList = new List <string>();
            bool          selected           = false;

            for (int i = 0; i < shellList.Count(); i++)
            {
                ETABS.SapModel.AreaObj.GetSelected(shellList[i], ref selected);
                if (selected)
                {
                    selectedShellsList.Add(shellList[i]);
                }
            }

            //if no objects are selected export all
            if (selectedShellsList.Count == null)
            {
                selectedShellsList.AddRange(shellList);
            }


            List <Brep> outBreps = new List <Brep>();
            List <int>  IDs      = new List <int>();

            for (int i = 0; i < selectedShellsList.Count(); i++)
            {
                int       numberPoints = 0;
                string [] points       = null;
                ETABS.SapModel.AreaObj.GetPoints(selectedShellsList[i], ref numberPoints, ref points);

                //Creates the Rhino Geometry
                List <Point3d> cornerPoints = new List <Point3d>();
                Point3d        cornerPoint;
                foreach (string point in points)
                {
                    double x = 0;
                    double y = 0;
                    double z = 0;
                    ETABS.SapModel.PointObj.GetCoordCartesian(point, ref x, ref y, ref z);
                    cornerPoint = new Point3d(x, y, z);
                    cornerPoints.Add(cornerPoint);
                }
                Brep outBrep;
                if (cornerPoints.Count == 3)
                {
                    outBrep = Brep.CreateFromCornerPoints(cornerPoints[0], cornerPoints[1], cornerPoints[2], 0.01);
                    outBreps.Add(outBrep);
                }
                else if (cornerPoints.Count == 4)
                {
                    outBrep = Brep.CreateFromCornerPoints(cornerPoints[0], cornerPoints[1], cornerPoints[2], cornerPoints[3], 0.01);
                    outBreps.Add(outBrep);
                }
                else
                {
                    //TODO: Deal with area objects with more than 4 corner points
                    //For now add null items so lists match up
                    outBrep = null;
                    outBreps.Add(null);
                }

                int ID = Convert.ToInt32(shellList[i]);
                IDs.Add(ID);
            }


            DA.SetDataList(0, IDs);
            DA.SetDataList(1, outBreps);
        }
Beispiel #16
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI     activate = null;
            List <GeometryBase> surfaces = new List <GeometryBase>();

            if (!DA.GetData(0, ref activate))
            {
                return;
            }
            if (!DA.GetDataList(1, surfaces))
            {
                return;
            }


            /*   for (int i = 0; i < meshes.Count(); i++)
             * {
             *
             *
             *
             *    //Get the contour polyline and its points (this is done to get the points in the right order
             *    Rhino.Geometry.Plane mshPlane = new Rhino.Geometry.Plane(Plane.WorldXY.Origin, new Vector3d(0, 0, 1));
             *    Polyline[] mshOutlines = meshes[i].GetOutlines(mshPlane);
             *    List<Point3d> pts = mshOutlines[0].GetRange(0, mshOutlines[0].Count - 1).ToList(); // Last value in the range is the first point again
             *
             *    //I uset arrays cus the AddByCoord function can only handle arrays
             *    double[] xValues = new double[pts.Count];
             *    double[] yValues = new double[pts.Count];
             *    double[] zValues = new double[pts.Count];
             *    for(int j = 0; j < pts.Count; j++)
             *    {
             *        xValues[j] =pts[j].X;
             *        yValues[j] = pts[j].Y;
             *        zValues[j] = pts[j].Z;
             *    }
             *
             *
             *
             *    string Name = "Slab" + i;
             *    ETABS.SapModel.AreaObj.AddByCoord(pts.Count(), ref xValues, ref yValues, ref zValues, ref Name);
             *    ETABS.SapModel.View.RefreshView(0, false);
             * } */


            //Connect from the input ETABS file
            ETABS2013.cOAPI ETABS = (ETABS2013.cOAPI)activate;
            Mesh            mesh  = new Mesh();

            for (int i = 0; i < surfaces.Count(); i++)
            {
                //If input is brep convert to mesh (easiest way to get the points)
                if (surfaces[i].GetType() == typeof(Rhino.Geometry.Brep))
                {
                    MeshingParameters mshParam = new MeshingParameters();
                    mshParam.MinimumTolerance = 0.01; //we can get meshing params from a standard GH component as it is a generic type

                    Mesh[] mshArray = Mesh.CreateFromBrep((Brep)surfaces[i], mshParam);
                    mesh = mshArray[0];
                }
                //If input is a mesh no convertion is needed
                else if (surfaces[i].GetType() == typeof(Rhino.Geometry.Mesh))
                {
                    mesh = (Mesh)surfaces[i];
                }
                //If not mesh or brep do nothing (return)
                else
                {
                    return;
                }

                //Get the contour polyline and its points (this is done to get the points in the right order
                BoundingBox          bMesh       = new BoundingBox();
                Rhino.Geometry.Plane mshPlane    = new Rhino.Geometry.Plane(bMesh.Center, mesh.FaceNormals[0]);   //Just take one normal on the surface since it's planar
                Polyline[]           mshOutlines = mesh.GetOutlines(mshPlane);
                List <Point3d>       pts         = mshOutlines[0].GetRange(0, mshOutlines[0].Count - 1).ToList(); // Last value in the range is the first point again

                //I use arrays because the AddByCoord function can only handle arrays
                double[] xValues = new double[pts.Count];
                double[] yValues = new double[pts.Count];
                double[] zValues = new double[pts.Count];
                for (int j = 0; j < pts.Count; j++)
                {
                    //Add all the x,y,z values from the mesh into arrays, used in AddByCoord function
                    xValues[j] = pts[j].X;
                    yValues[j] = pts[j].Y;
                    zValues[j] = pts[j].Z;
                }
                string Name = "Slab" + i;
                //Add the mesh in ETABS and refresh the view
                ETABS.SapModel.AreaObj.AddByCoord(pts.Count(), ref xValues, ref yValues, ref zValues, ref Name);
                ETABS.SapModel.View.RefreshView(0, false);



                DA.SetData(0, ETABS);
            }
        }
Beispiel #17
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            #region Create Variables
            List <Grasshopper.Kernel.Types.GH_Curve> lines  = new List <Grasshopper.Kernel.Types.GH_Curve>();
            List <Grasshopper.Kernel.Types.GH_Brep>  panels = new List <Grasshopper.Kernel.Types.GH_Brep>();

            #endregion

            #region Extract Data from GH
            if (!DA.GetDataList(0, panels))
            {
                return;
            }
            if (panels == null)
            {
                return;
            }
            if (panels.Count == 0)
            {
                return;
            }

            if (!DA.GetDataList(1, lines))
            {
                return;
            }
            if (lines == null)
            {
                return;
            }
            if (lines.Count == 0)
            {
                return;
            }



            #endregion

            //Create ETABS Object
            string pathtoetabs = @"C:\Program Files\Computers and Structures\ETABS 2013\ETABS.exe";
            System.Reflection.Assembly ETABSassembly = System.Reflection.Assembly.LoadFrom(pathtoetabs);
            ETABS2013.cOAPI            ETABS         = (ETABS2013.cOAPI)ETABSassembly.CreateInstance("CSI.ETABS.API.ETABSObject"); //if developer settings checkobx is left checked it stops here (1. Solution exception:Unable to cast object of type 'CSI.ETABS.API.ETABSObject' to type 'ETABS2013.cOAPI'.)

            //Start ETABS and Create New Model
            ETABS.ApplicationStart();
            ETABS.SapModel.InitializeNewModel();
            ETABS.SapModel.File.NewBlank();
            ETABS.SapModel.SetPresentUnits(ETABS2013.eUnits.kgf_mm_C);
            ETABS.SapModel.File.Save(@"C:\Users\janderss\testingtesting.EDB");
            int counter = 0;
            //Import Lines
            foreach (Grasshopper.Kernel.Types.GH_Curve i in lines)
            {
                string label = counter.ToString();
                //Insert Nodes
                ETABS.SapModel.PointObj.AddCartesian(i.Value.PointAtStart.X, i.Value.PointAtStart.Y, i.Value.PointAtStart.Z, ref label, "", "Global", false, 0);
                ETABS.SapModel.PointObj.AddCartesian(i.Value.PointAtEnd.X, i.Value.PointAtEnd.Y, i.Value.PointAtEnd.Z, ref label, "", "Global", false, 0);
                //Insert Frames
                ETABS.SapModel.FrameObj.AddByCoord(i.Value.PointAtStart.X, i.Value.PointAtStart.Y, i.Value.PointAtStart.Z, i.Value.PointAtEnd.X, i.Value.PointAtEnd.Y, i.Value.PointAtEnd.Z, ref label, "Default", "", "Global");

                counter++;
            }
            //Use Robot to Mesh Surfaces

            #region create Robot app
            //      robApp = new RobotApplicationClass();
            //      // if Robot is not visible
            //      if (robApp.Visible == 0)   // robApp.Visible = -1
            //      {
            //          robApp.Interactive = 1;   // set robot visible and allow user interaction
            //          robApp.Visible = 1;
            //      }
            //      robApp.Project.New(IRobotProjectType.I_PT_SHELL);
            //      IRobotStructure str = robApp.Project.Structure;
            //      RobotLabelServer labelserv = null;

            //      robApp.Project.Structure.ResultsFreeze=false;
            //      //Delete all the panel objects In the model(don't use clear as this clears loadcases etc.)

            //    //  If Delete_Panels = True Then
            //      RobotSelection prev_panel_sel;
            //      prev_panel_sel=robApp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_PANEL);
            //      robApp.Project.Structure.Objects.DeleteMany(prev_panel_sel);
            //    // End If

            //      RobotPointsArray panel_pnts=new RobotPointsArray();
            //      List<int> panel_nos= new List<int>();
            //      GH_ObjectType obj_type= new GH_ObjectType();
            //      Grasshopper.Kernel.Types.GH_Brep curr_brep = new Grasshopper.Kernel.Types.GH_Brep();

            //      int brepno = 1;
            //     foreach (Grasshopper.Kernel.Types.GH_Brep b in panels)
            //      {
            //         List<Rhino.Geometry.BrepEdge> crvs =new List<Rhino.Geometry.BrepEdge>();
            //         int edges=0;
            //         int i=0;
            //         edges=b.Value.Edges.Count;
            //         for(i=0;i<=edges-1;i++)
            //         {
            //             crvs.Add(b.Value.Edges[i]);
            //         }


            //          string label = b.ToString();
            //          int p = 0;
            //          panel_pnts.SetSize(edges);

            //         counter=1;
            //         foreach (Rhino.Geometry.BrepEdge crv in crvs)
            //         {
            //             panel_pnts.Set(counter, crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z);
            //             counter++;
            //         }

            //          robApp.Project.Structure.Objects.CreateContour(brepno, panel_pnts);

            //          robApp.Project.Structure.Objects.BeginMultiOperation();
            //          int panel_NUM = robApp.Project.Structure.Objects.FreeNumber;

            //          RobotObjObject panel;


            //          //panel = (RobotObjObject)robApp.Project.Structure.Objects.Get(panel_NUM);
            //          panel = (RobotObjObject)robApp.Project.Structure.Objects.Get(brepno);

            //          panel.SetLabel(IRobotLabelType.I_LT_PANEL_CALC_MODEL, "Shell");
            //          panel.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, "TH12.00");
            //          panel.Main.Attribs.Meshed = 1;
            //          panel.Update();
            //          panel.Initialize();
            //          panel.Mesh.Generate();


            //          brepno++;
            //     }
            //     robApp.Project.Structure.Objects.EndMultiOperation();
            //     robApp.Project.ViewMngr.Refresh();
            ////For i As int32 = 0 To Brep_or_Curve.Count - 1
            ////  obj_type = Brep_or_Curve(i).ObjectType

            ////  //If obj_type = ObjectType.Brep Then
            ////  //  curr_brep = Brep_or_Curve(i)
            ////  //  crv_array = curr_brep.DuplicateEdgeCurves(False)
            ////  //End If

            ////  //If obj_type = ObjectType.Curve Then
            ////  //  curr_crv = Brep_or_Curve(i)
            ////  //  crv_array = curr_crv.DuplicateSegments
            ////  //End If



            ////  Dim kounta As int32: kounta = 1
            ////  For Each crv As curve In crv_array
            ////    panel_pnts.SetSize(kounta)
            ////    panel_pnts.Set(kounta, crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z)
            ////    kounta = kounta + 1
            ////  Next crv

            ////  robot.Project.Structure.Objects.BeginMultiOperation()
            ////  Dim panel As robotobjobject
            ////  Dim panel_num As int32: panel_num = robot.Project.Structure.Objects.FreeNumber + i
            ////  panel_nos.Add(panel_num)
            ////  robot.Project.Structure.Objects.CreateContour(panel_num, panel_pnts)
            ////  panel = robot.Project.Structure.Objects.Get(panel_num)
            ////  panel.SetLabel(IRobotLabelType.I_LT_PANEL_CALC_MODEL, Calculation_Model)
            ////  panel.Main.Attribs.Meshed = True

            ////  If Calculation_Model = "Shell" Then
            ////    panel.Mesh.Params.SurfaceParams.Generation.Type = IRobotMeshGenerationType.I_MGT_ELEMENT_SIZE
            ////    panel.Mesh.Params.SurfaceParams.Generation.ElementSize = FE_Element_Size
            ////    panel.Mesh.Params.SurfaceParams.Method.Method = IRobotMeshMethodType.I_MMT_DELAUNAY
            ////    panel.Mesh.Params.SurfaceParams.Delaunay.RegularMesh = False
            ////    If Not fe_emitter_size = 0 Then
            ////      panel.Mesh.Params.SurfaceParams.Delaunay.Type = IRobotMeshDelaunayType.I_MDT_DELAUNAY_AND_KANG
            ////      panel.Mesh.Params.SurfaceParams.Delaunay.EmittersSmoothing = True
            ////      panel.Mesh.Params.SurfaceParams.Delaunay.H0 = fe_emitter_size
            ////    End If
            ////  End If

            ////  If Panel_Thickness.Count >= Brep_or_Curve.Count Then
            ////    panel.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, Panel_Thickness(i))
            ////  Else
            ////    panel.setlabel(IRobotLabelType.I_LT_PANEL_THICKNESS, "TH30_CONCR")
            ////  End If

            ////  panel.initialize
            ////  panel_pnts = Nothing

            ////Next i
            ////robot.Project.Structure.Objects.EndMultiOperation()

            ////Panel_Numbers = panel_nos
            ////robot.Project.ViewMngr.Refresh


            //      // IRobotNodeSupportData fix;

            #endregion


            //Import Panels
            foreach (Grasshopper.Kernel.Types.GH_Brep i in panels)
            {
                int      number_of_vertices = i.Value.Vertices.Count();
                double[] x     = new double[number_of_vertices];
                double[] y     = new double[number_of_vertices];
                double[] z     = new double[number_of_vertices];
                string   label = i.ToString();
                int      p     = 0;

                for (p = 0; p <= number_of_vertices - 1; p++)
                {
                    x[p] = i.Value.Vertices[p].Location.X;
                    y[p] = i.Value.Vertices[p].Location.Y;
                    z[p] = i.Value.Vertices[p].Location.Z;
                }

                ETABS.SapModel.AreaObj.AddByCoord(number_of_vertices, ref x, ref y, ref z, ref label, "Default", "", "Global");
            }

            //Merge Points
            int      NumberPoints = 0;
            string[] PointName    = new string[1];
            ETABS.SapModel.EditPoint.Merge(.01, ref NumberPoints, ref PointName);
            DA.SetData(0, ETABS);
        }
Beispiel #18
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS    = null;
            string          loadcase = null;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetData(1, ref loadcase))
            {
                return;
            }

            //Gets the ETABS geometry
            int numberNames = 0;

            string[] frameList = null;
            ETABS.SapModel.FrameObj.GetNameList(ref numberNames, ref frameList);

            List <int>    IDs    = new List <int>();
            List <double> PList  = new List <double>();
            List <double> V2List = new List <double>();
            List <double> V3List = new List <double>();
            int           ret;

            ret = ETABS.SapModel.Results.Setup.SetCaseSelectedForOutput(loadcase);

            for (int i = 0; i < frameList.Count(); i++)
            {
                //Define all output arrays
                ETABS2013.eItemTypeElm ItemTypeElm = new ETABS2013.eItemTypeElm();
                int      NumberResults             = 20;
                string[] obj      = new string[100];
                double[] objSta   = new double[100];
                string[] elm      = new string[100];
                double[] elmSta   = new double[100];
                string[] PointElm = new string[100];
                string[] LoadCase = new string[100];
                string[] StepType = new string[100];
                double[] StepNum  = new double[100];
                double[] P        = new double[100];
                double[] V2       = new double[100];
                double[] V3       = new double[100];
                double[] T        = new double[100];
                double[] M2       = new double[100];
                double[] M3       = new double[100];
                //Gets the analysis results
                ret = ETABS.SapModel.Results.FrameForce(frameList[i], ItemTypeElm, ref NumberResults, ref obj, ref objSta, ref elm, ref elmSta, ref LoadCase, ref StepType, ref StepNum, ref P, ref V2, ref V3, ref T, ref M2, ref M3);

                //TODO: find out what's interesting
                int ID = Convert.ToInt32(frameList[i]);
                IDs.Add(ID);
                PList.Add(P.Max());
                V2List.Add(V2.Max());
                V3List.Add(V3.Max());
            }
            DA.SetDataList(0, IDs);
            DA.SetDataList(1, PList);
            DA.SetDataList(2, V2List);
            DA.SetDataList(3, V3List);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ETABS2013.cOAPI ETABS    = null;
            string          loadcase = null;

            if (!DA.GetData(0, ref ETABS))
            {
                return;
            }
            if (!DA.GetData(1, ref loadcase))
            {
                return;
            }

            //Gets the ETABS geometry
            int numberNames = 0;

            string[] shellList = null;
            ETABS.SapModel.AreaObj.GetNameList(ref numberNames, ref shellList);

            List <int>        IDs        = new List <int>();
            List <double>     svmtopList = new List <double>();
            DataTree <double> svmtopTree = new DataTree <double>();
            List <double>     svmbotList = new List <double>();

            List <double> s11topList = new List <double>();
            List <double> s22topList = new List <double>();
            List <double> s12topList = new List <double>();

            List <double> s11botList = new List <double>();
            List <double> s12botList = new List <double>();
            List <double> s22botList = new List <double>();
            int           ret;

            ret = ETABS.SapModel.Results.Setup.SetCaseSelectedForOutput(loadcase);

            for (int i = 0; i < shellList.Count(); i++)
            {
                //Define all output arrays
                ETABS2013.eItemTypeElm ItemTypeElm = new ETABS2013.eItemTypeElm();
                int      NumberResults             = 20;
                string[] obj       = new string[100];
                string[] elm       = new string[100];
                string[] PointElm  = new string[100];
                string[] LoadCase  = new string[100];
                string[] StepType  = new string[100];
                double[] StepNum   = new double[100];
                double[] s11top    = new double[100];
                double[] s22top    = new double[100];
                double[] s12top    = new double[100];
                double[] smaxtop   = new double[100];
                double[] smintop   = new double[100];
                double[] sangletop = new double[100];
                double[] svmtop    = new double[100];
                double[] s11bot    = new double[100];
                double[] s22bot    = new double[100];
                double[] s12bot    = new double[100];
                double[] smaxbot   = new double[100];
                double[] sminbot   = new double[100];
                double[] sanglebot = new double[100];
                double[] svmbot    = new double[100];
                double[] s13avg    = new double[100];
                double[] s23avg    = new double[100];
                double[] smaxavg   = new double[100];
                double[] sangleavg = new double[100];
                double[] U1        = new double[100];
                double[] U2        = new double[100];
                double[] U3        = new double[100];
                double[] R1        = new double[100];
                double[] R2        = new double[100];
                double[] R3        = new double[100];
                //Gets the analysis results
                ret = ETABS.SapModel.Results.AreaStressShell(shellList[i], ItemTypeElm, ref NumberResults, ref obj, ref elm, ref PointElm, ref LoadCase, ref StepType, ref StepNum, ref s11top,
                                                             ref s22top, ref s12top, ref smaxtop, ref smintop, ref sangletop, ref svmtop, ref s11bot, ref s22bot, ref s12bot, ref smaxbot,
                                                             ref sminbot, ref sanglebot, ref svmbot, ref s13avg, ref s23avg, ref smaxavg, ref sangleavg);


                for (int j = 0; j < svmtop.Count(); j++)
                {
                    int[] pathInts = new int[2];
                    pathInts[0] = i;
                    pathInts[1] = j;
                    GH_Path path = new GH_Path(pathInts);
                    svmtopTree.Add(svmtop[j], path);
                }
                int ID = Convert.ToInt32(shellList[i]);
                IDs.Add(ID);
                svmtopList.Add(svmtop.Max());
                svmbotList.Add(svmbot.Max());
                s11topList.Add(s11top.Max());
                s22topList.Add(s22top.Max());
                s12topList.Add(s12top.Max());
            }

            //TODO: Find out which ones of these are of interest
            DA.SetDataList("Shell Identities", IDs);
            if (_showsSVMtop)
            {
                DA.SetDataList("svmtop", svmtopList);
            }
            if (_showsSVMbot)
            {
                DA.SetDataList("svmbot", svmbotList);
            }
            if (_shows11top)
            {
                DA.SetDataList("s11top", s11topList);
            }
            if (_shows12top)
            {
                DA.SetDataList("s12top", s12topList);
            }
            if (_shows22top)
            {
                DA.SetDataList("s22top", s22topList);
            }
        }