private void store(OleDbConnection cn, string analysisCase, ResponseSpectrumCaseProps props) { string sql = "INSERT INTO [Case - Response Spectrum 1 - General] " + "([Case],ModalCombo,DirCombo,DampingType,ConstDamp,EccenRatio,NumOverride) VALUES " + "(\"" + analysisCase + "\",\"" + props.ModalCombination + "\",\"" + props.DirectionalCombination + "\"," + "\"Constant\"," + props.ModalDamping + ",0,0);"; new OleDbCommand(sql, cn).ExecuteNonQuery(); List <ResponseSpectrumCaseFactor> list = props.Loads; foreach (ResponseSpectrumCaseFactor f in list) { if (f == null) { continue; } AccelLoad load = f.Accel as AccelLoad; sql = ""; if (load != null) { sql = "INSERT INTO [Case - Response Spectrum 2 - Load Assignments] " + "([Case],LoadType,LoadName,CoordSys,Function,Angle,TransAccSF) VALUES " + "(\"" + analysisCase + "\",\"Acceleration\",\"" + encode(load.Value) + "\"," + "\"GLOBAL\",\"" + props.ResponseSpectrumFunction + "\",0,1);"; new OleDbCommand(sql, cn).ExecuteNonQuery(); } } }
private void store(OleDbConnection cn, AnalysisCase obj) { AnalysisCaseProps props = obj.Properties; string sql; if (props is ResponseSpectrumCaseProps) { ResponseSpectrumCaseProps rProps = props as ResponseSpectrumCaseProps; sql = "INSERT INTO [Analysis Case Definitions] " + "([Case], Type, ModalCase, RunCase) VALUES " + "(\"" + obj.Name + "\", \"LinRespSpec\", \"" + rProps.ModalAnalysisCase + "\", \"Yes\");"; } else { string type = (props is ModalCaseProps) ? "LinModal" : "LinStatic"; sql = "INSERT INTO [Analysis Case Definitions] " + "([Case], Type, InitialCond, RunCase) VALUES " + "(\"" + obj.Name + "\",\"" + type + "\",\"Zero\",\"Yes\");"; } new OleDbCommand(sql, cn).ExecuteNonQuery(); // Insert record in RESULTS Named Set sql = " INSERT INTO [Named Sets - Database Tables 2 - Selections] " + "(DBNamedSet, SelectType, [Selection]) VALUES (\"RESULTS\", \"AnalysisCase\", \"" + obj.Name + "\");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); if (props is StaticCaseProps) { store(cn, obj.Name, (StaticCaseProps)props); } else if (props is ModalCaseProps) { store(cn, obj.Name, (ModalCaseProps)props); } else if (props is ResponseSpectrumCaseProps) { store(cn, obj.Name, (ResponseSpectrumCaseProps)props); } //else if (props is MultistepStaticCaseProps) // store(cn, obj.Name, (MultistepStaticCaseProps)props); //else if (props is TimeHistoryCaseProps) // store(cn, obj.Name, (TimeHistoryCaseProps)props); //else if (props is MovingLoadCaseProps) // store(cn, obj.Name, (MovingLoadCaseProps)props); //else if (props is BucklingCaseProps) // store(cn, obj.Name, (BucklingCaseProps)props); //else if (props is SteadyStateCaseProps) // store(cn, obj.Name, (SteadyStateCaseProps)props); //else if (props is PowerSpectalDensityCaseProps) // store(cn, obj.Name, (PowerSpectalDensityCaseProps)props); }
private void responseSpectrumCheckBox_CheckedChanged(object sender, EventArgs e) { AnalysisCase modalCase = null; List <AnalysisCase> responseCases = new List <AnalysisCase>(); foreach (AbstractCase ac in model.AbstractCases) { if (ac is AnalysisCase && ((AnalysisCase)ac).Properties is ResponseSpectrumCaseProps) { responseCases.Add((AnalysisCase)ac); } else if (ac is AnalysisCase && ((AnalysisCase)ac).Properties is ModalCaseProps) { modalCase = (AnalysisCase)ac; } } if (modalCase == null) { modalCase = new AnalysisCase(Culture.Get("defaultModalCase"), new ModalCaseProps()); model.AbstractCases.Add(modalCase); } if (modalCase != null) { if (responseCases.Count == 0 && responseSpectrumCheckBox.Checked && model.ResponseSpectra.Count > 0) { ResponseSpectrumCaseProps props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UX); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " X", props)); model.AbstractCases.Add(responseCases[0]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UY); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Y", props)); model.AbstractCases.Add(responseCases[1]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UZ); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Z", props)); model.AbstractCases.Add(responseCases[2]); } foreach (AbstractCase responseCase in responseCases) { responseCase.IsActive = responseSpectrumCheckBox.Checked; } } }
private void responseSpectrumCheckBox_CheckedChanged(object sender, EventArgs e) { if (!updatingDialog) { if (responseCases.Count == 0 && responseSpectrumCheckBox.Checked && services.Model.ResponseSpectra.Count > 0) { if (modalCase == null) { modalCase = new AnalysisCase(Culture.Get("defaultModalCase"), new ModalCaseProps()); services.Model.AbstractCases.Add(modalCase); } ResponseSpectrumCaseProps props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UX); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " X", props)); responseCases[0].IsActive = false; services.Model.AbstractCases.Add(responseCases[0]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UY); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Y", props)); services.Model.AbstractCases.Add(responseCases[1]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UZ); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Z", props)); services.Model.AbstractCases.Add(responseCases[2]); } foreach (AbstractCase responseCase in responseCases) { responseCase.IsActive = responseSpectrumCheckBox.Checked; Canguro.Model.Model.Instance.RepairAbstractCases(responseCase); } UpdateDialog(); } }
public void UpdateDialog() { try { updatingDialog = true; int responseSpectrumCases = 0; Canguro.Model.Model model = services.Model; analysisCasesCheckedListBox.Items.Clear(); foreach (AbstractCase aCase in model.AbstractCases) { if (!(aCase is AnalysisCase) || (!(((AnalysisCase)aCase).Properties is ModalCaseProps) && (!(((AnalysisCase)aCase).Properties is ResponseSpectrumCaseProps)) && (!(((AnalysisCase)aCase).Properties is PDeltaCaseProps)))) { analysisCasesCheckedListBox.Items.Add(aCase); } if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is ResponseSpectrumCaseProps) { if (aCase.IsActive) { responseSpectrumCases++; } switch (responseSpectrumCases) { case 0: responseSpectrumCheckBox.CheckState = CheckState.Unchecked; break; case 1: case 2: responseSpectrumCheckBox.CheckState = CheckState.Indeterminate; break; default: responseSpectrumCheckBox.CheckState = CheckState.Checked; responseSpectrumFactorUpDown.Value = Convert.ToDecimal(((ResponseSpectrumCaseProps)((AnalysisCase)aCase).Properties).ScaleFactor); dampingFactorUpDown.Value = Convert.ToDecimal(((ResponseSpectrumCaseProps)((AnalysisCase)aCase).Properties).ModalDamping); break; } } if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is ModalCaseProps) { modalAnalysisCheckBox.Checked = aCase.IsActive; } if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is PDeltaCaseProps) { pDeltaCheckBox.Checked = aCase.IsActive; } } for (int i = 0; i < analysisCasesCheckedListBox.Items.Count; i++) { analysisCasesCheckedListBox.SetItemChecked(i, ((AbstractCase)analysisCasesCheckedListBox.Items[i]).IsActive); } if (modalCase != null) { modesNumericUpDown.Value = ((ModalCaseProps)modalCase.Properties).MaxModes; } if (responseCases.Count > 0 && responseCases[0].IsActive) { ResponseSpectrumCaseProps rsProps = (ResponseSpectrumCaseProps)responseCases[0].Properties; //responseSpectrumFunctionsComboBox.SelectedText = rsProps.ResponseSpectrumFunction.ToString(); if (responseSpectrumFunctionsComboBox.SelectedValue == null || !responseSpectrumFunctionsComboBox.SelectedValue.ToString().Equals(rsProps.ResponseSpectrumFunction.ToString())) { foreach (object obj in responseSpectrumFunctionsComboBox.Items) { if (rsProps != null && obj.ToString().Equals(rsProps.ResponseSpectrumFunction.ToString())) { responseSpectrumFunctionsComboBox.SelectedItem = obj; } } } viewSpectrumLink.Enabled = true; } else { viewSpectrumLink.Enabled = false; } modesNumericUpDown.Enabled = modalAnalysisCheckBox.Checked; //responseSpectrumCheckBox.Enabled = modalAnalysisCheckBox.Checked; responseSpectrumFunctionsComboBox.Enabled = responseSpectrumCheckBox.Checked; responseSpectrumFactorUpDown.Enabled = responseSpectrumCheckBox.Checked; dampingFactorLabel.Enabled = responseSpectrumCheckBox.Checked; dampingFactorUpDown.Enabled = responseSpectrumCheckBox.Checked; editSteelDesignLinkLabel.Enabled = steelDesignComboBox.Enabled && model.SteelDesignOptions is SteelDesignOptions; steelCombosLinkLabel.Enabled = editSteelDesignLinkLabel.Enabled; editConcreteDesignLinkLabel.Enabled = concreteDesignComboBox.Enabled && model.ConcreteDesignOptions is ConcreteDesignOptions; concreteCombosLinkLabel.Enabled = editConcreteDesignLinkLabel.Enabled; if (model.SteelDesignOptions is SteelDesignOptions && model.SteelDesignOptions.DesignCombinations.Count == 0) { currentDesignOptions = model.SteelDesignOptions; } else if (model.ConcreteDesignOptions is ConcreteDesignOptions && model.ConcreteDesignOptions.DesignCombinations.Count == 0) { currentDesignOptions = model.ConcreteDesignOptions; } else { currentDesignOptions = null; } AnalyzeButton.Text = (currentDesignOptions == null) ? Culture.Get("analyze") : Culture.Get("next"); AcceptButton = AnalyzeButton; } finally { updatingDialog = false; } Update(); }