コード例 #1
0
        public void LoadXmlSections(string filePath, Catalog <Section> cat)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);

                XmlNode sections = doc.SelectSingleNode("//Frame_Section_Properties_01_-_General");
                if (sections != null)
                {
                    XmlNodeList instances = sections.SelectNodes("SectionName");

                    List <string> knownTemplates = new List <string>(new string[] { "Double Angle", "Channel", "I/Wide Flange", "Box/Tube", "Pipe", "Angle", "Tee" });
                    if (instances != null && instances.Count > 0)
                    {
                        foreach (XmlNode node in instances)
                        {
                            string  temp = CustomSection.readAttribute(node, "Shape", "");
                            Section sec  = null;
                            if (knownTemplates.Contains(temp))
                            {
                                sec = NewSection(Material.MaterialManager.Instance.DefaultSteel, null, LoadXmlVariables(node));
                            }
                            else
                            {
                                sec = new CustomSection(node);
                            }

                            if (sec != null)
                            {
                                cat[sec.Name] = sec;
                            }
                        }
                    }
                }

                Canguro.Model.Serializer.Deserializer deserializer = new Canguro.Model.Serializer.Deserializer(Model.Instance);
                XmlNode beams = doc.SelectSingleNode("//Frame_Section_Properties_03_-_Concrete_Beam");
                if (beams != null)
                {
                    deserializer.readFrameConcreteBeams(beams, cat);
                }
                XmlNode columns = doc.SelectSingleNode("//Frame_Section_Properties_02_-_Concrete_Column");
                if (columns != null)
                {
                    deserializer.readFrameConcreteColumns(columns, cat);
                }
            }
            catch
            {
                MessageBox.Show(Culture.Get("WrongXsecFile") + ": " + filePath, Culture.Get("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public void LoadXmlSections(string filePath, Catalog<Section> cat)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);

                XmlNode sections = doc.SelectSingleNode("//Frame_Section_Properties_01_-_General");
                if (sections != null)
                {
                    XmlNodeList instances = sections.SelectNodes("SectionName");

                    List<string> knownTemplates = new List<string>(new string[] { "Double Angle", "Channel", "I/Wide Flange", "Box/Tube", "Pipe", "Angle", "Tee" });
                    if (instances != null && instances.Count > 0)
                    {
                        foreach (XmlNode node in instances)
                        {
                            string temp = CustomSection.readAttribute(node, "Shape", "");
                            Section sec = null;
                            if (knownTemplates.Contains(temp))
                                sec = NewSection(Material.MaterialManager.Instance.DefaultSteel, null, LoadXmlVariables(node));
                            else
                                sec = new CustomSection(node);

                            if (sec != null)
                                cat[sec.Name] = sec;
                        }
                    }
                }

                Canguro.Model.Serializer.Deserializer deserializer = new Canguro.Model.Serializer.Deserializer(Model.Instance);
                XmlNode beams = doc.SelectSingleNode("//Frame_Section_Properties_03_-_Concrete_Beam");
                if (beams != null)
                    deserializer.readFrameConcreteBeams(beams, cat);
                XmlNode columns = doc.SelectSingleNode("//Frame_Section_Properties_02_-_Concrete_Column");
                if (columns != null)
                    deserializer.readFrameConcreteColumns(columns, cat);
            }
            catch
            {
                MessageBox.Show(Culture.Get("WrongXsecFile") + ": " + filePath, Culture.Get("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }