public ArrowLoad(GCanvas gCanvas, Point startPoint, Point endPoint, double loadValue) : base(gCanvas) { GCanvas = gCanvas; StartPoint = startPoint; EndPoint = endPoint; Arrows = new List <Arrow>(); Height = loadValue /*Scale*/; var span = Math.Sqrt( Math.Pow(startPoint.X - endPoint.X, 2) + Math.Pow(startPoint.Y - endPoint.Y, 2)); Spacings = 10; var spaces = Split.Equal(span, Spacings); foreach (var space in spaces) { var arrow = new Arrow(GCanvas, new Point(StartPoint.X + space, StartPoint.Y), Height); arrow.Rotate(180); Arrows.Add(arrow); } HeaderLine = new GLine(GCanvas, new Point(StartPoint.X, StartPoint.Y - Height), new Point(EndPoint.X, EndPoint.Y - Height)); }
private void SetJoists() { RecSection section = IfJoist.Setup.Get <RecSection>("RecSection"); WoodType WT = IfJoist.Setup.Get <WoodType>("WoodType"); WoodGrade WG = IfJoist.Setup.Get <WoodGrade>("WoodGrade"); foreach (var reg in FloorPolygon.Regions) { double span = reg.IfDimension.XDim.Inches; var Cells = JoistTable.Cells.Where(e => e.WoodGrade == WG && e.WoodType == WT && e.SpanToInch >= span && e.DeadLoadPsF == 10 && e.Section == section) .OrderBy(e => e.SpanToInch).ToList(); double S = Cells[0].Spacing; var spaces = Split.Equal(reg.IfDimension.YDim - section.Width, S); for (int i = 0; i < spaces.Count; i++) { //var spacingVec = new Vector3D(spaces[i], spaces[i], spaces[i]); var DircVec = new IfLocation( FloorPolygon.IfFloor.ShortDirection.Y * spaces[i], FloorPolygon.IfFloor.ShortDirection.X * spaces[i], FloorPolygon.IfFloor.ShortDirection.Z * spaces[i] ); var ifJoist = new IfJoist(FloorPolygon.IfFloor) { IfModel = FloorPolygon.IfFloor.IfModel, IfFloor = FloorPolygon.IfFloor, IfLocation = DircVec, IfDimension = new IfDimension( section.Width.Inches, section.Depth.Inches, reg.IfDimension.XDim.Inches), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("Joist") }; ifJoist.New(); ifJoist.IfMaterial.AttatchTo(ifJoist); //add to studs elments Joists.Add(ifJoist); // } } }
public override void SetScale(double value) { HeaderLine.SetScale(value); HeaderLine.SetTranslate(0, -Height * value + Height); Arrows.ForEach(e => e.Remove()); Spacings = 10 * value; var span = Math.Sqrt( Math.Pow(StartPoint.X - EndPoint.X, 2) + Math.Pow(StartPoint.Y - EndPoint.Y, 2)); var spaces = Split.Equal(span * value, Spacings); foreach (var space in spaces) { var arrow = new Arrow(GCanvas, new Point(StartPoint.X + space, StartPoint.Y), Height * value); arrow.Rotate(180); Arrows.Add(arrow); } HeaderLine.Remove(); Render(); }
private void SetStudsRegions() { var storyNo = WallPolygon.IfWall.Story.StoryNo; double height = 0; UnitName unit = WallPolygon.IfWall.IfModel.IfUnit.LengthUnit; height = WallPolygon.IfWall.IfDimension.ZDim.Feet; //switch (unit) //{ // case UnitName.MILLIMETRE: // height = Length.FromMilliMeters(WallPolygon.IfWall.IfDimension.ZDim.MilliMeter).Feet; // break; // // case UnitName.FOOT: // height = WallPolygon.IfWall.IfDimension.ZDim.Feet; // break; // case UnitName.METRE: // height = Length.FromMeters(WallPolygon.IfWall.IfDimension.ZDim.Meter).Feet; // break; // default: // break; //} var dim = IfStud.Setup.Get <IfDimension>("Dimension"); var maxdistance = StudTable.GetSpace(storyNo + 1, height, dim) .LastOrDefault().Spacing; // set maxdistance unit //switch (unit) //{ // case UnitName.MILLIMETRE: // maxdistance = Length.FromInches(maxdistance).MilliMeter; // //dim = dim.ToMilliMeters(); // break; // // case UnitName.METRE: // maxdistance = Length.FromInches(maxdistance).Meter; // //dim = dim.ToMeters(); // break; // // default: // maxdistance = Length.FromInches(maxdistance).Feet; // //dim = dim.ToFeet(); // break; //} //set Left Region foreach (var region in WallPolygon.RLeft) { double distance = 0; //switch (unit) //{ // case UnitName.MILLIMETRE: // distance = region.IfDimension.XDim.Inches; // break; // case UnitName.FOOT: // distance = region.IfDimension.XDim.Inches; // break; // case UnitName.METRE: // distance = region.IfDimension.XDim.Inches; // break; // default: // break; //} distance = region.IfDimension.XDim.Inches; var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance); for (int i = 0; i < spaces.Count; i++) { var ifStud = new IfStud(WallPolygon.IfWall) { IfModel = WallPolygon.IfWall.IfModel, IfWall = WallPolygon.IfWall, IfLocation = new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2, region.IfLocation.Y, region.IfLocation.Z), IfDimension = new IfDimension( dim.XDim, dim.YDim, region.IfDimension.ZDim), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RLeft"), }; ifStud.New(); ifStud.IfMaterial.AttatchTo(ifStud); //add to studs elments IfStuds.Add(ifStud); // } } //set right Region foreach (var region in WallPolygon.RRight) { double distance = 0; switch (unit) { case UnitName.MILLIMETRE: distance = region.IfDimension.XDim.Inches; break; case UnitName.FOOT: distance = region.IfDimension.XDim.Inches; break; case UnitName.METRE: distance = region.IfDimension.XDim.Inches; break; default: break; } var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance); for (int i = 0; i < spaces.Count; i++) { var ifStud = new IfStud(WallPolygon.IfWall) { IfModel = WallPolygon.IfWall.IfModel, IfWall = WallPolygon.IfWall, IfLocation = new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2, region.IfLocation.Y, region.IfLocation.Z), IfDimension = new IfDimension( dim.XDim, dim.YDim, region.IfDimension.ZDim), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RRight") }; ifStud.New(); ifStud.IfMaterial.AttatchTo(ifStud); //add to studs elments IfStuds.Add(ifStud); // } } //set between regions foreach (var region in WallPolygon.RBetween) { double distance = 0; switch (unit) { case UnitName.MILLIMETRE: distance = region.IfDimension.XDim.Inches; break; case UnitName.FOOT: distance = region.IfDimension.XDim.Inches; break; case UnitName.METRE: distance = region.IfDimension.XDim.Inches; break; default: break; } var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance); for (int i = 0; i < spaces.Count; i++) { var ifStud = new IfStud(WallPolygon.IfWall) { IfModel = WallPolygon.IfWall.IfModel, IfWall = WallPolygon.IfWall, IfLocation = new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2, region.IfLocation.Y, region.IfLocation.Z), IfDimension = new IfDimension( dim.XDim, dim.YDim, region.IfDimension.ZDim), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RBetween") }; ifStud.New(); ifStud.IfMaterial.AttatchTo(ifStud); //add to studs elments IfStuds.Add(ifStud); // } } //set Bottom Region foreach (var region in WallPolygon.RBottom) { double distance = 0; switch (unit) { case UnitName.MILLIMETRE: distance = region.IfDimension.XDim.Inches; break; case UnitName.FOOT: distance = region.IfDimension.XDim.Inches; break; case UnitName.METRE: distance = region.IfDimension.XDim.Inches; break; default: break; } var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance); for (int i = 0; i < spaces.Count; i++) { var ifStud = new IfStud(WallPolygon.IfWall) { IfModel = WallPolygon.IfWall.IfModel, IfWall = WallPolygon.IfWall, IfLocation = new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2, region.IfLocation.Y, region.IfLocation.Z), IfDimension = new IfDimension( dim.XDim, dim.YDim, region.IfDimension.ZDim), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("BottomStud") }; ifStud.New(); ifStud.IfMaterial.AttatchTo(ifStud); //add to studs elments IfStuds.Add(ifStud); // } } //set top region foreach (var region in WallPolygon.RTop) { double distance = 0; switch (unit) { case UnitName.MILLIMETRE: distance = region.IfDimension.XDim.Inches; break; case UnitName.FOOT: distance = region.IfDimension.XDim.Inches; break; case UnitName.METRE: distance = region.IfDimension.XDim.Inches; break; default: break; } var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance); for (int i = 0; i < spaces.Count; i++) { var ifStud = new IfStud(WallPolygon.IfWall) { IfModel = WallPolygon.IfWall.IfModel, IfWall = WallPolygon.IfWall, IfLocation = new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2, region.IfLocation.Y, region.IfLocation.Z), IfDimension = new IfDimension( dim.XDim, dim.YDim, region.IfDimension.ZDim), IfMaterial = IfMaterial.Setup.Get <IfMaterial>("TopStud") }; ifStud.New(); ifStud.IfMaterial.AttatchTo(ifStud); //add to studs elments IfStuds.Add(ifStud); // } } }
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(); }