Ejemplo n.º 1
0
        /// <summary>
        /// Create a new SectionProfile based on a string description.
        /// </summary>
        /// <param name="description"></param>
        /// <param name="catalogue"></param>
        /// <returns></returns>
        public static SectionProfile FromDescription(string description, SectionProfileLibrary catalogue = null)
        {
            if (catalogue != null)
            {
                // Check in catalogue:
                SectionProfile profile = catalogue.GetByCatalogueName(description);
                if (profile != null)
                {
                    return(profile.Duplicate());
                }
            }

            string[] tokens = description.Split(' ');
            if (tokens.Length > 1)
            {
                switch (tokens[0].Trim().ToUpper())
                {
                case "I":
                    return(new SymmetricIProfile(tokens[1]));

                case "T":
                    return(new TProfile(tokens[1]));

                case "A":
                    return(new AngleProfile(tokens[1]));

                case "CIRC":
                    return(new CircularProfile(tokens[1]));

                case "CHS":
                    return(new CircularHollowProfile(tokens[1]));

                case "RECT":
                    return(new RectangularProfile(tokens[1]));

                case "RHS":
                    return(new RectangularProfile(tokens[1]));
                }
                throw new NotImplementedException("The specified section profile description could not be parsed successfully."); //If we're here, we haven't caught the case
            }

            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Read a model from a GWA syntax text file
        /// </summary>
        /// <returns></returns>
        public Model.Model ReadGWAFile(FilePath filePath, ref GSAIDMappingTable idMap, GSAConversionOptions options = null, SectionProfileLibrary sectLib = null)
        {
            if (idMap == null)
            {
                idMap = new GSAIDMappingTable();
            }
            if (options == null)
            {
                options = new GSAConversionOptions();
            }
            var context = new GSAConversionContext(idMap, options, sectLib);

            return(ReadGWAFile(filePath, context));
        }
Ejemplo n.º 3
0
 public GSAConversionContext(GSAIDMappingTable idMap, GSAConversionOptions options, SectionProfileLibrary sectLib = null)
 {
     IDMap          = idMap;
     Options        = options;
     SectionLibrary = sectLib;
 }