public NodalForce(double fx, double fy, double mz, LoadPattern loadPattern) { Fx = fx; Fy = fy; Mz = mz; LoadPattern = loadPattern; }
/// <summary> /// Sets the named sets database tables 2 selections. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> private static void setNAMED_SETS_DATABASE_TABLES_2_SELECTIONS(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { TableSet tableSet = model.OutputSettings.FillItem(tableRow["DBNamedSet"]); switch (tableRow["SelectType"]) { case "Table": tableSet.TableNames.Add(tableRow["Selection"]); break; case "LoadPattern": LoadPattern loadPattern = model.Loading.Patterns.FillItem(tableRow["Selection"]); tableSet.LoadPatterns.Add(loadPattern); break; case "LoadCase": LoadCase loadCase = model.Loading.Cases.FillItem(tableRow["Selection"]); tableSet.LoadCases.Add(loadCase); break; case "Combo": LoadCombination loadCombo = model.Loading.Combinations.FillItem(tableRow["Selection"]); tableSet.LoadCombinations.Add(loadCombo); break; } } }
/// <summary> /// Returns the load data for the specified load case. /// </summary> /// <param name="app">The application.</param> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> protected void fillLoads(ILoadTimeHistory app) { if (app == null) { return; } app.GetLoads(Name, out var loadTypes, out var loadNames, out var loadFunctions, out var scaleFactor, out var timeFactor, out var arrivalTime, out var coordinateSystems, out var angles); _loads = new LoadsTimeHistory(); for (int i = 0; i < loadTypes.Length; i++) { LoadTimeHistory loadTimeHistory = new LoadTimeHistory() { LoadType = loadTypes[i], Load = LoadPattern.Factory(_apiApp, loadNames[i]), Function = loadFunctions[i], ScaleFactor = scaleFactor[i], TimeFactor = timeFactor[i], ArrivalTime = arrivalTime[i], CoordinateSystem = coordinateSystems[i], Angle = angles[i], }; Loads.Add(loadTimeHistory); } }
public NodalStress(double sigmaX, double sigmaY, double sigmaXy, LoadPattern loadPattern) { Sigma_x = sigmaX; Sigma_y = sigmaY; Sigma_xy = sigmaXy; LoadPattern = loadPattern; }
public virtual T SuperimposeResponsesAtLoadCase(LoadCase loadCase) { T superimposedResult = new T(); superimposedResult.ElementId = ElementId; superimposedResult.LoadPattern = LoadPattern.Mixed; superimposedResult.LoadCase = loadCase; if (Count == 0) { return(superimposedResult); } Dictionary <LoadPattern, double> loadPatternFactors = GetLoadPatternFactors(loadCase); foreach (T item in this) { LoadPattern loadPattern = item.LoadPattern; if (!loadPatternFactors.ContainsKey(loadPattern)) { continue; } superimposedResult = superimposedResult.Superimpose(item.ApplyLoadFactor(loadPatternFactors[loadPattern])); } return(superimposedResult); }
public AreaLoad(Polygon2D boundary, BuildingLevel level, Projection projection, LoadPattern loadPattern) { Boundary = boundary; Level = level; Projection = projection; LoadPattern = loadPattern; }
//constructor for PointLoads internal Load(LoadPattern loadPat, int myType, int dir, double dist, double val, string cSys, bool relDist) { lPattern = loadPat; FMType = myType; Dir = dir; Dist = dist; Val = val; CSys = cSys; RelDist = relDist; }
internal static Dictionary <string, LoadCase> ReadASCE7Cases() { string executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(executingPath, @"Common\ASCE7LoadCases.csv"); List <string[]> rows = XFile.ReadCSV(path, true, out _, false); var cases = new Dictionary <string, LoadCase>(StringComparer.InvariantCultureIgnoreCase); foreach (string[] row in rows) { var description = row[0]; var predominantDirection = (PredominantDirection)Enum.Parse(typeof(PredominantDirection), row[1]); var loadPatterns = new List <FactoredLoadPattern>(); for (var i = 2; i < row.Length; i += 2) { var hasData = double.TryParse(row[i], out var factor); if (!hasData) { break; } LoadPattern pattern = row[i + 1].GetEnumFromDescription <LoadPattern>(); loadPatterns.Add(new FactoredLoadPattern { Factor = factor, Pattern = pattern }); } cases.Add(description, new LoadCase(description, loadPatterns, predominantDirection)); } return(cases); }
/// <summary> /// Returns the load data for the analysis case. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void FillLoads() { if (_app == null) { return; } _app.GetLoads(CaseName, out var loadTypes, out var loadNames, out var scaleFactors); for (int i = 0; i < loadTypes.Length; i++) { LoadPatternTuple load = new LoadPatternTuple() { Load = LoadPattern.Factory(loadNames[i]), ScaleFactor = scaleFactors[i], LoadType = loadTypes[i] }; Loads.Add(load); } }
public InternalPointLoad3D(Point3D location, Vector3D forces, Vector3D moments, AnalyticalElement source, LoadPattern loadPattern) : base(location, forces, moments, loadPattern) { _source = source; }
internal static void StructuralModelFromSapFile(ref cSapModel SapModel, ref StructuralModel model, string SapModelUnits) { model.StructuralElements = new List <Element>(); model.ModelDefinitions = new List <Definition>(); List <LoadPattern> TempLPatterns = new List <LoadPattern>(); string error = string.Empty; if (SapModel != null) { // 1.a GET LOAD PATTERNS string[] LoadPatternNames = null; string[] LoadPatternTypes = null; double[] LoadPatternMultipliers = null; StructureMapper.GetLoadPatterns(ref SapModel, ref LoadPatternNames, ref LoadPatternTypes, ref LoadPatternMultipliers); if (LoadPatternNames != null) { foreach (string lpname in LoadPatternNames) { int pos = Array.IndexOf(LoadPatternNames, lpname); LoadPattern lp = new LoadPattern(lpname, LoadPatternTypes[pos], LoadPatternMultipliers[pos]); model.ModelDefinitions.Add(lp); TempLPatterns.Add(lp); } } // 1.b GET LOAD CASES string[] LoadCasesNames = null; string[] LoadCasesTypes = null; double[] LoadCasesMultipliers = null; //With this method we only get the name and the type of each load case StructureMapper.GetLoadCases(ref SapModel, ref LoadCasesNames, ref LoadCasesMultipliers, ref LoadCasesTypes); if (LoadCasesNames != null) { foreach (string lcname in LoadCasesNames) { int pos = Array.IndexOf(LoadCasesNames, lcname); //create a new load LoadCase lc = new LoadCase(); lc.name = lcname; lc.type = LoadCasesTypes[pos]; model.ModelDefinitions.Add(lc); } } //1.c GET LOAD COMBOS string[] LoadCombosNames = null; string[][] LoadCombosTypes = null; string[][] LoadCombosCases = null; string[][] LoadCombosDefinitions = null; double[][] LoadCombosMultipliers = null; StructureMapper.GetLoadCombos(ref SapModel, ref LoadCombosNames, ref LoadCombosTypes, ref LoadCombosCases, ref LoadCombosMultipliers, ref LoadCombosDefinitions); if (LoadCombosNames != null) { foreach (string lcname in LoadCombosNames) { int pos = Array.IndexOf(LoadCombosNames, lcname); List <Definition> LoadDefinitions = new List <Definition>(); foreach (string comboType in LoadCombosTypes[pos]) { int pos2 = Array.IndexOf(LoadCombosTypes[pos], comboType); Definition def = new Definition(); if (comboType == "LoadCase") { //find the existing Load Case foreach (Definition d in model.ModelDefinitions) { if (d.Type == Definitions.Type.LoadCase) { if (((LoadCase)d).name == LoadCombosDefinitions[pos][pos2]) { def = d; } } } } else { def.Type = Definitions.Type.LoadCombo; ((LoadCombo)def).name = comboType; } LoadDefinitions.Add(def); } //create a new load combo LoadCombo loadcombo = new LoadCombo(lcname, LoadCombosTypes[pos][0], LoadDefinitions, LoadCombosMultipliers[pos].ToList()); model.ModelDefinitions.Add(loadcombo); } } // 2. GET DYNAMO FRAMES ( get Loads and Releases that are assigned to that frame) //2.a GET LOADS that are Assigned to Frames Dictionary <int, string> DictFrm_PointLoads = new Dictionary <int, string>(); Dictionary <int, string> DictFrm_DistLoads = new Dictionary <int, string>(); //Get Point Loads string[] framesWithPointLoads = null; string[] PlPattern = null; int Pnumber = 0; int[] PmyType = null; string[] PCsys = null; int[] Pdir = null; double[] PRelDist = null; double[] PDist = null; double[] PVal = null; LoadMapper.GetPointLoads(ref SapModel, ref framesWithPointLoads, ref Pnumber, ref PlPattern, ref PmyType, ref PCsys, ref Pdir, ref PRelDist, ref PDist, ref PVal); if (framesWithPointLoads != null) { for (int i = 0; i < framesWithPointLoads.Count(); i++) { DictFrm_PointLoads.Add(i, framesWithPointLoads[i]); } } // Get Distributed Loads string[] framesWithDistributedLoads = null; string[] DlPattern = null; int Dnumber = 0; int[] DmyType = null; string[] DCsys = null; int[] Ddir = null; double[] DRD1 = null; double[] DRD2 = null; double[] DDist1 = null; double[] DDist2 = null; double[] DVal1 = null; double[] DVal2 = null; LoadMapper.GetDistributedLoads(ref SapModel, ref framesWithDistributedLoads, ref Dnumber, ref DlPattern, ref DmyType, ref DCsys, ref Ddir, ref DRD1, ref DRD2, ref DDist1, ref DDist2, ref DVal1, ref DVal2); if (framesWithDistributedLoads != null) { for (int i = 0; i < framesWithDistributedLoads.Count(); i++) { DictFrm_DistLoads.Add(i, framesWithDistributedLoads[i]); } } //2.b Get Frames // Calculate Length Scale Factor //Double SF = Utilities.UnitConversion("m", SapModelUnits); // Dynamo API Lenght Unit is 'meter' Double SF = 1; List <string> FrmIds = new List <string>(); StructureMapper.GetSAPFrameList(ref SapModel, ref FrmIds); for (int i = 0; i < FrmIds.Count; i++) { Point s = null; Point e = null; string matProp = "A992Fy50"; // default value string secName = "W12X14"; // default value string secCatalog = "AISC14"; // default value string Just = "MiddleCenter"; // default value double Rot = 0; // default value StructureMapper.GetFrm(ref SapModel, FrmIds[i], ref s, ref e, ref matProp, ref secName, ref Just, ref Rot, ref secCatalog, SF); SectionProp secProp = new SectionProp(secName, matProp, secCatalog); Frame d_frm = new Frame(s, e, secProp, Just, Rot); d_frm.Label = FrmIds[i]; model.StructuralElements.Add(d_frm); //LOADS // Frame might have multiple loads assigned to it... d_frm.Loads = new List <Load>(); //Check if the frame has distributed loads var outindexes = from obj in DictFrm_DistLoads where obj.Value == d_frm.Label select obj.Key; foreach (int index in outindexes) { LoadPattern Dlp = null; foreach (LoadPattern loadp in TempLPatterns) { if (loadp.name == DlPattern[index]) { Dlp = loadp; break; } } if (Dlp != null) { // using relDist as true, and using the relative distance values DRD1 and DRD2 bool relDist = true; Load l = new Load(Dlp, DmyType[index], Ddir[index], DRD1[index], DRD2[index], DVal1[index], DVal2[index], DCsys[index], relDist); l.LoadType = "DistributedLoad"; d_frm.Loads.Add(l); } } //Check if the frame has Point Loads var outindexesO = from obj in DictFrm_PointLoads where obj.Value == d_frm.Label select obj.Key; foreach (int index in outindexesO) { LoadPattern Plp = null; foreach (LoadPattern loadp in TempLPatterns) { if (loadp.name == PlPattern[index]) { Plp = loadp; break; } } if (Plp != null) { bool relativedist = true; Load l = new Load(Plp, PmyType[index], Pdir[index], PRelDist[index], PVal[index], PCsys[index], relativedist); l.LoadType = "PointLoad"; d_frm.Loads.Add(l); } } //RELEASES bool[] ii = new bool[6]; bool[] jj = new bool[6]; ReleaseMapper.Get(ref SapModel, FrmIds[i], ref ii, ref jj); // Populate if return releases if (ii.Contains(true) || jj.Contains(true)) { d_frm.Releases = Release.Set(ii[0], jj[0] , ii[1], jj[1] , ii[2], jj[2] , ii[3], jj[3] , ii[4], jj[4] , ii[5], jj[5]); } } // 2.b Get Shells from SAP Model List <string> AreaIds = new List <string>(); SAPConnection.StructureMapper.GetSAPAreaList(ref SapModel, ref AreaIds); for (int i = 0; i < AreaIds.Count; i++) { Surface S = null; string propName = string.Empty; SAPConnection.StructureMapper.GetShell(ref SapModel, AreaIds[i], ref S, SF, ref propName); int ShellType = 1; bool DOF = true; string MatProp = string.Empty; double MatAngle = 0; double Thickness = 0; double Bending = 0; SAPConnection.StructureMapper.GetShellProp(ref SapModel, propName, ref ShellType, ref DOF, ref MatProp, ref MatAngle, ref Thickness, ref Bending); ShellProp sP = new ShellProp(propName, ShellType, DOF, MatProp, MatAngle, Thickness * SF, Bending); Shell d_Shell = new Shell(S, sP); d_Shell.Label = AreaIds[i]; model.StructuralElements.Add(d_Shell); } // 3. GET RESTRAINTS int CountRes = RestraintMapper.Count(ref SapModel); if (CountRes > 0) { List <string> PtIds = new List <string>(); RestraintMapper.GetSupportedPts(ref SapModel, ref PtIds); // Populate Dynamo Restraints foreach (var PtId in PtIds) { Point Pti = null; bool[] restraints = new bool[6]; RestraintMapper.Get(ref SapModel, PtId, ref Pti, ref restraints, SF); Joint myj = new Joint(Pti); myj.Label = PtId; // Populate on Joint Restraints Restraint support = Restraint.Define(restraints[0], restraints[1], restraints[2], restraints[3], restraints[4], restraints[5]); myj.JointRestraint = support; model.StructuralElements.Add(myj); } } } else { throw new Exception("Make sure SAP Model is open!"); } // Get Groups List <String> SapGroups = new List <string>(); SAPConnection.GroupMapper.GetSAPGroupList(ref SapModel, ref SapGroups); int counter = 0; foreach (var g in SapGroups) { Group myG = new Group(); myG.Name = g; myG.GroupElements = new List <Element>(); // get assignments int[] types = null; string[] Labels = null; SAPConnection.GroupMapper.GetGroupAssignments(ref SapModel, g, ref types, ref Labels); if (Labels != null && Labels.Count() > 0) { for (int i = 0; i < Labels.Length; i++) { if (types[i] == 1) // Joint { try { var gel = (from el in model.StructuralElements where el.Label == Labels[i] && el.Type == Structure.Type.Joint select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } catch (Exception) { } } else if (types[i] == 2) // frame { try { var gel = (from el in model.StructuralElements where el.Type == Structure.Type.Frame && el.Label == Labels[i] select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } catch (Exception) { } } else if (types[i] == 3) // cable { //TODO: After cable object defined } else if (types[i] == 5) // shell { var gel = (from el in model.StructuralElements where el.Type == Structure.Type.Shell && el.Label == Labels[i] select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } } } else { counter++; } //Add to Model definitions model.ModelDefinitions.Add(myG); } if (counter == SapGroups.Count) { //throw new Exception("The group(s) have no members assigned"); } }
public LoadMediasJob(LoadPattern pattern) : this() { this.Pattern = pattern; }
public static LoadPatternType Convert(LoadPattern loadPattern) { switch (loadPattern) { case LoadPattern.Dead: return(LoadPatternType.SelfDead); case LoadPattern.SuperDead: return(LoadPatternType.SuperimposedDead); case LoadPattern.Live_Down: case LoadPattern.Live_Up: case LoadPattern.LiveUnreducible_Down: case LoadPattern.LiveUnreducible_Up: case LoadPattern.LiveHeavy_Down: case LoadPattern.LiveHeavy_Up: return(LoadPatternType.Live); case LoadPattern.LiveStorage_Down: case LoadPattern.LiveStorage_Up: return(LoadPatternType.LiveStorage); case LoadPattern.LiveRoof_Down: case LoadPattern.LiveRoof_Up: return(LoadPatternType.LiveRoof); case LoadPattern.LiveConstruction_Down: case LoadPattern.LiveConstruction_Up: case LoadPattern.LiveParking_Down: case LoadPattern.LiveParking_Up: case LoadPattern.LivePartition_Down: case LoadPattern.LivePartition_Up: return(LoadPatternType.Live); case LoadPattern.SnowMinimum: case LoadPattern.SnowBalanced: case LoadPattern.SnowUnbalanced_North: case LoadPattern.SnowUnbalanced_South: case LoadPattern.SnowUnbalanced_East: case LoadPattern.SnowUnbalanced_West: case LoadPattern.SnowDrift_North: case LoadPattern.SnowDrift_South: case LoadPattern.SnowDrift_East: case LoadPattern.SnowDrift_West: return(LoadPatternType.Snow); case LoadPattern.Wind_North: case LoadPattern.Wind_South: case LoadPattern.Wind_East: case LoadPattern.Wind_West: case LoadPattern.WindTorsion_North: case LoadPattern.WindTorsion_South: case LoadPattern.WindTorsion_East: case LoadPattern.WindTorsion_West: return(LoadPatternType.Wind); case LoadPattern.Seismic_North: case LoadPattern.Seismic_South: case LoadPattern.Seismic_East: case LoadPattern.Seismic_West: case LoadPattern.SeismicTorsion_XLoading: case LoadPattern.SeismicTorsion_YLoading: return(LoadPatternType.Earthquake); case LoadPattern.SeismicDiaphragm_North: case LoadPattern.SeismicDiaphragm_South: case LoadPattern.SeismicDiaphragm_East: case LoadPattern.SeismicDiaphragm_West: return(LoadPatternType.Earthquake_Diaphragm); case LoadPattern.UnitLiveLoad: return(LoadPatternType.UnitLive); case LoadPattern.Mixed: return(LoadPatternType.Mixed); default: throw new ArgumentOutOfRangeException(nameof(loadPattern), loadPattern, null); } }
public UniformLineLoad(LineSegment2D line, double magnitude, BuildingLevel level, Projection projection, LoadPattern loadPattern) : base(line, magnitude, magnitude, level, projection, loadPattern) { }
/// <summary> /// Check that the definitions supplied are not duplicated /// </summary> /// <param name="definitions"></param> private static void CheckDuplicateDefinitions(List <Definition> definitions) { int errorcounter = 0; List <string> duplicates = new List <string>(); List <string> loadPatterns = new List <string>(); List <string> loadCases = new List <string>(); List <string> loadCombos = new List <string>(); List <string> Groups = new List <string>(); foreach (Definition d in definitions) { if (d.Type == Definitions.Type.LoadPattern) { LoadPattern lp = (LoadPattern)d; if (!loadPatterns.Contains(lp.name)) { loadPatterns.Add(lp.name); } else { errorcounter++; duplicates.Add("Load Pattern: " + lp.name); } } else if (d.Type == Definitions.Type.LoadCase) { LoadCase lc = (LoadCase)d; if (!loadCases.Contains(lc.name)) { loadCases.Add(lc.name); } else { errorcounter++; duplicates.Add("Load Case: " + lc.name); } } else if (d.Type == Definitions.Type.LoadCombo) { LoadCombo lc = (LoadCombo)d; if (!loadCombos.Contains(lc.name)) { loadCombos.Add(lc.name); } else { errorcounter++; duplicates.Add("Load Combo: " + lc.name); } } else if (d.Type == Definitions.Type.Group) { Group g = (Group)d; if (!Groups.Contains(g.Name)) { Groups.Add(g.Name); } else { errorcounter++; duplicates.Add("Group: " + g.Name); } } if (errorcounter > 0) { string errorMessage = "One or more definitions have been added twice: "; for (int i = 0; i < duplicates.Count; i++) { errorMessage += duplicates[i] + " "; } // pass this to the error log throw new Exception(errorMessage); } } }
public static LoadMediasJob Create(LoadPattern pattern) { return(new LoadMediasJob(pattern)); }
public LineLoad(LineSegment2D line, double startMagnitude, double endMagnitude, BuildingLevel level, Projection projection, LoadPattern loadPattern) : base(level, projection, loadPattern) { Line = line; MagnitudeStart = startMagnitude; MagnitudeEnd = endMagnitude; }
public NodalResponse(string elementId, LoadPattern loadPattern, Point2D coordinate, LoadCase loadCase = null) : base(elementId, loadPattern, loadCase) { Coordinate = coordinate; }
public Load(double mag, LoadPattern pattern) { Magnitude = mag; Pattern = pattern; }
protected SuperimposableResponse(string elementId, LoadPattern loadPattern, LoadCase loadCase) { ElementId = elementId; LoadPattern = loadPattern; LoadCase = loadCase; }
internal static void StructuralModelFromSapFile(ref cSapModel SapModel, ref StructuralModel model, string SapModelUnits) { model.StructuralElements = new List<Element>(); model.ModelDefinitions = new List<Definition>(); List<LoadPattern> TempLPatterns = new List<LoadPattern>(); string error = string.Empty; if (SapModel != null) { // 1.a GET LOAD PATTERNS string[] LoadPatternNames = null; string[] LoadPatternTypes = null; double[] LoadPatternMultipliers = null; StructureMapper.GetLoadPatterns(ref SapModel, ref LoadPatternNames, ref LoadPatternTypes, ref LoadPatternMultipliers); if (LoadPatternNames != null) { foreach (string lpname in LoadPatternNames) { int pos = Array.IndexOf(LoadPatternNames, lpname); LoadPattern lp = new LoadPattern(lpname, LoadPatternTypes[pos], LoadPatternMultipliers[pos]); model.ModelDefinitions.Add(lp); TempLPatterns.Add(lp); } } // 1.b GET LOAD CASES string[] LoadCasesNames = null; string[] LoadCasesTypes = null; double[] LoadCasesMultipliers = null; //With this method we only get the name and the type of each load case StructureMapper.GetLoadCases(ref SapModel, ref LoadCasesNames, ref LoadCasesMultipliers, ref LoadCasesTypes); if (LoadCasesNames != null) { foreach (string lcname in LoadCasesNames) { int pos = Array.IndexOf(LoadCasesNames, lcname); //create a new load LoadCase lc = new LoadCase(); lc.name = lcname; lc.type = LoadCasesTypes[pos]; model.ModelDefinitions.Add(lc); } } //1.c GET LOAD COMBOS string[] LoadCombosNames = null; string[][] LoadCombosTypes = null; string[][] LoadCombosCases = null; string[][] LoadCombosDefinitions = null; double[][] LoadCombosMultipliers = null; StructureMapper.GetLoadCombos(ref SapModel, ref LoadCombosNames, ref LoadCombosTypes, ref LoadCombosCases, ref LoadCombosMultipliers, ref LoadCombosDefinitions); if (LoadCombosNames != null) { foreach (string lcname in LoadCombosNames) { int pos = Array.IndexOf(LoadCombosNames, lcname); List<Definition> LoadDefinitions = new List<Definition>(); foreach (string comboType in LoadCombosTypes[pos]) { int pos2 = Array.IndexOf(LoadCombosTypes[pos], comboType); Definition def = new Definition(); if (comboType == "LoadCase") { //find the existing Load Case foreach (Definition d in model.ModelDefinitions) { if (d.Type == Definitions.Type.LoadCase) { if (((LoadCase)d).name == LoadCombosDefinitions[pos][pos2]) { def = d; } } } } else { def.Type = Definitions.Type.LoadCombo; ((LoadCombo)def).name = comboType; } LoadDefinitions.Add(def); } //create a new load combo LoadCombo loadcombo = new LoadCombo(lcname, LoadCombosTypes[pos][0], LoadDefinitions, LoadCombosMultipliers[pos].ToList()); model.ModelDefinitions.Add(loadcombo); } } // 2. GET DYNAMO FRAMES ( get Loads and Releases that are assigned to that frame) //2.a GET LOADS that are Assigned to Frames Dictionary<int, string> DictFrm_PointLoads = new Dictionary<int, string>(); Dictionary<int, string> DictFrm_DistLoads = new Dictionary<int, string>(); //Get Point Loads string[] framesWithPointLoads = null; string[] PlPattern = null; int Pnumber = 0; int[] PmyType = null; string[] PCsys = null; int[] Pdir = null; double[] PRelDist = null; double[] PDist = null; double[] PVal = null; LoadMapper.GetPointLoads(ref SapModel, ref framesWithPointLoads, ref Pnumber, ref PlPattern, ref PmyType, ref PCsys, ref Pdir, ref PRelDist, ref PDist, ref PVal); if (framesWithPointLoads != null) { for (int i = 0; i < framesWithPointLoads.Count(); i++) { DictFrm_PointLoads.Add(i, framesWithPointLoads[i]); } } // Get Distributed Loads string[] framesWithDistributedLoads = null; string[] DlPattern = null; int Dnumber = 0; int[] DmyType = null; string[] DCsys = null; int[] Ddir = null; double[] DRD1 = null; double[] DRD2 = null; double[] DDist1 = null; double[] DDist2 = null; double[] DVal1 = null; double[] DVal2 = null; LoadMapper.GetDistributedLoads(ref SapModel, ref framesWithDistributedLoads, ref Dnumber, ref DlPattern, ref DmyType, ref DCsys, ref Ddir, ref DRD1, ref DRD2, ref DDist1, ref DDist2, ref DVal1, ref DVal2); if (framesWithDistributedLoads != null) { for (int i = 0; i < framesWithDistributedLoads.Count(); i++) { DictFrm_DistLoads.Add(i, framesWithDistributedLoads[i]); } } //2.b Get Frames // Calculate Length Scale Factor //Double SF = Utilities.UnitConversion("m", SapModelUnits); // Dynamo API Lenght Unit is 'meter' Double SF = 1; List<string> FrmIds = new List<string>(); StructureMapper.GetSAPFrameList(ref SapModel,ref FrmIds); for (int i = 0; i < FrmIds.Count; i++) { Point s = null; Point e = null; string matProp = "A992Fy50"; // default value string secName = "W12X14"; // default value string secCatalog = "AISC14"; // default value string Just = "MiddleCenter"; // default value double Rot = 0; // default value StructureMapper.GetFrm(ref SapModel, FrmIds[i], ref s, ref e, ref matProp, ref secName, ref Just, ref Rot, ref secCatalog, SF); SectionProp secProp = new SectionProp(secName, matProp, secCatalog); Frame d_frm = new Frame(s, e, secProp, Just, Rot); d_frm.Label = FrmIds[i]; model.StructuralElements.Add(d_frm); //LOADS // Frame might have multiple loads assigned to it... d_frm.Loads = new List<Load>(); //Check if the frame has distributed loads var outindexes = from obj in DictFrm_DistLoads where obj.Value == d_frm.Label select obj.Key; foreach(int index in outindexes) { LoadPattern Dlp = null; foreach (LoadPattern loadp in TempLPatterns) { if (loadp.name == DlPattern[index]) { Dlp = loadp; break; } } if (Dlp != null) { // using relDist as true, and using the relative distance values DRD1 and DRD2 bool relDist = true; Load l = new Load(Dlp, DmyType[index], Ddir[index], DRD1[index], DRD2[index], DVal1[index], DVal2[index], DCsys[index], relDist); l.LoadType = "DistributedLoad"; d_frm.Loads.Add(l); } } //Check if the frame has Point Loads var outindexesO = from obj in DictFrm_PointLoads where obj.Value == d_frm.Label select obj.Key; foreach (int index in outindexesO) { LoadPattern Plp = null; foreach (LoadPattern loadp in TempLPatterns) { if (loadp.name == PlPattern[index]) { Plp = loadp; break; } } if (Plp != null) { bool relativedist = true; Load l = new Load(Plp, PmyType[index], Pdir[index], PRelDist[index], PVal[index], PCsys[index], relativedist); l.LoadType = "PointLoad"; d_frm.Loads.Add(l); } } //RELEASES bool[] ii = new bool[6]; bool[] jj = new bool[6]; ReleaseMapper.Get(ref SapModel, FrmIds[i], ref ii, ref jj); // Populate if return releases if (ii.Contains(true) || jj.Contains(true)) { d_frm.Releases = Release.Set(ii[0], jj[0] , ii[1], jj[1] , ii[2], jj[2] , ii[3], jj[3] , ii[4], jj[4] , ii[5], jj[5]); } } // 2.b Get Shells from SAP Model List<string> AreaIds = new List<string>(); SAPConnection.StructureMapper.GetSAPAreaList(ref SapModel, ref AreaIds); for (int i = 0; i < AreaIds.Count; i++) { Surface S = null; string propName = string.Empty; SAPConnection.StructureMapper.GetShell(ref SapModel, AreaIds[i], ref S, SF, ref propName); int ShellType= 1; bool DOF = true; string MatProp = string.Empty; double MatAngle = 0; double Thickness = 0; double Bending = 0; SAPConnection.StructureMapper.GetShellProp(ref SapModel, propName, ref ShellType, ref DOF, ref MatProp, ref MatAngle, ref Thickness, ref Bending); ShellProp sP = new ShellProp(propName, ShellType, DOF, MatProp, MatAngle, Thickness * SF, Bending); Shell d_Shell = new Shell(S, sP); d_Shell.Label = AreaIds[i]; model.StructuralElements.Add(d_Shell); } // 3. GET RESTRAINTS int CountRes = RestraintMapper.Count(ref SapModel); if (CountRes > 0) { List<string> PtIds = new List<string>(); RestraintMapper.GetSupportedPts(ref SapModel, ref PtIds); // Populate Dynamo Restraints foreach (var PtId in PtIds) { Point Pti = null; bool[] restraints = new bool[6]; RestraintMapper.Get(ref SapModel, PtId, ref Pti, ref restraints, SF); Joint myj = new Joint(Pti); myj.Label = PtId; // Populate on Joint Restraints Restraint support = Restraint.Define(restraints[0], restraints[1], restraints[2], restraints[3], restraints[4], restraints[5]); myj.JointRestraint = support; model.StructuralElements.Add(myj); } } } else { throw new Exception("Make sure SAP Model is open!"); } // Get Groups List<String> SapGroups = new List<string>(); SAPConnection.GroupMapper.GetSAPGroupList(ref SapModel, ref SapGroups); int counter = 0; foreach (var g in SapGroups) { Group myG = new Group(); myG.Name = g; myG.GroupElements = new List<Element>(); // get assignments int[] types = null; string[] Labels = null; SAPConnection.GroupMapper.GetGroupAssignments(ref SapModel, g, ref types, ref Labels); if (Labels!=null && Labels.Count() > 0) { for (int i = 0; i < Labels.Length; i++) { if (types[i] == 1) // Joint { try { var gel = (from el in model.StructuralElements where el.Label == Labels[i] && el.Type == Structure.Type.Joint select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } catch (Exception) { } } else if (types[i] == 2) // frame { try { var gel = (from el in model.StructuralElements where el.Type == Structure.Type.Frame && el.Label == Labels[i] select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } catch (Exception) { } } else if (types[i] == 3) // cable { //TODO: After cable object defined } else if (types[i] == 5) // shell { var gel = (from el in model.StructuralElements where el.Type == Structure.Type.Shell && el.Label == Labels[i] select el).First(); if (gel != null) { myG.GroupElements.Add(gel); } } } } else { counter++; } //Add to Model definitions model.ModelDefinitions.Add(myG); } if (counter == SapGroups.Count) { //throw new Exception("The group(s) have no members assigned"); } }
public ShearWallPanelResponse(string elementId, LoadPattern loadPattern, LineSegment2D wallLocation, LoadCase loadCase = null) : base(elementId, loadPattern, loadCase) { WallLocation = wallLocation; }
public NodalDisplacement DetermineRigidbodyPointDisplacement(Point2D coordinate, LoadPattern loadPattern) { LateralLevelForce forceAtLoadPattern = Forces.First(f => f.LoadPattern == loadPattern); var alpha = new Unitless((coordinate - LateralLevel.CenterOfRigidity).SignedAngleTo(Vector2D.XAxis)); var d = new Length(coordinate.DistanceTo(LateralLevel.CenterOfRigidity), LengthUnit.Inch); Moment M = forceAtLoadPattern.TotalT(LateralLevel.CenterOfRigidity); var rotation = (Unitless)(M / LevelStiffness.J); Length displacementX = (Length)(forceAtLoadPattern.DirectX / LevelStiffness.X + d * rotation * Result.Sin(alpha)); Length displacementY = (Length)(forceAtLoadPattern.DirectY / LevelStiffness.Y + d * rotation * Result.Cos(alpha)); if (LoadPatternTypeConverter.Convert(loadPattern) == LoadPatternType.Earthquake) { displacementX = (Length)(displacementX * Cd); displacementY = (Length)(displacementY * Cd); } return(new NodalDisplacement { LoadPattern = loadPattern, Ux = displacementX.ConvertTo(LengthUnit.Inch), Uy = displacementY.ConvertTo(LengthUnit.Inch), Rz = 0 }); }
public PointLoad(double mag, LoadPattern pattern) : base(mag, pattern) { }
public LineLoad(double mag, LoadPattern pattern) : base(mag, pattern) { }
public FloorLoad(BuildingLevel level, Projection projection, LoadPattern loadPattern) { Level = level; Projection = projection; LoadPattern = loadPattern; }
public T GetResponseAtLoadPattern(LoadPattern loadPattern) { return(this.First(l => l.LoadPattern == loadPattern)); }
public PointLoad(Point2D location, double magnitude, BuildingLevel level, Projection projection, LoadPattern loadPattern) : base(level, projection, loadPattern) { Location = location; Magnitude = magnitude; }
/// <summary> /// This function assigns loads to frame objects. /// Parameters description below as presented in the SAP CSi OAPI Documentation /// </summary> /// <param name="LoadPattern">The name of a defined load pattern.</param> /// <param name="LoadType">Force or moment load. Use the Load Type dropdown</param> /// <param name="Direction">This is an integer between 1 and 11, indicating the direction of the load. /// 1 = Local 1 axis (only applies when CSys is Local) /// 2 = Local 2 axis (only applies when CSys is Local) /// 3 = Local 3 axis (only applies when CSys is Local) /// 4 = X direction (does not apply when CSys is Local) /// 5 = Y direction (does not apply when CSys is Local) /// 6 = Z direction (does not apply when CSys is Local) /// 7 = Projected X direction (does not apply when CSys is Local) /// 8 = Projected Y direction (does not apply when CSys is Local) /// 9 = Projected Z direction (does not apply when CSys is Local) /// 10 = Gravity direction (only applies when CSys is Global) /// 11 = Projected Gravity direction (only applies when CSys is Global) /// The positive gravity direction (see Dir = 10 and 11) is in the negative Global Z direction.</param> /// <param name="Distance">This is the distance from the I-End of the frame object to the load location. /// This may be a relative distance (0 less or equal to Dist less or equal to 1) or an actual distance, /// depending on the value of the RelDist item. [L] when RelDist is False</param> /// <param name="Value">This is the value of the point load. [F] when MyType is 1 and [FL] when MyType is 2</param> /// <param name="CoordSystem">This is Local or the name of a defined coordinate system. /// It is the coordinate system in which the loads are specified.</param> /// <param name="RelativeDistance">If this item is True, the specified Dist item is a relative distance, /// otherwise it is an actual distance.</param> /// <param name="Replace">If this item is True, all previous loads, if any, assigned to the specified frame object(s), /// in the specified load pattern, are deleted before making the new assignment.</param> /// <returns>Load at a point along a Frame</returns> //DYNAMO CREATE NODES public static Load PointLoad(LoadPattern LoadPattern, string LoadType, int Direction, double Distance, double Value, string CoordSystem = "Global", bool RelativeDistance = true, bool Replace = true) { int ltype = 1; if (LoadType == "Moment") ltype = 2; CheckCoordSysAndDir(Direction, CoordSystem); Load l = new Load(LoadPattern, ltype, Direction, Distance, Value, CoordSystem, RelativeDistance); l.LoadType = "PointLoad"; return l; }