コード例 #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)
        {
            // INPUT
            // declaration
            int    numNestingGrid_ = 3;
            string soilProfileA_   = "0000LO";
            string soilProfileB_   = "0000LO";

            DA.GetData(0, ref numNestingGrid_);
            DA.GetData(1, ref soilProfileA_);
            DA.GetData(2, ref soilProfileB_);

            // actions
            envimetGrid.NestingGrid nGrid = new envimetGrid.NestingGrid();

            if (numNestingGrid_ != 0)
            {
                nGrid.NumNestingGrid = numNestingGrid_;
            }
            if (soilProfileA_ != null)
            {
                nGrid.SoilProfileA = soilProfileA_;
            }
            if (soilProfileB_ != null)
            {
                nGrid.SoilProfileB = soilProfileB_;
            }

            // OUTPUT
            DA.SetData(0, nGrid);
        }
コード例 #2
0
ファイル: Spaces.cs プロジェクト: saeranv/Dragonfly
        /// <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);
            }
        }