示例#1
0
        public FileContentResult Download(string Id, string type)
        {
            ///conteeeeeeeeeent
            var fileName   = "home-2floor-ft.ifc";
            var filePath   = Server.MapPath($"~/Users/input-files/{fileName}");
            var outputFile = Server.MapPath($"~/Users/output-files/{fileName}-Structure");

            StudTable.FilePath = Server.MapPath(@"~/App_Data\Tables\StudSpacingTable.csv");

            Table502_5.HeadersTableExteriorPath = Server.MapPath(@"~/App_Data\Tables\table502.5(1).csv");
            Table502_5.HeadersTableInteriorPath = Server.MapPath(@"~/App_Data\Tables\table502.5(2).csv");

            Table502_3_1.JoistTableLivingAreasPath   = Server.MapPath(@"~/App_Data\Tables\table502.3.1(2).csv");
            Table502_3_1.JoistTableSleepingAreasPath = Server.MapPath(@"~/App_Data\Tables\table502.3.1(1).csv");

            using (IfModel model = IfModel.Open(filePath))
            {
                Bim.Domain.Configuration.Startup.Configuration(model);

                model.Delete <IfcBeam>();
                model.Delete <IfcColumn>();
                WoodFrame wf = new WoodFrame(model);
                wf.FrameWalls();
                model.Delete <IfcWall>();
                model.Delete <IfcSlab>();

                // model.Save(saveName);

                GeometryCollection GC1 = new GeometryCollection();
                GC1.AddToCollection(model.Instances.OfType <IfJoist>());
                GC1.AddToCollection(model.Instances.OfType <IfStud>());
                GC1.AddToCollection(model.Instances.OfType <IfSill>());
                byte[] filecontent = GC1.ToExcel(GC1.BOQTable, "Testing Excel", false, "Number", "Collection");

                ///result
                return(File(filecontent, GC1.ExcelContentType, "test1.xlsx"));
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            #region Header
            "Wall Framing Solutions ".Header(ConsoleColor.Yellow, ConsoleColor.Black);
            "Starting....".Print(ConsoleColor.Cyan);
            "".PrintAtPosition(x: 10, foreColor: ConsoleColor.Red);
            "-------------------------------------------- ".Print(ConsoleColor.White);

            #endregion
            var d = Split.Equal(13, .65);

            string fileName = @"..\..\Models\ITI.Qondos.2.ifc";
            string saveName = fileName.Split(new string[] { ".ifc" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() + @"-Solved.ifc";

            IfcStore ifcStore = IfcStore.Open(fileName);
            //  ifcStore.SaveAs(fileName, Xbim.IO.IfcStorageType.IfcXml);
            var beams = ifcStore.Instances.OfType <IIfcBeam>();

            var prop  = new IfProperties((IfcBuildingElement)beams.FirstOrDefault());
            var sList = new List <IfSingleValue>()
            {
                new IfSingleValue("test value1", "100"),
                new IfSingleValue("test value2", "400"),
                new IfSingleValue("test value2", "300"),
            };
            var qList = new List <IfQuantity>()
            {
                new IfQuantity("test Quantity  value1", "100", IfUnitEnum.AREAUNIT),
                new IfQuantity("test Quantity value2", "200", IfUnitEnum.AREAUNIT),
                new IfQuantity("test Quantity value2", "300", IfUnitEnum.AREAUNIT),
            };
            //prop.AddSingleValue("sss value List", sList);
            //prop.AddQuantities("Quantity value List", qList);
            //prop.FindByName("Join Status");
            //prop.FindByValue("Both joins enabled");
            //prop.FindSVProperty(new IfSingleValue("Join Status", "Both joins enabled"));
            //prop.New();
            //    ifcStore.SaveAs((fileName + "prop"));

            using (IfModel model = IfModel.Open(fileName))
            {
                Startup.Configuration(model);
                model.Save(fileName);
                model.Delete <IfcBeam>();
                model.Delete <IfcColumn>();
                WoodFrame wf = new WoodFrame(model);
                wf.FrameWalls();
                model.Delete <IfcWall>();
                model.Delete <IfcSlab>();

                model.Save(saveName);
                // OpenWindow(fileName);
                //  OpenWindow(saveName);

                List <IfWall>  walls  = model.Instances.OfType <IfWall>().ToList();
                List <IfFloor> floors = model.Instances.OfType <IfFloor>().ToList();

                $"{walls.Count} walls are found".Print(ConsoleColor.Cyan);
                $"{floors.Count} floors are found".Print(ConsoleColor.Cyan);

                List <WallPolygon> wallPolygons = new List <WallPolygon>();
                int i = 0;
                foreach (var item in walls)
                {
                    $"wall no {i}".Print(ConsoleColor.Cyan);
                    wallPolygons.Add(new WallPolygon(item));
                    $"{wallPolygons.Last().Regions.Count} regions are found".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().Openings.Count} opens".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().RLeft.Count} left regions".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().RRight.Count} Right regions".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().RTop.Count} top regions".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().RBottom.Count} bot regions".Print(ConsoleColor.Cyan);
                    $"\t {wallPolygons.Last().RBetween.Count} middle regions".Print(ConsoleColor.Cyan);
                    i++;
                }
                GeometryCollection GC1 = new GeometryCollection();
                GC1.AddToCollection(model.Instances.OfType <IfJoist>());
                GC1.AddToCollection(model.Instances.OfType <IfStud>());
                GC1.AddToCollection(model.Instances.OfType <IfSill>());
                var coll = GC1.ToExcel(GC1.BOQTable, "Testing Excel", false, "Number", "Collection");
            }
            #region Footer
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Done!");
            #endregion
            Console.ReadLine();
        }