/// <summary> /// Executes the command. /// Gets the Load Case properties from the User, adds it to the Model and sets it as Active. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { string name = Culture.Get("defaultLoadCase"); LoadCase lCase = new LoadCase(name, LoadCase.LoadCaseType.Dead); lCase.Name = name; // services.GetProperties(lCase.Name, lCase, false); EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!services.Model.LoadCases.ContainsKey(lCase.Name)) { services.Model.LoadCases.Add(lCase.Name, lCase); } services.Model.ActiveLoadCase = lCase; AnalysisCase aCase = new AnalysisCase(lCase.Name); StaticCaseProps props = aCase.Properties as StaticCaseProps; if (props != null) { List <StaticCaseFactor> list = props.Loads; list.Add(new StaticCaseFactor(lCase)); props.Loads = list; services.Model.AbstractCases.Add(aCase); } } else { services.Model.Undo.Rollback(); } }
private void store(OleDbConnection cn, string analysisCase, StaticCaseProps props) { foreach (StaticCaseFactor factor in props.Loads) { string lType, lName, sFact; AnalysisCaseAppliedLoad appLoad = factor.AppliedLoad; if (appLoad is AccelLoad) { lType = "Accel load"; lName = ((AccelLoad)appLoad).Value.ToString(); sFact = "1.0"; } else { lType = "Load case"; lName = ((LoadCase)appLoad).Name; sFact = factor.Factor.ToString(); } string sql = "INSERT INTO [Case - Static 1 - Load Assignments] " + "([Case],LoadType,LoadName, LoadSF) VALUES " + "(\"" + analysisCase + "\",\"" + lType + "\",\"" + lName + "\"," + sFact + ");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); } }
/// <summary> /// Executes the command. /// Gets the parameters and creates the analysis case. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { string name = Culture.Get("defaultAnalysisCaseName"); Canguro.Model.Model model = services.Model; StaticCaseProps props = new StaticCaseProps(); AnalysisCase aCase = new AnalysisCase(name, props); services.GetProperties(aCase.Name, aCase, false); model.AbstractCases.Add(aCase); }
protected List <AbstractCaseFactor> GetLoads(LoadCase.LoadCaseType type, float factor) { List <AbstractCaseFactor> list = new List <Canguro.Model.Load.AbstractCaseFactor>(); foreach (AbstractCase ac in Model.Instance.AbstractCases) { if (ac is AnalysisCase && ((AnalysisCase)ac).Properties is StaticCaseProps) { StaticCaseProps props = (StaticCaseProps)((AnalysisCase)ac).Properties; if (!(props is PDeltaCaseProps)) { bool use = false; foreach (StaticCaseFactor fact in props.Loads) { if (fact.AppliedLoad is LoadCase && ((LoadCase)fact.AppliedLoad).CaseType == type) { use = true; } else { use = false; break; } } if (use) { list.Add(new AbstractCaseFactor(ac, factor)); } } } else if (type == LoadCase.LoadCaseType.Quake && ac is AnalysisCase && ((AnalysisCase)ac).Properties is ResponseSpectrumCaseProps) { list.Add(new AbstractCaseFactor(ac, factor)); } } return(list); }
/// <summary> /// Destruye todo el modelo y lo deja limpio /// </summary> /// <TODO>Modified, Save, Load</TODO> public void Reset() { try { this.undoManager = new UndoManager(this); undoManager.Enabled = false; this.abstractCases = new ManagedList <Canguro.Model.Load.AbstractCase>(); abstractCases.ElementRemoved += new ManagedList <AbstractCase> .ListChangedEventHandler(abstractCases_ElementRemoved); this.activeLoadCase = null; this.areaList = new ItemList <AreaElement>(); this.constraintList = new ManagedList <Constraint>(); this.isLocked = false; this.jointList = new ItemList <Joint>(); this.layers = new ItemList <Layer>(); layers.ElementRemoved += new ManagedList <Layer> .ListChangedEventHandler(layers_ElementRemoved); this.lineList = new ItemList <LineElement>(); this.loadCases = new ManagedDictionary <string, LoadCase>(); loadCases.ElementRemoved += new ManagedDictionary <string, LoadCase> .ListChangedEventHandler(loadCases_ElementRemoved); this.summary = new ModelSummary(this); this.designOptions = new List <DesignOptions>(); designOptions.Add(NoDesign.Instance); designOptions.Add(new LRFD99()); designOptions.Add(new ACI318_02()); designOptions.Add(new ASD01()); designOptions.Add(new RCDF2001()); designOptions.Add(new UBC97_ASD()); designOptions.Add(new UBC97_LRFD()); designOptions.Add(new UBC97_Conc()); steelDesignOptions = NoDesign.Instance; concreteDesignOptions = NoDesign.Instance; coldFormedDesignOptions = NoDesign.Instance; aluminumDesignOptions = NoDesign.Instance; this.results = new Canguro.Model.Results.Results(0); // Layer es un Item y todos los Items asignan su propiedad layer // de acuerdo a ActiveLayer, por lo que hay que asignarla en null // antes de crear el primer Layer, root de todos los demás activeLayer = null; Layer rootLayer = new Layer(Culture.Get("defaultLayerName")); ActiveLayer = rootLayer; activeLoadCase = new LoadCase(Culture.Get("defaultLoadCase"), LoadCase.LoadCaseType.Dead); activeLoadCase.SelfWeight = 1.0f; loadCases.Add(activeLoadCase.Name, activeLoadCase); AnalysisCase anc = new Canguro.Model.Load.AnalysisCase(Culture.Get("defaultLoadCase")); AbstractCases.Add(anc); if (anc != null) { StaticCaseProps props = anc.Properties as StaticCaseProps; if (props != null) { List <StaticCaseFactor> list = props.Loads; list.Add(new StaticCaseFactor(ActiveLoadCase)); props.Loads = list; } } MaterialManager.Instance.Initialize(); SectionManager.Instance.Initialize(ref sections); sections.ElementRemoved += new Catalog <Canguro.Model.Section.Section> .ListChangedEventHandler(sections_ElementRemoved); this.currentPath = ""; foreach (Canguro.Model.UnitSystem.UnitSystem us in UnitSystemsManager.Instance.UnitSystems) { if (Properties.Settings.Default.UnitSystem.Equals(us.GetType().Name)) { UnitSystemsManager.Instance.CurrentSystem = us; } } viewManager = Canguro.View.GraphicViewManager.Instance; modified = false; } catch (Exception e) { Console.WriteLine(e.StackTrace); throw e; } finally { if (ModelReset != null) { ModelReset(this, EventArgs.Empty); } undoManager.Enabled = true; } }