private static string GatherBucklingLengths(StaadModel Model) { StringBuilder output = new StringBuilder(); BucklingLengthGenerator blg; IEnumerable<BucklingLength> bls; blg = new BucklingLengthGenerator(staadModel); // LZ output.AppendLine("***"); output.AppendLine("*** BUCKLING LENGTHS (LY)"); output.AppendLine("***"); bls = blg.GenerateBucklingLengthsLY(); output.AppendLine(GatherBucklingLengthsCollection(bls)); // LZ output.AppendLine("***"); output.AppendLine("*** BUCKLING LENGTHS (LZ)"); output.AppendLine("***"); bls = blg.GenerateBucklingLengthsLZ(); output.AppendLine(GatherBucklingLengthsCollection(bls)); // UNL output.AppendLine("***"); output.AppendLine("*** BUCKLING LENGTHS (UNL)"); output.AppendLine("***"); bls = blg.GenerateBucklingLengthsUNL(); output.AppendLine(GatherBucklingLengthsCollection(bls)); return output.ToString(); }
public DefaultMemberGenerator(StaadModel StaadModel, IMemberGeneratorConfiguration Configuration) { // Set defaults this.SelectIndividualMembersDuringCreation = false; this.StaadModel = StaadModel; this.Configuration = Configuration; }
static void Main(string[] args) { Stopwatch st; ConsoleKey userInput; st = new Stopwatch(); try { model = new StaadModel(OpenStaadGetter.InstantiateOpenSTAAD()); } catch (STAADRunningInstanceNotFoundException) { Console.WriteLine("Could not get hold of STAAD"); Console.ReadKey(); return; } catch { Console.WriteLine("An unknown error occurred"); Console.ReadKey(); return; } model.ModelBuildStatusUpdate += model_ModelBuildStatusUpdate; st.Start(); model.Build(); st.Stop(); Console.WriteLine(); Console.WriteLine("Model built in {0:0.000}s", st.Elapsed.TotalMilliseconds / 1000); // Console.WriteLine("Press s to select beams by type, y to generate members, press any other key to quit..."); userInput = Console.ReadKey().Key; if (userInput == ConsoleKey.S) SelectBeamsByType(); else if (userInput != ConsoleKey.Y) return; Console.WriteLine(); Console.WriteLine("Starting member generation..."); st.Reset(); st.Start(); model.GenerateMembers(); st.Stop(); Console.WriteLine("Member generation completed in {0:0.000}s", st.Elapsed.TotalMilliseconds / 1000); Console.WriteLine("Press s to select members by type, press any other key to quit..."); userInput = Console.ReadKey().Key; if (userInput == ConsoleKey.S) SelectMembersByType(); else return; //BucklingLengthGenerator blg = new BucklingLengthGenerator(model) { SelectMembersDuringAnalysis = true }; Console.WriteLine("Press any key to quit"); Console.ReadKey(); }
static void model_ModelBuildStatusUpdate(StaadModel sender, ModelBuildStatusUpdateEventArgs e) { if (string.IsNullOrEmpty(previouStatusMessage) || !previouStatusMessage.Equals(e.StatusMessage)) { if (!string.IsNullOrEmpty(previouStatusMessage)) Console.WriteLine(); Console.Write(e.StatusMessage); previouStatusMessage = e.StatusMessage; } }
public BucklingLengthGenerator(StaadModel StaadModel) { this.PrimaryBeams = new List<Beam>(); this.SecondaryBeams = new List<Beam>(); this.TertiaryBeams = new List<Beam>(); this.StabilityBraces = new List<Beam>(); this.StaadModel = StaadModel; this.AnalyseStructure(); }
public BucklingLengthGenerator(StaadModel StaadModel) { this.PrimaryBeams = new List <Beam>(); this.SecondaryBeams = new List <Beam>(); this.TertiaryBeams = new List <Beam>(); this.StabilityBraces = new List <Beam>(); this.StaadModel = StaadModel; this.AnalyseStructure(); }
/// <summary> /// Find beams which are not running in positive direction with respect to global axes /// </summary> /// <param name="Model">The model to check</param> /// <returns>A list containing all beams which are not running positive with respect to global axes</returns> public static List<Beam> CheckBeamDirections(StaadModel Model) { IEnumerable<Beam> beamsToCheck; List<Beam> output= new List<Beam>(); beamsToCheck = Model.Beams; foreach (Beam b in beamsToCheck) { if (b.IsParallelToX && b.EndNode.x - b.StartNode.x < 0) output.Add(b); else if (b.IsParallelToY && b.EndNode.y - b.StartNode.y < 0) output.Add(b); else if (b.IsParallelToZ && b.EndNode.z - b.StartNode.z < 0) output.Add(b); } return output; }
/// <summary> /// Find beams which are not running in positive direction with respect to global axes /// </summary> /// <param name="Model">The model to check</param> /// <returns>A list containing all beams which are not running positive with respect to global axes</returns> public static List <Beam> CheckBeamDirections(StaadModel Model) { var output = new List <Beam>(); var beamsToCheck = Model.Beams; foreach (var b in beamsToCheck) { if (b.IsParallelToX && b.EndNode.X - b.StartNode.X < 0) { output.Add(b); } else if (b.IsParallelToY && b.EndNode.Y - b.StartNode.Y < 0) { output.Add(b); } else if (b.IsParallelToZ && b.EndNode.Z - b.StartNode.Z < 0) { output.Add(b); } } return(output); }
private static bool GetSTAADModel() { try { staadModel = new StaadModel(); } catch { return false; } staadModel.ModelBuildStatusUpdate += staadModel_ModelBuildStatusUpdate; staadModel.ModelBuildComplete += staadModel_ModelBuildComplete; staadModel.MemberGenerator.StatusUpdate += MemberGenerator_StatusUpdate; return true; }
static void staadModel_ModelBuildComplete(StaadModel sender) { Console.WriteLine("Build completed"); }
public DeflectionLengthGenerator(StaadModel StaadModel) { this.StaadModel = StaadModel; }
static void staadModel_ModelBuildStatusUpdate(StaadModel sender, ModelBuildStatusUpdateEventArgs e) { if (string.IsNullOrEmpty(previousStatus) || !previousStatus.Equals(e.StatusMessage)) { previousStatus = e.StatusMessage; Console.WriteLine(e.StatusMessage); } }
/// <summary> /// Public constructor. Requires a valid model class. /// </summary> /// <param name="Model">The model class for which to generate members.</param> public DefaultMemberGenerator(StaadModel StaadModel) : this(StaadModel, new DefaultMemberGeneratorConfiguration()) { }
private static string GatherDeflectionLengths(StaadModel Model) { StringBuilder output = new StringBuilder(); IEnumerable<DeflectionLength> verticalMembers; IEnumerable<DeflectionLength> horizontalMembers; DeflectionLengthGenerator dlg = new DeflectionLengthGenerator(staadModel); dlg.GenerateDeflectionLengths(); verticalMembers = dlg.DeflectionLengths.Where(dl => dl.Member.Type == MEMBERTYPE.COLUMN || dl.Member.Type == MEMBERTYPE.POST).OrderBy(dl => dl.StartNode.z).ThenBy(dl => dl.StartNode.x).ThenBy(dl => dl.StartNode.y); horizontalMembers = dlg.DeflectionLengths.Except(verticalMembers).OrderBy(dl => dl.StartNode.y).ThenBy(dl => dl.StartNode.z).ThenBy(dl => dl.StartNode.x); output.AppendLine("***"); output.AppendLine("*** DEFLECTION LENGTHS"); output.AppendLine("***"); // Output Columns output.AppendLine("***"); output.AppendLine("*** COLUMNS & POSTS"); output.AppendLine("***"); foreach (DeflectionLength dl in verticalMembers) output.AppendLine(dl.ToSTAADString()); // Output beams output.AppendLine("***"); output.AppendLine("*** BEAMS & OTHERS"); output.AppendLine("***"); foreach (IGrouping<double, DeflectionLength> deflectionLengthGroup in horizontalMembers.GroupBy(dl => dl.StartNode.y)) { output.AppendLine("***"); output.AppendLine(string.Format("*** EL+{0:0.000}", deflectionLengthGroup.Key)); output.AppendLine("***"); foreach (DeflectionLength dl in deflectionLengthGroup) output.AppendLine(dl.ToSTAADString()); } return output.ToString(); }