Пример #1
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());
        }
Пример #2
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);
        }