public static void GenrateLoads(HndzFrameSingleBay3D hndzFrame) { CustomerInputs inputs = new CustomerInputs(); inputs.Width = hndzFrame.Width / 1000; inputs.Length = hndzFrame.Length / 1000; inputs.NoFrames = hndzFrame.FramesCount; inputs.BaySpacing = hndzFrame.BaySpacing / 1000; inputs.EaveHeight = hndzFrame.EaveHeight / 1000; inputs.RoofSlope = hndzFrame.RoofSlope; inputs.ExposureCategory = (ExposureCategory)hndzFrame.ExposureCategory; inputs.RiskCategory = (RiskCategory)hndzFrame.RiskCategory; inputs.RoofAccessibility = hndzFrame.RoofAccessibility; double roofSlope; switch (inputs.RoofSlope) { case HndzRoofSlopeEnum.From1To5: roofSlope = 0.2; break; case HndzRoofSlopeEnum.From1To10: roofSlope = 0.1; break; case HndzRoofSlopeEnum.From1To20: roofSlope = 0.05; break; default: roofSlope = 0.1; break; } CoverLoad = 0.01 * inputs.BaySpacing; LiveLoad = 0.057 * inputs.BaySpacing; double WL_1, WL_2, WL_3, WL_4, WL_1N, WL_2N, WL_3N, WL_4N, WL_1_B, WL_2_B, WL_1_BN, WL_2_BN; int windSpeed; switch (inputs.Location) { case HndzLocationEnum.Cairo: windSpeed = 130; break; case HndzLocationEnum.Alexandria: windSpeed = 90; break; case HndzLocationEnum.Matrouh: windSpeed = 130; break; case HndzLocationEnum.Aswan: windSpeed = 130; break; case HndzLocationEnum.Sinai: windSpeed = 130; break; default: windSpeed = 130; break; } ASCE107Wind.LoadParameters(windSpeed, (RiskCategory)inputs.RiskCategory, (ExposureCategory)inputs.ExposureCategory, (float)inputs.RidgeHeight / 1000, (float)inputs.EaveHeight, (float)inputs.Length, (float)inputs.Width, RoofType.Gable, 1, 0.85f, true, false); //TODO: Make it not hard coded //Check_1 = txt_Check_1.Text; //Check_2 = txt_Check_2.Text; ASCE107Wind.netPositivePressureA.TryGetValue("Wall Zone 1", out WL_1); ASCE107Wind.netPositivePressureA.TryGetValue("Roof Zone 2", out WL_2); ASCE107Wind.netPositivePressureA.TryGetValue("Roof Zone 3", out WL_3); ASCE107Wind.netPositivePressureA.TryGetValue("Wall Zone 4", out WL_4); ASCE107Wind.netNegativePressureA.TryGetValue("Wall Zone 1", out WL_1N); ASCE107Wind.netNegativePressureA.TryGetValue("Roof Zone 2", out WL_2N); ASCE107Wind.netNegativePressureA.TryGetValue("Roof Zone 3", out WL_3N); ASCE107Wind.netNegativePressureA.TryGetValue("Wall Zone 4", out WL_4N); ASCE107Wind.netPositivePressureB.TryGetValue("Roof Zone 2", out WL_1_B); ASCE107Wind.netPositivePressureB.TryGetValue("Wall Zone 5", out WL_2_B); ASCE107Wind.netNegativePressureB.TryGetValue("Roof Zone 2", out WL_1_BN); ASCE107Wind.netNegativePressureB.TryGetValue("Wall Zone 5", out WL_2_BN); //TODO: Temp conversion from kn to Ton .... till u implement units conversion WL_1 = WL_1 / 10; WL_2 = WL_2 / 10; WL_3 = WL_3 / 10; WL_4 = WL_4 / 10; WL_1N = WL_1N / 10; WL_2N = WL_2N / 10; WL_3N = WL_3N / 10; WL_4N = WL_4N / 10; WL_1_B = WL_1_B / 10; WL_2_B = WL_2_B / 10; WL_1_BN = WL_1_BN / 10; WL_2_BN = WL_2_BN / 10; }
public static bool GenerateFile(string File_Path, float DL, float CL, float LL, float Bay, float B_W, float B_L, float E_HT, float R_HT, RoofType Roof_Type, float WindSpeed, float TopoFactor, float DirectFator, RiskCategory RiskCategory, ExposureCategory ExposureCategory, bool IsEnclosed, bool IsHuricane) { double WL_1, WL_2, WL_3, WL_4, WL_1N, WL_2N, WL_3N, WL_4N, WL_1_B, WL_2_B, WL_1_BN, WL_2_BN; ASCE107Wind.LoadParameters(WindSpeed, RiskCategory, ExposureCategory, R_HT, E_HT, B_L, B_W, Roof_Type, TopoFactor, DirectFator, IsEnclosed, IsHuricane); //Check_1 = txt_Check_1.Text; //Check_2 = txt_Check_2.Text; ASCE107Wind.netPositivePressureA.TryGetValue("Wall Zone 1", out WL_1); ASCE107Wind.netPositivePressureA.TryGetValue("Roof Zone 2", out WL_2); ASCE107Wind.netPositivePressureA.TryGetValue("Roof Zone 3", out WL_3); ASCE107Wind.netPositivePressureA.TryGetValue("Wall Zone 4", out WL_4); ASCE107Wind.netNegativePressureA.TryGetValue("Wall Zone 1", out WL_1N); ASCE107Wind.netNegativePressureA.TryGetValue("Roof Zone 2", out WL_2N); ASCE107Wind.netNegativePressureA.TryGetValue("Roof Zone 3", out WL_3N); ASCE107Wind.netNegativePressureA.TryGetValue("Wall Zone 4", out WL_4N); ASCE107Wind.netPositivePressureB.TryGetValue("Roof Zone 2", out WL_1_B); ASCE107Wind.netPositivePressureB.TryGetValue("Wall Zone 5", out WL_2_B); ASCE107Wind.netNegativePressureB.TryGetValue("Roof Zone 2", out WL_1_BN); ASCE107Wind.netNegativePressureB.TryGetValue("Wall Zone 5", out WL_2_BN); if (IsLowRise(B_L, B_W)) { StreamWriter Writer = new StreamWriter(File_Path.ToString()); Writer.WriteLine("STAAD PLANE"); Writer.WriteLine("INPUT WIDTH 79"); Writer.WriteLine("UNIT METER KN"); Writer.WriteLine("JOINT COORDINATES"); Writer.WriteLine("1 0 0"); Writer.WriteLine("2 0 " + E_HT); //Marks Edit if (Roof_Type == RoofType.Gable) { Writer.WriteLine("3 " + B_W / 2 + " " + R_HT); Writer.WriteLine("4 " + B_W + " " + E_HT); } else if (Roof_Type == RoofType.Monoslope) { Writer.WriteLine("3 " + B_W / 2 + " " + (R_HT + E_HT) / 2); Writer.WriteLine("4 " + B_W + " " + R_HT); } // Writer.WriteLine("3 " + B_W/2 + " " + R_HT); // Writer.WriteLine("4" + B_W + " " + E_HT); Writer.WriteLine("5 " + B_W + " " + "0" + "\n"); Writer.WriteLine("MEMBER INCIDENCES"); Writer.WriteLine("1 2 1"); Writer.WriteLine("2 2 3"); Writer.WriteLine("3 4 3"); Writer.WriteLine("4 4 5"); Writer.WriteLine("DEFINE MATERIAL START"); Writer.WriteLine("ISOTROPIC STEEL"); Writer.WriteLine("E 205000000"); Writer.WriteLine("Poisson 0.3"); Writer.WriteLine("DENSITY 76.8195"); Writer.WriteLine("ALPHA 0.000012"); Writer.WriteLine("DAMP 0.03"); Writer.WriteLine("END DEFINE MATERIAL"); Writer.WriteLine("UNIT MMS KN"); Writer.WriteLine("MEMBER PROPERTY AMERICAN"); Writer.WriteLine("1 TAPERED 770 5 270 200 10 200 10"); Writer.WriteLine("2 TAPERED 770 5 520 175 10 175 10"); Writer.WriteLine("3 TAPERED 770 5 520 175 10 175 10"); Writer.WriteLine("4 TAPERED 770 5 270 200 10 200 10"); Writer.WriteLine("UNIT METER KN"); Writer.WriteLine("CONSTANTS"); Writer.WriteLine("MATERIAL STEEL ALL"); Writer.WriteLine("SUPPORTS"); Writer.WriteLine("1 5 " + "PINNED"); Writer.WriteLine("LOAD 1 LOADTYPE None TITLE DL"); Writer.WriteLine("SELFWEIGHT Y -1"); Writer.WriteLine("MEMBER Load"); Writer.WriteLine("1 2 3 4 UNI GY " + (DL * Bay * (-1))); Writer.WriteLine("LOAD 2 LOADTYPE None TITLE CL"); Writer.WriteLine("MEMBER Load"); Writer.WriteLine("2 3 UNI GY " + (CL * Bay * (-1))); Writer.WriteLine("LOAD 3 LOADTYPE None TITLE LL"); Writer.WriteLine("MEMBER Load"); Writer.WriteLine("2 3 UNI GY " + (LL * Bay * (-1))); Writer.WriteLine("******** WIND LOAD CASES"); Writer.WriteLine("LOAD 4 LOADTYPE None TITLE WLB"); Writer.WriteLine("MEMBER Load"); if (WL_1 < 0) { Writer.WriteLine("1 UNI GX " + (Math.Abs(WL_1) * Bay * (-1))); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_1) * Bay); } if (WL_2 < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_2) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_2) * Bay * (-1)); } if (WL_3 < 0) { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_3) * Bay); } else { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_3) * Bay * (-1)); } if (WL_4 < 0) { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_4) * Bay); } else { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_4) * Bay * (-1)); } Writer.WriteLine("LOAD 5 LOADTYPE None TITLE WLU"); Writer.WriteLine("MEMBER Load"); if (WL_1N < 0) { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_1N) * Bay * (-1)); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_1N) * Bay); } if (WL_2N < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_2N) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_2N) * Bay * (-1)); } if (WL_3N < 0) { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_3N) * Bay); } else { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_3N) * Bay * (-1)); } if (WL_4N < 0) { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_4N) * Bay); } else { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_4N) * Bay * (-1)); } Writer.WriteLine("LOAD 6 LOADTYPE None TITLE WRB"); Writer.WriteLine("MEMBER Load"); if (WL_4 < 0) { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_4) * (-1) * Bay); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_4) * Bay); } if (WL_3 < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_3) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_3) * Bay * (-1)); } if (WL_2 < 0) { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_2) * Bay); } else { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_2) * Bay * (-1)); } if (WL_1 < 0) { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_1) * Bay); } else { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_1) * Bay * (-1)); } Writer.WriteLine("LOAD 7 LOADTYPE None TITLE WRU"); Writer.WriteLine("MEMBER Load"); if (WL_4N < 0) { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_4N) * (-1) * Bay); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_4N) * Bay); } if (WL_3N < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_3N) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_3N) * Bay * (-1)); } if (WL_2N < 0) { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_2N) * Bay); } else { Writer.WriteLine("3 UNI Y " + Math.Abs(WL_2N) * Bay * (-1)); } if (WL_1N < 0) { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_1N) * Bay); } else { Writer.WriteLine("4 UNI GX " + Math.Abs(WL_1N) * Bay * (-1)); } Writer.WriteLine("MEMBER Load"); Writer.WriteLine("LOAD 8 LOADTYPE None TITLE WEB"); Writer.WriteLine("MEMBER Load"); if (WL_2_B < 0) { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_2_B) * (-1) * Bay); Writer.WriteLine("4 UNI GX " + Math.Abs(WL_2_B) * Bay); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_2_B) * Bay); Writer.WriteLine("4 UNI GX " + Math.Abs(WL_2_B) * Bay * (-1)); } if (WL_1_B < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_1_B) * Bay); Writer.WriteLine("3 UNI Y " + Math.Abs(WL_1_B) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_1_B) * Bay * (-1)); Writer.WriteLine("3 UNI Y " + Math.Abs(WL_1_B) * Bay * (-1)); } Writer.WriteLine("LOAD 9 LOADTYPE None TITLE WEU"); Writer.WriteLine("MEMBER Load"); if (WL_2_BN < 0) { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_2_BN) * (-1) * Bay); Writer.WriteLine("4 UNI GX " + Math.Abs(WL_2_BN) * Bay); } else { Writer.WriteLine("1 UNI GX " + Math.Abs(WL_2_BN) * Bay); Writer.WriteLine("4 UNI GX " + Math.Abs(WL_2_BN) * Bay * (-1)); } if (WL_1_BN < 0) { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_1_BN) * Bay); Writer.WriteLine("3 UNI Y " + Math.Abs(WL_1_BN) * Bay); } else { Writer.WriteLine("2 UNI Y " + Math.Abs(WL_1_BN) * Bay * (-1)); Writer.WriteLine("3 UNI Y " + Math.Abs(WL_1_BN) * Bay * (-1)); } Writer.WriteLine("LOAD COMB 1000 DL+LL"); Writer.WriteLine("1 1.0 3 1.0"); Writer.WriteLine("LOAD COMB 1001 DL+CL"); Writer.WriteLine("1 1.0 2 1.0"); Writer.WriteLine("LOAD COMB 1002 DL+CL+LL"); Writer.WriteLine("1 1.0 2 1.0 3 1.0"); Writer.WriteLine("LOAD COMB 1003 DL+WLB"); Writer.WriteLine("1 1.0 4 1.0"); Writer.WriteLine("LOAD COMB 1004 DL+WLU"); Writer.WriteLine("1 1.0 5 1.0"); Writer.WriteLine("LOAD COMB 1005 DL+WRB"); Writer.WriteLine("1 1.0 6 1.0"); Writer.WriteLine("LOAD COMB 1006 DL+WRU"); Writer.WriteLine("1 1.0 7 1.0"); Writer.WriteLine("LOAD COMB 1007 DL+WEB"); Writer.WriteLine("1 1.0 8 1.0"); Writer.WriteLine("LOAD COMB 1008 DL+WEU"); Writer.WriteLine("1 1.0 9 1.0"); Writer.WriteLine("LOAD COMB 1009 DL+CL+WLB"); Writer.WriteLine("1 1.0 2 1.0 4 1.0"); Writer.WriteLine("LOAD COMB 1010 DL+CL+WLU"); Writer.WriteLine("1 1.0 2 1.0 5 1.0"); Writer.WriteLine("LOAD COMB 1011 DL+CL+WRB"); Writer.WriteLine("1 1.0 2 1.0 6 1.0"); Writer.WriteLine("LOAD COMB 1012 DL+CL+WRU"); Writer.WriteLine("1 1.0 2 1.0 7 1.0"); Writer.WriteLine("LOAD COMB 1013 DL+CL+WEB"); Writer.WriteLine("1 1.0 2 1.0 8 1.0"); Writer.WriteLine("LOAD COMB 1014 DL+CL+WEU"); Writer.WriteLine("1 1.0 2 1.0 9 1.0"); Writer.WriteLine("PERFORM ANALYSIS PRINT ALL"); Writer.WriteLine("LOAD LIST 1000 TO 1014"); Writer.WriteLine("Parameter 1"); Writer.WriteLine("CODE AISC UNIFIED 2005"); Writer.WriteLine("Method ASD"); Writer.WriteLine("FYLD 345000 ALL"); Writer.WriteLine("BEAM 1 ALL"); Writer.WriteLine("*TRACK 2 ALL"); Writer.WriteLine("CB 0 ALL"); Writer.WriteLine("****LZ,KZ"); Writer.WriteLine("KZ 1.5 MEMB 1 4"); Writer.WriteLine("LZ " + B_W + " MEMB 2 3"); Writer.WriteLine("KY 1.0 MEMB 1 4"); Writer.WriteLine("LY 1.5 MEMB 2 3"); Writer.WriteLine("UNB " + E_HT + " MEMB 1 4"); Writer.WriteLine("UNB 1.5 MEMB 2 3"); Writer.WriteLine("UNT " + E_HT + " MEMB 1 4"); Writer.WriteLine("UNT 1.5 MEMB 2 3"); Writer.WriteLine("****************************** CHECK CODE AND WEIGHT"); Writer.WriteLine("CHECK CODE ALL"); Writer.WriteLine("UNIT METER KG"); Writer.WriteLine("STEEL TAKE OFF ALL"); Writer.WriteLine("FINISH"); Writer.Close(); return(true); //return MessageBox.Show("STAAD FILE IS GENERATED AND SAVED SUCCESSFULLY"); } else { return(false); //return MessageBox.Show("Building is NOT Low Rise"); } }