Ejemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // INPUT
            // declaration
            List <Mesh>   _buildings    = new List <Mesh>();
            List <string> wallMaterial_ = new List <string>();
            List <string> roofMaterial_ = new List <string>();

            List <int>    greenBuildingsId_  = new List <int>();
            List <string> greenWallMaterial_ = new List <string>();
            List <string> greenRoofMaterial_ = new List <string>();

            string commonWallMaterial_ = null;
            string commonRoofMaterial_ = null;

            DA.GetDataList <Mesh>(0, _buildings);
            DA.GetDataList <string>(1, wallMaterial_);
            DA.GetDataList <string>(2, roofMaterial_);
            DA.GetData(3, ref commonWallMaterial_);
            DA.GetData(4, ref commonRoofMaterial_);

            DA.GetDataList <int>(5, greenBuildingsId_);
            DA.GetDataList <string>(6, greenWallMaterial_);
            DA.GetDataList <string>(7, greenRoofMaterial_);

            // actions
            envimetGrid.BuildingMatrix envimetBuildings = new envimetGrid.BuildingMatrix(_buildings, wallMaterial_, roofMaterial_, commonWallMaterial_, commonRoofMaterial_, greenBuildingsId_, greenWallMaterial_, greenRoofMaterial_);

            foreach (Mesh m in envimetBuildings.Buildings)
            {
                if (!(m.IsClosed))
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Please provide closed geometries");
                    return;
                }
            }


            // OUTPUT
            //DA.SetData(0, (object)envimetBuildings);
            DA.SetData(0, envimetBuildings);
        }
Ejemplo n.º 2
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)
        {
            // INPUT
            // building
            List <Mesh>   bgeo    = new List <Mesh>();
            List <string> wallmat = new List <string>();
            List <string> roofmat = new List <string>();

            List <int>    idgreen      = new List <int>();
            List <string> greenwallmat = new List <string>();
            List <string> greenroofmat = new List <string>();

            string cwallmat  = null;
            string croofomat = null;
            // location
            string loc      = "Site:Location,\nunknown_Location,\n0.0, !Latitude\n0.0, !Longitude\n0.0, !Time Zone\n0.0; !Elevation\n";
            int    rotation = 0;
            // soil
            string        bsoilmat = null;
            List <string> soilmat  = new List <string>();
            List <Brep>   sgeo     = new List <Brep>();
            // folder
            string _envimetFolder = null;
            // plant2d
            string        p2ddefmat = null;
            List <string> p2dmat    = new List <string>();
            List <Brep>   p2dgeo    = new List <Brep>();
            // plant3d
            string        p3ddefmat = null;
            List <string> p3dmat    = new List <string>();
            List <Brep>   p3dgeo    = new List <Brep>();
            // plant3d
            string        srcdefmat = null;
            List <string> srcmat    = new List <string>();
            List <Brep>   srcgeo    = new List <Brep>();
            // filename
            string fileName_ = "Morpho";
            // runit
            bool _runIt = false;
            // view
            bool viewGridXY_ = false;
            bool viewGridXZ_ = false;
            bool viewGridYZ_ = false;

            envimentIntegration.LocationFromLB _envimetLocation = new envimentIntegration.LocationFromLB(loc, rotation);
            envimetGrid.AutoGrid               _envimentGrid    = new envimetGrid.AutoGrid();
            envimetGrid.BuildingMatrix         _envimetBuidings = new envimetGrid.BuildingMatrix(bgeo, wallmat, roofmat, cwallmat, croofomat, idgreen, greenwallmat, greenroofmat);
            envimetGrid.Element2dMatrix        _envimetSoils    = new envimetGrid.Element2dMatrix(bsoilmat, soilmat, sgeo);
            envimetGrid.NestingGrid            nestingGrid_     = new envimetGrid.NestingGrid();
            envimetGrid.Element2dMatrix        envimet2dPlants_ = new envimetGrid.Element2dMatrix(p2ddefmat, p2dmat, p2dgeo);
            envimetGrid.ThreeDimensionalPlants envimet3dPlants_ = new envimetGrid.ThreeDimensionalPlants(p3ddefmat, p3dmat, p3dgeo);
            envimetGrid.Element2dMatrix        envimetSources_  = new envimetGrid.Element2dMatrix(srcdefmat, srcmat, srcgeo);

            DA.GetData(0, ref _envimetFolder);
            DA.GetData(1, ref _envimetLocation);
            DA.GetData(2, ref _envimentGrid);
            DA.GetData(3, ref nestingGrid_);
            DA.GetData(4, ref _envimetBuidings);
            DA.GetData(5, ref _envimetSoils);
            DA.GetData(6, ref envimet2dPlants_);
            DA.GetData(7, ref envimet3dPlants_);
            DA.GetData(8, ref envimetSources_);
            DA.GetData(9, ref fileName_);
            DA.GetData(10, ref _runIt);
            DA.GetData(11, ref viewGridXY_);
            DA.GetData(12, ref viewGridXZ_);
            DA.GetData(13, ref viewGridYZ_);

            // actions
            _envimentGrid.gZmethod(_envimetBuidings.Buildings); // INIT!!!

            if (viewGridXY_ == true)
            {
                DA.SetDataList(0, _envimentGrid.GridXY());
            }
            if (viewGridXZ_ == true)
            {
                DA.SetDataList(1, _envimentGrid.GridXZ());
            }
            if (viewGridYZ_ == true)
            {
                DA.SetDataList(2, _envimentGrid.GridYZ());
            }

            /// RUNIT

            string fileName = (fileName_ != null) ? fileName_ + ".INX" : "DragonflyEnvimet.INX";
            string fullName = System.IO.Path.Combine(_envimetFolder, fileName);

            if (_runIt == true)
            {
                envimentManagment.WriteINX.INXwriteMethod(fullName, _envimentGrid, nestingGrid_, _envimetLocation, _envimetBuidings, envimet2dPlants_, _envimetSoils, envimetSources_, envimet3dPlants_);
                DA.SetData(3, fullName);
            }
        }