示例#1
0
        public static void Configuration(IfModel ifModel)
        {
            //configure the Length class
            Length.RoundValue = 4;

            IfMaterial.Setup = new Setup()
            {
                { "Header", new IfMaterial(ifModel, new IfColor(0, 255, 0)) },
                { "TopPlate", new IfMaterial(ifModel, new IfColor(255, 102, 255)) },
                { "BottomPlate", new IfMaterial(ifModel, new IfColor(0, 0, 255)) },
                { "RLeft", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.DodgerBlue)) },
                { "RRight", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.DarkGolden)) },
                { "RBetween", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.Orange)) },
                { "TopStud", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.LightSlateGrey)) },
                { "BottomStud", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.DeepSkyBlue)) },
                { "Joist", new IfMaterial(ifModel, IfColor.GetColor(IfColorEnum.Violet)) },
            };

            IfStud.Setup = new Setup()
            {
                { "Dimension", new IfDimension(2, 6, 2) }
            };

            IfSill.Setup = new Setup()
            {
                { "Dimension", new IfDimension(2, 6, 2) }
            };
        }
        public void Design(string fileName)
        {
            //StudTable.FilePath = Server.MapPath(@"~\App_Data\Tables\StudSpacingTable.csv");
            //Table502_3_1.FilePath = Server.MapPath(@"~\App_Data\Tables\table502.3.1(1).txt");
            fileName = fileName ?? "home-2floor-ft.ifc";
            var     filePath   = Server.MapPath($"~/Users/input-files/{fileName}");
            var     outputFile = Server.MapPath($"~/Users/output-files/{fileName}-Structure");
            IfModel model      = IfModel.Open(filePath);

            //IfStartup.Configuration(model);
            model.Delete <IfcBeam>();
            model.Delete <IfcColumn>();
            WoodFrame wf = new WoodFrame(model);

            // wf.StudTable = IfStartup.LoadTablesAsync.Result;

            // wf.JoistTable = Table502_3_1.Load(null);

            // wf.TestAsync();


            // model.Delete<IfcWall>();
            model.Save(outputFile);
            // OpenWindow(fileName);
        }
示例#3
0
文件: If.cs 项目: lxdotnet/lxdn-core
        public If(IfModel model, ExecutionEngine logic)
        {
            this.create = () =>
            {
                var condition = logic.Operators.CreateFrom(model.Condition).As <bool>();
                var then      = logic.Operators.CreateFrom(model.Then);
                var @else     = model.Else.IfExists(e => logic.Operators.CreateFrom(e, then.Expression.Type));

                var cases = new List <SwitchCase> {
                    Expression.SwitchCase(then, Expression.Constant(true))
                };

                // 'else' (if specified) turns to be 'default' in the switch statement:
                return(Expression.Switch(condition, @else.IfExists(e => e.Expression) ?? Expression.Default(then.Expression.Type), cases.ToArray()));
                // todo: try using Expression.Condition
            };
        }
示例#4
0
        public void Configure(IfModel ifModel, WoodFrame woodFrame)
        {
            #region AsyncMethods
            //string filePath = @"..\..\Models\home-2floor-ft.ifc";
            //Task<IfModel> LoadModelAsync = Task.Factory.StartNew<IfModel>((filepath) =>
            //{
            //    //load Tables;
            //    return IfModel.Open(filePath);
            //}, filePath);

            Task <DesignOptions> LoadDesignOptionsAsync = Task.Factory.StartNew(() =>
            {
                //load settings from Database;
                return(new DesignOptions());
            });

            Task LoadConfigurationAsync = Task.Factory.StartNew(() =>
            {
                //load configuration file from database or whatever;
            });

            Task <StudTable> LoadStudTablesAsync = Task.Factory.StartNew(() =>
            {
                //  load Tables;
                return(StudTable.Load(" "));
            });

            Task <Table502_3_1> LoadHeaderTablesAsync = Task.Factory.StartNew(() =>
            {
                //  load Tables;
                return(Table502_3_1.Load(null));
            });
            //

            #endregion

            //load model design option and configuration
            //ifModel.DesignOptions = LoadDesignOptionsAsync.Result;


            ////load wood frame tables
            //woodFrame.StudTable= LoadStudTablesAsync.Result;
            //woodFrame.JoistTable = LoadHeaderTablesAsync.Result;
        }
示例#5
0
        public void Design(string fileName)
        {
            //StudTable.FilePath = Server.MapPath(@"~\App_Data\Tables\StudSpacingTable.csv");
            //Table502_3_1.FilePath = Server.MapPath(@"~\App_Data\Tables\table502.3.1(1).txt");
            fileName = fileName ?? "home-2floor-ft.ifc";
            var filePath   = Server.MapPath($"~/Users/input-files/{fileName}");
            var outputFile = Server.MapPath($"~/Users/output-files/{fileName}-Structure");


            var       startup = new IfStartup();
            IfModel   model   = IfModel.Open(filePath);
            WoodFrame wf      = new WoodFrame(model);

            startup.Configure(model, wf);
            startup.Configuration(model);
            //wf.GetPolygons();
            //wf.Optimize();
            //wf.Write();
            model.Save(outputFile);
        }
示例#6
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"));
            }
        }
示例#7
0
 public WoodFrame(IfModel ifModel)
 {
     IfModel = ifModel;
 }
示例#8
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();
        }