public void SetLoadCombination(sLoadCombination com) { if (this.loadCombinations.Exists(c => c.Equals(com)) == false) { this.loadCombinations.Add(com); } this.AwarePatternNames(); }
public void ApplyPointLoadsByCombo(string comboName, ref double deadFactor) { sLoadCombination combo = GetLoadComboByName(comboName); //double Dfactor = 0.0; foreach (sNode sn in this.nodes) { StatNode stn = sn.extraData as StatNode; if (stn != null) { if (sn.pointLoads != null && sn.pointLoads.Count > 0) { sPointLoad comboLoad = new sPointLoad(); if (combo.combinationType == eCombinationType.LinearAdditive) { for (int i = 0; i < combo.patterns.Count; ++i) { string pattern = combo.patterns[i]; double factor = combo.factors[i]; if (pattern != "DEAD") { sn.UpdatePointLoadByPatternFactor_LinearAdditive(pattern, factor, ref comboLoad); } else { deadFactor = factor; } } } //else what? if (comboLoad.forceVector != null || comboLoad.momentVector != null) { //need to reset node load???????????????? comboLoad.location = sn.location; if (comboLoad.forceVector != null) { stn.AddLoad(comboLoad.forceVector.X, comboLoad.forceVector.Y, comboLoad.forceVector.Z); object t = stn; } if (comboLoad.momentVector != null) { stn.AddLoad(comboLoad.momentVector.X, comboLoad.momentVector.Y, comboLoad.momentVector.Z); } } } } } }
public sLoadCombination GetLoadComboByName(string comboName) { sLoadCombination combo = null; foreach (sLoadCombination co in this.loadCombinations) { if (co.combinationName == comboName) { combo = co; break; } } return(combo); }
public void ApplyLineLoadsByCombo(string comboName, ref double deadFactor) { sLoadCombination combo = GetLoadComboByName(comboName); foreach (StatBeam stb in this.FEsystem.Beams) { sFrame sb = stb.ExtraData as sFrame; if (sb != null) { if (sb.lineLoads != null && sb.lineLoads.Count > 0) { sLineLoad comboLoad = new sLineLoad(); if (combo.combinationType == eCombinationType.LinearAdditive) { for (int i = 0; i < combo.patterns.Count; ++i) { string pattern = combo.patterns[i]; double factor = combo.factors[i]; if (pattern != "DEAD") { sb.UpdateLineLoadByPatternFactor_LinearAdditive(pattern, factor, ref comboLoad); } else { deadFactor = factor; } } } //else what? if (comboLoad.load_Force != null || comboLoad.load_Moment != null) { if (comboLoad.load_Force != null) { stb.AppliedLinearLoad = new C_vector(comboLoad.load_Force.X, comboLoad.load_Force.Y, comboLoad.load_Force.Z); } if (comboLoad.load_Moment != null) { stb.AppliedLinearLoad = new C_vector(comboLoad.load_Moment.X, comboLoad.load_Moment.Y, comboLoad.load_Moment.Z); } } if (comboLoad.load_Scalar > 0.0) { } } } } }
protected override void SolveInstance(IGH_DataAccess DA) { string comboName = ""; List <string> patternNames = new List <string>(); List <double> patternFactors = new List <double>(); if (!DA.GetData(0, ref comboName)) { return; } if (!DA.GetDataList(1, patternNames)) { return; } if (!DA.GetDataList(2, patternFactors)) { return; } sLoadCombination combo = null; if (patternNames.Count == patternFactors.Count && patternFactors.Count > 0) { combo = new sLoadCombination(comboName, comType, patternNames, patternFactors); string mss = "Load Combination: " + comboName; mss += "\n" + combo.combinationType.ToString(); for (int i = 0; i < patternNames.Count; ++i) { mss += "\n" + patternFactors[i] + " X " + patternNames[i]; } this.Message = mss; } else { this.Message = "Please provide same number of data\nfor names and factors"; } DA.SetData(0, combo); }
public static object Build_sSystem(List <object> sElements, object systemSettings = null) { sSystemSetting sysSet = null; if (systemSettings == null) { sysSet = new sSystemSetting(); sysSet.systemOriUnit = "Feet"; sysSet.systemName = "DefaultSetting"; sysSet.currentCase = "DEAD"; sysSet.currentCheckType = eSystemCheckType.StrengthCheck; sysSet.currentStressThreshold_pascal = 25 * 6894757.28; sysSet.currentDeflectionThreshold_mm = 100; sysSet.mergeTolerance_m = 0.005; sysSet.meshDensity_m = 0.5; } else { sysSet = systemSettings as sSystemSetting; } sSystem jsys = new sSystem(); jsys.systemSettings = sysSet; List <IsObject> sobjs = new List <IsObject>(); sDynamoConverter dycon = new sDynamoConverter(); jsys.loadPatterns.Add("DEAD"); int supCount = 0; int nodeID = 0; foreach (object so in sElements) { sFrameSet sb = so as sFrameSet; if (sb != null) { jsys.frameSets.Add(sb); sobjs.Add(sb); if (sb.lineLoads != null) { foreach (sLineLoad ll in sb.lineLoads) { jsys.AwarePatternNames(ll.loadPatternName); } } continue; } sPointSupport psup = so as sPointSupport; if (psup != null) { if (jsys.UpdateNodeFromPointElement(psup, nodeID)) { nodeID++; } supCount++; continue; } sPointLoad pl = so as sPointLoad; if (pl != null) { if (jsys.UpdateNodeFromPointElement(pl, nodeID)) { nodeID++; jsys.AwarePatternNames(pl.loadPatternName); } continue; } sLoadCombination com = so as sLoadCombination; if (com != null) { jsys.SetLoadCombination(com); } } if (supCount > 0) { //jsys.geometrySettings.systemBoundingBox = dycon.TosBoundingBox(sobjs); //jsys.SystemName = sysSet.systemName; return(new Dictionary <string, object> { { "sSystem", jsys } }); } else { return(new Dictionary <string, object> { { "sSystem", null } }); } }
protected override void SolveInstance(IGH_DataAccess DA) { sSystemSetting sysSetting = null; List <object> sElement = new List <object>(); DA.GetData(0, ref sysSetting); if (!DA.GetDataList(1, sElement)) { return; } sRhinoConverter rhcon = new sRhinoConverter(); string currentUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); if (sysSetting == null) { sysSetting = new sSystemSetting(); sysSetting.systemOriUnit = currentUnit; sysSetting.systemName = "DefaultSetting"; sysSetting.currentCase = "DEAD"; sysSetting.currentCheckType = eSystemCheckType.StrengthCheck; sysSetting.currentStressThreshold_pascal = 25 * 6894757.28; sysSetting.currentDeflectionThreshold_mm = 100; sysSetting.mergeTolerance_m = 0.005; sysSetting.meshDensity_m = 0.5; } if (currentUnit == "Meters" || currentUnit == "Feet") { ISystem jsys = InitiateISystem(sElement); jsys.systemSettings = sysSetting; List <IsObject> sObjs = new List <IsObject>(); jsys.loadPatterns.Add("DEAD"); int supCount = 0; int nodeID = 0; try { foreach (object so in sElement) { GH_ObjectWrapper wap = new GH_ObjectWrapper(so); IFrameSet bs = wap.Value as IFrameSet; if (bs != null) { //jsys.beamSets.Add(bs); jsys.AddsBeamSet(bs); //?? sObjs.Add(bs); if (bs.lineLoads != null) { foreach (sLineLoad ll in bs.lineLoads) { jsys.AwarePatternNames(ll.loadPatternName); } } } sPointLoad pl = wap.Value as sPointLoad; if (pl != null) { if (jsys.UpdateNodeFromPointElement(pl, nodeID)) { nodeID++; jsys.AwarePatternNames(pl.loadPatternName); } } sLoadCombination com = wap.Value as sLoadCombination; if (com != null) { jsys.SetLoadCombination(com); } } foreach (object so in sElement) { GH_ObjectWrapper wap = new GH_ObjectWrapper(so); sPointSupport psup = wap.Value as sPointSupport; if (psup != null) { if (jsys.UpdateNodeFromPointElement(psup, nodeID)) { nodeID++; } supCount++; } } foreach (sMesh am in jsys.meshes) { // sObjs.Add(am); } if (supCount > 0) { this.Message = "System : " + sysSetting.systemName + "\nis instantiated"; jsys.systemSettings.systemBoundingBox = rhcon.TosBoundingBox(sObjs); //jsys.SystemName = sysSetting.systemName; DA.SetData(0, jsys); } else { this.Message = "System : " + sysSetting.systemName + "\nneeds supports"; //jsys.SystemName = sysSetting.systemName; this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, this.Message); DA.SetData(0, null); } } catch (Exception e) { this.Message = "System : " + sysSetting.systemName + "\ninstantiation failed"; this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message); DA.SetData(0, null); } } else { this.Message = "ASKSGH.Bridgify only works in\n Meters or Feet"; this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, this.Message); DA.SetData(0, null); } }