public void addEload(ElementLoad eload) { UniformlyDistLoad line = eload as UniformlyDistLoad; StrainLoad strain = eload as StrainLoad; TemperatureLoad temp = eload as TemperatureLoad; Imperfection imperfection = eload as Imperfection; if (line != null) { _eloads_table.Rows.Add("Line", eload.beamIds, line, strain, temp, imperfection, eload.loadcase); } if (strain != null) { _eloads_table.Rows.Add("Strain", eload.beamIds, line, strain, temp, imperfection, eload.loadcase); } if (temp != null) { _eloads_table.Rows.Add("Temp", eload.beamIds, line, strain, temp, imperfection, eload.loadcase); } if (imperfection != null) { _eloads_table.Rows.Add("Imperfection", eload.beamIds, line, strain, temp, imperfection, eload.loadcase); } }
public void convertLoads() { DataTable dt = new DataTable(); dt.Merge(_ploads_table); dt.Merge(_eloads_table); dt.Merge(_mloads_table); dt.Merge(_gloads_table); DataView sortedToLC = new DataView(dt); sortedToLC.Sort = "Loadcase"; DataTable loads = sortedToLC.ToTable(); DataTable lcIndexTable = sortedToLC.ToTable(true, "Loadcase"); List <int> lcIndexes = new List <int>(); foreach (DataRow row in lcIndexTable.Rows) { lcIndexes.Add((int)row["Loadcase"]); if (lcIndexes.Contains(0)) { _log.Append("Make sure that loadcase > 0. Sofistik starts at 1."); _warnings.Add("Make sure that loadcase > 0. Sofistik starts at 1."); } } foreach (int lc in lcIndexes) { string initLC = "\nLC NO " + lc; addInstruction(initLC); foreach (DataRow row in loads.Rows) { if ((int)row["Loadcase"] == lc) { switch ((string)row["Type"]) { case "Gravity": double gforce = (double)row["Gravity_Force"]; _product.Replace(initLC, "\nLC NO " + lc + " DLZ " + gforce + " TITL 'Self-weight'"); break; case "Point": bool nodeValid = _node_inst.TryGetValue((int)row["NodeInd"], out int nodeId); Vector3d force = (Vector3d)row["Force"]; if (nodeValid) { addInstruction("NODE NO " + nodeId + " TYPE PP P1 " + Math.Round(force.X, 3) + " P2 " + Math.Round(force.Y, 3) + " P3 " + Math.Round(force.Z, 3)); } else { _warnings.Add("Node not found for point load"); } break; case "Line": List <int> elems = new List <int>(); UniformlyDistLoad distLoad = (UniformlyDistLoad)row["LineLoad"]; string load_type = ""; int orientation = (int)distLoad.q_orient; foreach (string beamId in (List <string>)row["BeamIds"]) { Int32.TryParse(beamId, out int j); bool elemValid = _elem_inst.TryGetValue(j, out int elem); if (elemValid) { if (orientation == 0) { load_type = "PX,PY,PZ"; } else if (orientation == 2) { load_type = "PXP,PYP,PZP"; } else { load_type = "PXX,PYY,PZZ"; } addInstruction("BEAM " + beamId + " TYPE " + load_type + " PA " + Math.Round(distLoad.Load.X, 3) + "," + Math.Round(distLoad.Load.Y, 3) + "," + Math.Round(distLoad.Load.Z, 3)); } else { _warnings.Add("Beam Ids for line-loads not valid"); } } break; case "Strain": _log.Append("Strain loads are not supported (yet)."); _warnings.Add("Strain loads are not supported (yet)."); break; case "Temp": _log.Append("Temperature loads are not supported (yet)."); _warnings.Add("Temperature loads are not supported (yet)."); break; } } } } }