示例#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)
        {
            string      inx          = null;
            bool        runIt        = false;
            GridEnvimet envimentGrid = null;

            DA.GetData(0, ref inx);
            DA.GetData(1, ref envimentGrid);
            DA.GetData(2, ref runIt);

            if (runIt)
            {
                var modelgeometry = Facade.GetGridDetail(inx);

                if (modelgeometry == null)
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "It works only with 3d detailed model for now.\n" +
                                           "Please, use ENVI-Met Spaces to convert your 2.5D model into 3D model.");
                    return;
                }

                if (envimentGrid == null)
                {
                    envimentGrid = ReadEnvimet.GetGridFromInx(modelgeometry);
                }

                var mesh = GridOutput.GetAnalysisMesh(envimentGrid, Direction);

                DA.SetData(0, mesh);
            }
        }
示例#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)
        {
            string      inx          = null;
            bool        runIt        = false;
            bool        bake         = false;
            GridEnvimet envimentGrid = null;
            Curve       crv          = null;

            DA.GetData(0, ref inx);
            DA.GetData(1, ref envimentGrid);
            DA.GetData(2, ref runIt);
            DA.GetData(3, ref bake);
            DA.GetData(4, ref crv);

            if (runIt)
            {
                var modelgeometry = Facade.GetGridDetail(inx);
                if (modelgeometry == null)
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "It works only with 3d detailed model for now.\n" +
                                           "Please, use ENVI-Met Spaces to convert your 2.5D model into 3D model.");
                    return;
                }

                var matrix = Facade.GetFacadeSparseMatrix(inx).ToList();

                Facade face = new Facade();

                if (envimentGrid == null)
                {
                    envimentGrid = ReadEnvimet.GetGridFromInx(modelgeometry);
                }

                var facades = Facade.GenerateFacadeByDirection(matrix, envimentGrid, Direction);

                if (bake)
                {
                    Facade.BakeFacades(facades, bake, crv);
                }

                DA.SetData(0, face.GetAnalysisMesh(facades.ToList()));
            }
        }
示例#3
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
            double _telescope_           = 0.0;
            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;
            bool   combineGridType_ = false;
            Mesh   _baseSurface     = null;

            DA.GetData(0, ref _baseSurface);
            DA.GetData(1, ref _telescope_);
            DA.GetData(2, ref startTelescopeHeight_);
            DA.GetData(3, ref dimX_);
            DA.GetData(4, ref dimY_);
            DA.GetData(5, ref dimZ_);
            DA.GetData(6, ref addCellsLeft_);
            DA.GetData(7, ref addCellslRight_);
            DA.GetData(8, ref addCellsUp_);
            DA.GetData(9, ref addCellsDown_);
            DA.GetData(10, ref numCellsZ_);
            DA.GetData(11, ref combineGridType_);

            // run
            df_envimet_lib.Geometry.Grid grid = new df_envimet_lib.Geometry.Grid()
            {
                CombineGridType      = combineGridType_,
                DimX                 = dimX_,
                DimY                 = dimY_,
                DimZ                 = dimZ_,
                StartTelescopeHeight = startTelescopeHeight_,
                Telescope            = _telescope_,
                ExtLeftXgrid         = addCellsLeft_,
                ExtRightXgrid        = addCellslRight_,
                ExtUpYgrid           = addCellsUp_,
                ExtDownYgrid         = addCellsDown_,
                NumZ                 = numCellsZ_
            };

            grid.CalculateHeight();

            if (_telescope_ > 0)
            {
                if (_telescope_ >= 20.0)
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "max telescope factor is 20.");
                    return;
                }
            }

            grid.Surface = _baseSurface;

            // OUTPUT
            DA.SetData(0, grid);
        }