/// <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); } }
/// <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 // declaration double?_telescope_ = null; double startTelescopeHeight_ = 5.0; double dimX_ = 3.0; double dimY_ = 3.0; double dimZ_ = 3.0; int addCellsLeft_ = 2; int addCellslRight_ = 2; int addCellsDown_ = 2; int addCellsUp_ = 2; int numCellsZ_ = 15; DA.GetData(0, ref _telescope_); DA.GetData(1, ref startTelescopeHeight_); DA.GetData(2, ref dimX_); DA.GetData(3, ref dimY_); DA.GetData(4, ref dimZ_); DA.GetData(5, ref addCellsLeft_); DA.GetData(6, ref addCellslRight_); DA.GetData(7, ref addCellsDown_); DA.GetData(8, ref addCellsUp_); DA.GetData(9, ref numCellsZ_); // actions envimetGrid.AutoGrid myGrid = new envimetGrid.AutoGrid(); if (_telescope_ != 0) { myGrid.telescope = _telescope_; if (_telescope_ >= 20.0) { myGrid.ZGrids = myGrid.MaxZGrid - 1; myGrid.telescope = 20.0; this.AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "max telescope factor is 20."); } } if (dimX_ != 0) { myGrid.DimX = dimX_; } if (dimY_ != 0) { myGrid.DimY = dimY_; } if (dimZ_ != 0) { myGrid.DimZ = dimZ_; } if (startTelescopeHeight_ != 0) { myGrid.StartTelescopeHeight = startTelescopeHeight_; } if (addCellsLeft_ != 0) { myGrid.ExtLeftXgrid = addCellsLeft_; } if (addCellslRight_ > 0 || addCellslRight_ > 2) { myGrid.ExtRightXgrid = addCellslRight_; } if (addCellsUp_ > 0 || addCellsUp_ > 2) { myGrid.ExtUpYgrid = addCellsUp_; } if (addCellsDown_ > 0 || addCellsDown_ > 2) { myGrid.ExtDownYgrid = addCellsDown_; } if (numCellsZ_ > 0 || numCellsZ_ > 2) { myGrid.ZGrids = numCellsZ_; } if (numCellsZ_ >= myGrid.MaxZGrid) { myGrid.ZGrids = myGrid.MaxZGrid - 1; } // OUTPUT //DA.SetData(0, (object)envimetBuildings); DA.SetData(0, myGrid); }