public void Generate() { for (int i = 0; i < numberOfFloors; ++i) { var point = new Point(startPoint.X, startPoint.Y, startPoint.Z + i * floorHeight); rooms.Add(new Room(point, lenght, width, floorHeight, basementHeight)); } while (rooms.Count < numberOfRooms) { rooms.Add(rooms[rooms.Count - 1].SplitRoom()); rooms.Sort((x, y) => x.Area.CompareTo(y.Area)); } InsertElements.InsertPlate(A1, B1, C1, D1, "PL100", "A36"); if (roofHeight > 0) { InsertElements.InsertPlate(A1, B1, midPoint, "PL100", "A36"); InsertElements.InsertPlate(B1, C1, midPoint, "PL100", "A36"); InsertElements.InsertPlate(C1, D1, midPoint, "PL100", "A36"); InsertElements.InsertPlate(D1, A1, midPoint, "PL100", "A36"); InsertElements.InsertBeam(A1, midPoint, "L203X203X28.6", "350W"); InsertElements.InsertBeam(B1, midPoint, "L203X203X28.6", "350W", Position.RotationEnum.BACK); InsertElements.InsertBeam(C1, midPoint, "L203X203X28.6", "350W"); InsertElements.InsertBeam(D1, midPoint, "L203X203X28.6", "350W", Position.RotationEnum.BACK); } foreach (Room room in rooms) { room.InsertWalls(); } }
public static bool InsertWindows(double lenght, double height, double heightFloor) { var objects = new ModelObjectSelector().GetSelectedObjects(); while (objects.MoveNext()) { var obj = objects.Current; try { var midWallPoint = obj.GetCoordinateSystem().Origin; var wallLenght = obj.GetCoordinateSystem().AxisX; if (wallLenght.X == 0) { int numberOfWindows = Convert.ToInt32(Math.Floor(wallLenght.Y / (lenght + windowsDistance))); midWallPoint.Y += wallLenght.Y / numberOfWindows / 2; for (int i = 0; i < numberOfWindows; ++i) { ArrayList list = new ArrayList { new Point(midWallPoint.X, midWallPoint.Y - lenght / 2, midWallPoint.Z + heightFloor), new Point(midWallPoint.X, midWallPoint.Y + lenght / 2, midWallPoint.Z + heightFloor), new Point(midWallPoint.X, midWallPoint.Y + lenght / 2, midWallPoint.Z + heightFloor + height), new Point(midWallPoint.X, midWallPoint.Y - lenght / 2, midWallPoint.Z + heightFloor + height) }; InsertElements.InsertCutPlate(obj as ContourPlate, list, "PL100", "A36"); midWallPoint.Y += wallLenght.Y / numberOfWindows; } } else { int numberOfWindows = Convert.ToInt32(Math.Floor(wallLenght.X / (lenght + windowsDistance))); midWallPoint.X += wallLenght.X / numberOfWindows / 2; for (int i = 0; i < numberOfWindows; ++i) { ArrayList list = new ArrayList { new Point(midWallPoint.X - lenght / 2, midWallPoint.Y, midWallPoint.Z + heightFloor), new Point(midWallPoint.X + lenght / 2, midWallPoint.Y, midWallPoint.Z + heightFloor), new Point(midWallPoint.X + lenght / 2, midWallPoint.Y, midWallPoint.Z + heightFloor + height), new Point(midWallPoint.X - lenght / 2, midWallPoint.Y, midWallPoint.Z + heightFloor + height) }; InsertElements.InsertCutPlate(obj as ContourPlate, list, "PL100", "A36"); midWallPoint.X += wallLenght.X / numberOfWindows; } } } catch { return(true); } } return(false); }
public static bool InsertDoor(double doorWidth, double doorHeight) { var objects = new ModelObjectSelector().GetSelectedObjects(); while (objects.MoveNext()) { var obj = objects.Current; try { var midWallPoint = obj.GetCoordinateSystem().Origin; var wallLenght = obj.GetCoordinateSystem().AxisX; midWallPoint.X += wallLenght.X / 2; midWallPoint.Y += wallLenght.Y / 2; ArrayList list; if (wallLenght.X == 0) { list = new ArrayList { new Point(midWallPoint.X, midWallPoint.Y - doorWidth / 2, midWallPoint.Z), new Point(midWallPoint.X, midWallPoint.Y + doorWidth / 2, midWallPoint.Z), new Point(midWallPoint.X, midWallPoint.Y + doorWidth / 2, midWallPoint.Z + doorHeight), new Point(midWallPoint.X, midWallPoint.Y - doorWidth / 2, midWallPoint.Z + doorHeight) }; } else { list = new ArrayList { new Point(midWallPoint.X - doorWidth / 2, midWallPoint.Y, midWallPoint.Z), new Point(midWallPoint.X + doorWidth / 2, midWallPoint.Y, midWallPoint.Z), new Point(midWallPoint.X + doorWidth / 2, midWallPoint.Y, midWallPoint.Z + doorHeight), new Point(midWallPoint.X - doorWidth / 2, midWallPoint.Y, midWallPoint.Z + doorHeight) }; } InsertElements.InsertCutPlate(obj as ContourPlate, list, "PL100", "A36"); } catch { return(true); } } return(false); }
public void InsertWalls() { ArrayList basementPoints = new ArrayList { new Point(A.X - 50, A.Y - 50, A.Z - 50), new Point(B.X + 50, B.Y - 50, B.Z - 50), new Point(C.X + 50, C.Y + 50, C.Z - 50), new Point(D.X - 50, D.Y + 50, D.Z - 50), }; InsertElements.InsertPlate(basementPoints, "PL100", "A36"); InsertElements.InsertPlate(A, B, B1, A1, "PL100", "A36"); InsertElements.InsertPlate(B, C, C1, B1, "PL100", "A36"); InsertElements.InsertPlate(D, C, C1, D1, "PL100", "A36"); InsertElements.InsertPlate(A, D, D1, A1, "PL100", "A36"); InsertElements.InsertBeam(new Point(A.X + 150, A.Y + 150, A.Z), new Point(A1.X + 150, A1.Y + 150, A1.Z), "L203X203X28.6", "350W", Position.RotationEnum.BELOW); InsertElements.InsertBeam(new Point(B.X - 150, B.Y + 150, B.Z), new Point(B1.X - 150, B1.Y + 150, B1.Z), "L203X203X28.6", "350W", Position.RotationEnum.FRONT); InsertElements.InsertBeam(new Point(C.X - 150, C.Y - 150, C.Z), new Point(C1.X - 150, C1.Y - 150, C1.Z), "L203X203X28.6", "350W", Position.RotationEnum.TOP); InsertElements.InsertBeam(new Point(D.X + 150, D.Y - 150, D.Z), new Point(D1.X + 150, D1.Y - 150, D1.Z), "L203X203X28.6", "350W", Position.RotationEnum.BACK); }