コード例 #1
0
        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());
        }
コード例 #2
0
        private readonly bool oneMaterial; // True if a material is provided.

        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());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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;
        }