public MaterialsGUI(Material mat) { oneMaterial = (mat != null); InitializeComponent(); material = mat; IsotropicTypeProps isotropic; if (mat != null && mat.TypeProperties is IsotropicTypeProps) isotropic = (IsotropicTypeProps)mat.TypeProperties; else isotropic = MaterialManager.Instance.DefaultSteel.TypeProperties as IsotropicTypeProps; if (isotropic == null) isotropic = new IsotropicTypeProps(1.999E+11F, 0.3F, 0.0000117F); typeList.Add(isotropic); UniaxialTypeProps uniaxial; if (mat != null && mat.TypeProperties is UniaxialTypeProps) uniaxial = (UniaxialTypeProps)mat.TypeProperties; else uniaxial = MaterialManager.Instance.DefaultRebar.TypeProperties as UniaxialTypeProps; if (uniaxial == null) uniaxial = new UniaxialTypeProps(1.999E+11F, 0.0000117F); typeList.Add(uniaxial); designPropList.Add(new NoDesignProps()); designPropList.Add(new SteelDesignProps()); designPropList.Add(MaterialManager.Instance.DefaultConcrete.DesignProperties); //designPropList.Add(new AluminumDesignProps()); designPropList.Add(new RebarDesignProps()); //designPropList.Add(new ColdFormedDesignProps()); }
private void materialComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (materialComboBox.SelectedItem != null) { currentMaterial = MaterialManager.Instance.Materials[materialComboBox.SelectedItem.ToString()]; if (currentSection != null) currentSection.Material = currentMaterial; } }
private void addMaterialLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { MaterialsGUI gui = new MaterialsGUI(new Material()); if (gui.ShowDialog(this) == DialogResult.OK) { currentMaterial = gui.Material; MaterialManager.Instance.Materials[currentMaterial.Name] = currentMaterial; UpdateMaterialsComboBox(); } }
private void writeSteelDesignProps(XmlWriter xml, Material.Material mat) { MaterialDesignProps dProps = mat.DesignProperties; if (dProps.GetType().Name.Equals("SteelDesignProps")) { SteelDesignProps props = (SteelDesignProps)dProps; xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("Fy", props.Fy.ToString()); xml.WriteAttributeString("Fu", props.Fu.ToString()); xml.WriteEndElement(); } }
/// <summary> /// Constructora que crea el material en base a un prototipo. /// </summary> /// <param name="prototype"></param> public Material(Material prototype) : this(prototype.Name, false, (MaterialDesignProps)prototype.DesignProperties.Clone(), (MaterialTypeProps)prototype.TypeProperties.Clone(), prototype.density) { }
private void writeConcreteDesignProps(XmlTextWriter xml, Material mat) { MaterialDesignProps dProps = mat.DesignProperties; if (dProps is ConcreteDesignProps) { ConcreteDesignProps props = (ConcreteDesignProps)dProps; string isLW = (props.IsLightweightConcrete) ? "Yes" : "No"; xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("Fc",props.Fc.ToString()); xml.WriteAttributeString("RebarFy", props.RebarFy.ToString()); xml.WriteAttributeString("RebarFys", props.RebarFys.ToString()); xml.WriteAttributeString("LtWtConc", isLW); xml.WriteAttributeString("LtWtFact", props.LightweightFactor.ToString()); xml.WriteEndElement(); } }
private void writeAluminumDesignProps(XmlTextWriter xml, Material mat) { MaterialDesignProps dProps = mat.DesignProperties; if (dProps is AluminumDesignProps) { AluminumDesignProps props = (AluminumDesignProps)dProps; xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("AlumType", props.Type.ToString()); xml.WriteAttributeString("Alloy", props.Alloy.ToString()); xml.WriteAttributeString("Ftu", props.Ftu.ToString()); xml.WriteAttributeString("Fty", props.Fty.ToString()); xml.WriteAttributeString("Fcy", props.Fcy.ToString()); xml.WriteAttributeString("Fsu", props.Fsu.ToString()); xml.WriteAttributeString("Fsy", props.Fsy.ToString()); xml.WriteEndElement(); } }
private void UpdatePage3() { if (currentSection == null) // || !(currentSection is Rectangular || currentSection is Circle)) wizardControl.SelectTab(0); else { currentMaterial = currentSection.Material; if (currentMaterial.DesignProperties is ConcreteDesignProps) { columnRadioButton.Visible = true; beamRadioButton.Visible = true; if (currentSection.ConcreteProperties is ConcreteBeamSectionProps) beamRadioButton.Checked = true; else if (currentSection.ConcreteProperties is ConcreteColumnSectionProps) columnRadioButton.Checked = true; if (currentSection is Rectangular) beamRadioButton.Enabled = true; else beamRadioButton.Enabled = false; nextButton3.Text = Culture.Get("next") + " >>"; } else if (currentMaterial.DesignProperties is SteelDesignProps) { columnRadioButton.Visible = false; beamRadioButton.Visible = false; nextButton3.Text = Culture.Get("apply"); } else wizardControl.SelectTab(3); t3TextBox.Text = currentSection.T3.ToString(); t2TextBox.Text = currentSection.T2.ToString(); tfTextBox.Text = currentSection.Tf.ToString(); twTextBox.Text = currentSection.Tw.ToString(); disTextBox.Text = currentSection.Dis.ToString(); if (currentSection is Rectangular) { t3Label.Text = "H (" + model.UnitSystem.UnitName(Canguro.Model.UnitSystem.Units.SmallDistance) + ")"; t3TextBox.Text = currentSection.T3.ToString(); t2Label.Text = "B (" + model.UnitSystem.UnitName(Canguro.Model.UnitSystem.Units.SmallDistance) + ")"; t2TextBox.Text = currentSection.T2.ToString(); t2Label.Visible = true; t2TextBox.Visible = true; tfLabel.Visible = false; tfTextBox.Visible = false; twLabel.Visible = false; twTextBox.Visible = false; disLabel.Visible = false; disTextBox.Visible = false; sectionPictureBox.Image = Properties.Resources.RectangularSectionImg; } else if (currentSection is Circle) { t3Label.Text = "D (" + model.UnitSystem.UnitName(Canguro.Model.UnitSystem.Units.SmallDistance) + ")"; t3TextBox.Text = currentSection.T3.ToString(); t2Label.Visible = false; t2TextBox.Visible = false; tfLabel.Visible = false; tfTextBox.Visible = false; twLabel.Visible = false; twTextBox.Visible = false; disLabel.Visible = false; disTextBox.Visible = false; sectionPictureBox.Image = Properties.Resources.CircleSectionImg; } else if (currentSection is General) { wizardControl.SelectTab(4); } else { string unit = "(" + model.UnitSystem.UnitName(Canguro.Model.UnitSystem.Units.SmallDistance) + ")"; t3Label.Text = "h " + unit; t2Label.Text = "b " + unit; tfLabel.Text = "Tf " + unit; twLabel.Text = "Tw " + unit; disLabel.Text = "Dis " + unit; t2Label.Visible = true; t2TextBox.Visible = true; tfLabel.Visible = true; tfTextBox.Visible = true; twLabel.Visible = true; twTextBox.Visible = true; disLabel.Visible = false; disTextBox.Visible = false; columnRadioButton.Visible = false; beamRadioButton.Visible = false; columnRadioButton.Checked = false; beamRadioButton.Checked = false; if (currentSection is IWideFlange) sectionPictureBox.Image = Properties.Resources.ISectionImg; else if (currentSection is BoxTube) sectionPictureBox.Image = Properties.Resources.TubeSectionImg; else if (currentSection is Angle) sectionPictureBox.Image = Properties.Resources.AngleSectionImg; else if (currentSection is Channel) sectionPictureBox.Image = Properties.Resources.ChannelSectionImg; else if (currentSection is Tee) sectionPictureBox.Image = Properties.Resources.TeeSectionImg; else if (currentSection is Pipe) { t3Label.Text = "r " + unit; t2Label.Text = "t " + unit; t2TextBox.Text = currentSection.Tw.ToString(); t2Label.Visible = true; t2TextBox.Visible = true; tfLabel.Visible = false; tfTextBox.Visible = false; twLabel.Visible = false; twTextBox.Visible = false; sectionPictureBox.Image = Properties.Resources.PipeSectionImg; } } } }
private void materialsListBox_MouseDoubleClick(object sender, MouseEventArgs e) { material = (Material)materialsListBox.SelectedItem; if (material != null && !material.IsLocked) wizardControl.SelectTab(1); }
private void deleteButton_Click(object sender, EventArgs e) { if (material != null && !material.IsLocked) { if (materialIsUsed()) { MessageBox.Show(Culture.Get("materialInUseError"), Culture.Get("error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); deleteButton.Enabled = false; } else { MaterialManager.Instance.Materials[material.Name] = null; material = null; UpdateMaterialList(); UpdatePage1(); } } }
private void backButton_Click(object sender, EventArgs e) { material = null; if (oneMaterial) DialogResult = DialogResult.Cancel; else wizardControl.SelectTab(0); }
private void addButton_Click(object sender, EventArgs e) { if (material != null) material = new Material(material); else material = new Material(); wizardControl.SelectTab(1); }
private void readMaterial(System.Xml.XmlNode node) { if (!"Material".Equals(node.Name)) return; string att; string name = Canguro.Model.Serializer.Deserializer.readAttribute(node, "Material", "MAT"); MaterialTypeProps tProps; float e = float.Parse(Canguro.Model.Serializer.Deserializer.readAttribute(node, "E", "0")); float u = float.Parse(Canguro.Model.Serializer.Deserializer.readAttribute(node, "U", "0")); float a = float.Parse(Canguro.Model.Serializer.Deserializer.readAttribute(node, "A", "0")); att = Canguro.Model.Serializer.Deserializer.readAttribute(node, "Type", "Isotropic"); switch (att) { case "Uniaxial": tProps = new UniaxialTypeProps(e, a); break; case "Isotropic": default: tProps = new IsotropicTypeProps(e, u, a); break; } string design = Canguro.Model.Serializer.Deserializer.readAttribute(node, "DesignType", "None"); MaterialDesignProps dProps; switch (design) { case "Rebar": dProps = new RebarDesignProps(); break; case "ColdFormed": dProps = new ColdFormedDesignProps(); break; case "Steel": dProps = new SteelDesignProps(); // Changes when readSteelDesignProps() is called. break; case "Concrete": dProps = new NoDesignProps(); // Changes when readConcreteDesignProps() is called. break; case "Aluminum": dProps = new AluminumDesignProps(); break; default: dProps = new NoDesignProps(); break; } float d = float.Parse(Canguro.Model.Serializer.Deserializer.readAttribute(node, "UnitMass", "d")); Material mat = new Material(name, false, dProps, tProps, d); Materials[name] = mat; }
/// <summary> /// Inicializa el catálogo cargando el archivo default.mat /// Si no encuentra el archivo, carga los datos 'hardcoded' /// </summary> public void Initialize() { try { materials.Load(System.Windows.Forms.Application.StartupPath + "\\RuntimeData\\default.mat"); if (materials[DefaultConcrete.Name] == null) materials[DefaultConcrete.Name] = DefaultConcrete; if (materials[DefaultSteel.Name] == null) materials[DefaultSteel.Name] = DefaultSteel; if (materials[DefaultRebar.Name] == null) materials[DefaultRebar.Name] = DefaultRebar; } catch (Exception) { // Reconstruir catálogo de materiales materials = new Catalog<Material>(); // defaultMaterial = new Material(Culture.Get("aluminumName"), false, new AluminumDesignProps(), new IsotropicTypeProps(69637054684.101F, 0.33F, 0.00002358F), 2.714F); // materials[DefaultMaterial.Name] = DefaultMaterial; // defaultMaterial = new Material(Culture.Get("coldFormedName"), false, new ColdFormedDesignProps(), new IsotropicTypeProps(2.03395357740716E+11F, 0.3F, 0.0000117F), 7.849F); // materials[DefaultMaterial.Name] = DefaultMaterial; /************ CONCRETE *************/ defaultConcrete = new Material("4000Psi", false, new ConcreteDesignProps(27579031.558F, 413685473.37F, 275790315.58F, false, 1.0F), new IsotropicTypeProps(24821128402.26F, 0.2F, 0.0000099F), 2403F); materials[defaultConcrete.Name] = DefaultConcrete; materials["3000Psi"] = new Material("3000Psi", false, new ConcreteDesignProps(20684273.67f, 413685473.37F, 275790315.58F, false, 1f), new IsotropicTypeProps(21530000000f, 0.2f, 0.0000099f), 2402.8f); // materials["4000Psi"] = new Material("4000Psi", false, new ConcreteDesignProps(27579031.56f, 413685473.37F, 275790315.58F, false, 1f), new IsotropicTypeProps(24860000000f, 0.2f, 0.0000099f), 2402.8f); materials["5000Psi"] = new Material("5000Psi", false, new ConcreteDesignProps(34473789.45f, 413685473.37F, 275790315.58F, false, 1f), new IsotropicTypeProps(27790000000f, 0.2f, 0.0000099f), 2402.8f); materials["6000Psi"] = new Material("6000Psi", false, new ConcreteDesignProps(41368547.34f, 413685473.37F, 275790315.58F, false, 1f), new IsotropicTypeProps(30440000000f, 0.2f, 0.0000099f), 2402.8f); //defaultSteel = new Material(Culture.Get("noMaterialName"), true, new NoDesignProps(), new IsotropicTypeProps(24821128402.26F, 0.2F, 0.0000099F), 2401F); //materials[DefaultSteel.Name] = DefaultSteel; /************ REBAR *************/ defaultRebar = new Material(Culture.Get("rebarName"), false, new RebarDesignProps(), new UniaxialTypeProps(1.99947978795958E+11F, 0.0000117F), 7849F); materials[defaultRebar.Name] = defaultRebar; /************ STEEL *************/ materials["A36"] = new Material("A36", false, new SteelDesignProps(248211284f, 399895958f), new IsotropicTypeProps(1.99947978795958E+11F, 0.3F, 0.0000117F), 7849F); defaultSteel = materials["A36"]; materials["A50"] = new Material("A50", false, new SteelDesignProps(379211684f, 427474989f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A500GrB42"] = new Material("A500GrB42", false, new SteelDesignProps(289579831.4f, 399895958f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A500GrB46"] = new Material("A500GrB46", false, new SteelDesignProps(317158863f, 399895958f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A53GrB"] = new Material("A53GrB", false, new SteelDesignProps(241316526.1f, 413685473f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A572Gr50"] = new Material("A572Gr50", false, new SteelDesignProps(344737894, 448159263f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A913Gr50"] = new Material("A913Gr50", false, new SteelDesignProps(344737894, 413685473f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials["A992Fy50"] = new Material("A992Fy50", false, new SteelDesignProps(344737894, 448159263f), new IsotropicTypeProps(1.999E+11f, 0.3f, 0.0000117f), 7849); materials.Save(System.Windows.Forms.Application.StartupPath + "\\RuntimeData\\default.mat"); //throw e; } }
private void store(OleDbConnection cn, Material obj) { MaterialTypeProps tProps = obj.TypeProperties; MaterialDesignProps dProps = obj.DesignProperties; double e, u, a; string type = ""; string design = (dProps is RebarDesignProps) ? "Rebar" : (dProps is ColdFormedDesignProps) ? "ColdFormed" : (dProps is SteelDesignProps) ? "Steel" : (dProps is ConcreteDesignProps) ? "Concrete" : (dProps is AluminumDesignProps) ? "Aluminum" : "None"; if (tProps is IsotropicTypeProps) { IsotropicTypeProps iProps = tProps as IsotropicTypeProps; type = "Isotropic"; e = iProps.E; u = iProps.Nu; a = iProps.Alpha; } else if (tProps is UniaxialTypeProps) { UniaxialTypeProps uProps = tProps as UniaxialTypeProps; type = "Uniaxial"; e = uProps.E; u = 0.0; a = uProps.A; } else { e = u = a = 0.0; type = (tProps is OrthotropicTypeProps) ? "Orthotropic" : "Anisotropic"; } string sql = "INSERT INTO [Material Properties 01 - General] " + "(Material,Type,DesignType,UnitMass,UnitWeight,E,U,A,MDampRatio,VDampMass,VDampStiff,HDampMass,HDampStiff,NumAdvance,Color) " + "VALUES (\"" + obj.Name + "\",\"" + type + "\",\"" + design + "\"," + obj.Density + "," + obj.UnitWeight + "," + e + "," + u + "," + a + ",0,0,0,0,0,0,\"Yellow\");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); store(cn, obj.Name, dProps); }
private void nextButton2_Click(object sender, EventArgs e) { if (currentSection == null) { currentMaterial = MaterialManager.Instance.Materials[materialComboBox.SelectedItem.ToString()]; string secName = nameTextBox.Text; ConcreteSectionProps cProps = (currentMaterial.DesignProperties is ConcreteDesignProps) ? concreteSectionProps[0] : null; if (shapeNames["R"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Rectangular(secName, currentMaterial, cProps, 0.2f, 0.4f); else if (shapeNames["RN"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Circle(secName, currentMaterial, cProps, 0.4f); //else if (shapeNames["2L"].Equals(shapeComboBox.SelectedItem.ToString())) // currentSection = new DoubleAngle(secName, "2L", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else if (shapeNames["C"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Channel(secName, "C", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else if (shapeNames["I"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new IWideFlange(secName, "C", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else if (shapeNames["B"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new BoxTube(secName, "B", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else if (shapeNames["P"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Pipe(secName, "P", currentMaterial, cProps, 0.2f, 0.02f); else if (shapeNames["L"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Angle(secName, "L", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else if (shapeNames["T"].Equals(shapeComboBox.SelectedItem.ToString())) currentSection = new Tee(secName, "T", currentMaterial, cProps, 0.2f, 0.2f, 0.02f, 0.02f); else currentSection = new General(secName, "G", currentMaterial, cProps, 0.2f, 0.2f, 0, 0, 0, 0, 0, 0.0043f, 9.65e-8f, 0.0000657f, 0.0000033f, 0.002f, 0.002f, 0.00043f, 0.000052f, 0.00049f, 0.000081f, 0.1241f, 0.0278f); } UpdateModel(1); if (currentSection.GetType().Name.Equals("General")) wizardControl.SelectTab(4); else wizardControl.SelectTab(2); //if (currentSection is Rectangular || currentSection is Circle) // wizardControl.SelectTab(2); //else // wizardControl.SelectTab(0); DialogResult = DialogResult.None; }
private void UpdatePage2() { if (currentSection != null && currentSection.Material != null) { currentMaterial = currentSection.Material; nameTextBox.Text = currentSection.Name; if (!materialComboBox.Items.Contains(currentSection.Material.Name)) materialComboBox.Items.Add(currentSection.Material.Name); materialComboBox.SelectedItem = currentSection.Material.Name; if (shapeNames.ContainsKey(currentSection.Shape)) shapeComboBox.SelectedItem = shapeNames[currentSection.Shape]; else shapeComboBox.SelectedItem = -1; shapeComboBox.Enabled = false; } else { UpdateShapeComboBox(); nameTextBox.Text = ""; nextButton2.Enabled = false; } }
private void materialsListBox_SelectedIndexChanged(object sender, EventArgs e) { material = (Material)materialsListBox.SelectedItem; UpdatePage1(); }
private void addButton_Click(object sender, EventArgs e) { currentMaterial = null; currentSection = null; wizardControl.SelectTab(1); }
public void UpdatePage1() { object selected = materialsListBox.SelectedItem; if (selected != null && selected is Material) material = (Material)selected; editButton.Enabled = (material != null && !material.IsLocked); deleteButton.Enabled = (material != null && !material.IsLocked); addButton.Enabled = true; }
private void writeColdFormedDesignProps(XmlTextWriter xml, Material mat) { MaterialDesignProps dProps = mat.DesignProperties; if (dProps is ColdFormedDesignProps) { ColdFormedDesignProps props = (ColdFormedDesignProps)dProps; xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("Fy", props.Fy.ToString()); xml.WriteAttributeString("Fu", props.Fu.ToString()); xml.WriteEndElement(); } }
private void writeRebarDesignProps(XmlWriter xml, Material.Material mat) { MaterialDesignProps dProps = mat.DesignProperties; if (dProps is RebarDesignProps) { RebarDesignProps props = (RebarDesignProps)dProps; xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("Fy", props.Fy.ToString()); xml.WriteAttributeString("Fu", props.Fu.ToString()); xml.WriteEndElement(); } }
private void writeMaterial(XmlTextWriter xml, Material mat) { MaterialTypeProps tProps = mat.TypeProperties; MaterialDesignProps dProps = mat.DesignProperties; double e, u, a; string type = ""; string design = (dProps is RebarDesignProps) ? "Rebar" : (dProps is ColdFormedDesignProps) ? "ColdFormed" : (dProps is SteelDesignProps) ? "Steel" : (dProps is ConcreteDesignProps) ? "Concrete" : (dProps is AluminumDesignProps) ? "Aluminum" : "None"; if (tProps is IsotropicTypeProps) { IsotropicTypeProps iProps = tProps as IsotropicTypeProps; type = "Isotropic"; e = iProps.E; u = iProps.Nu; a = iProps.Alpha; } else if (tProps is UniaxialTypeProps) { UniaxialTypeProps uProps = tProps as UniaxialTypeProps; type = "Uniaxial"; e = uProps.E; u = 0.0; a = uProps.A; } else { e = u = a = 0.0; type = (tProps is OrthotropicTypeProps) ? "Orthotropic" : "Anisotropic"; } xml.WriteStartElement("Material"); xml.WriteAttributeString("Material", mat.Name); xml.WriteAttributeString("Type", type); xml.WriteAttributeString("DesignType", design); xml.WriteAttributeString("UnitMass", mat.Density.ToString()); xml.WriteAttributeString("UnitWeight", mat.UnitWeight.ToString()); xml.WriteAttributeString("E", e.ToString()); xml.WriteAttributeString("U", u.ToString()); xml.WriteAttributeString("A", a.ToString()); xml.WriteAttributeString("MDampRatio", "0"); xml.WriteAttributeString("VDampMass", "0"); xml.WriteAttributeString("VDampStiff", "0"); xml.WriteAttributeString("HDampMass", "0"); xml.WriteAttributeString("HDampStiff", "0"); xml.WriteAttributeString("NumAdvance", "0"); xml.WriteAttributeString("Color", "Yellow"); xml.WriteEndElement(); }
private string GetNodeName(Material.Material mat) { return(mat.DesignProperties.Name); }