public static string GetMaterialType(IMaterialFragment material) { Type materialType = material.GetType(); if (materialType == typeof(Aluminium)) { return("TypeID|ALUMINIUM"); } if (materialType == typeof(Steel)) { return("TypeID|STEEL"); } if (materialType == typeof(Concrete)) { return("TypeID|CONCRETE"); } if (materialType == typeof(Timber)) { return("TypeID|TIMBER"); } else { return(null); } }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static rf.Material ToRFEM(this IMaterialFragment materialFragment, int materialId) { //Example: NameID|Steel S 235@TypeID|STEEL@StandardID|DIN EN 1993-1-1-10 rf.Material rfMaterial = new rf.Material(); rfMaterial.No = materialId; rfMaterial.Description = materialFragment.Name; rfMaterial.SpecificWeight = materialFragment.Density * 10; //translate from kg/m3 to kN/m3 if (materialFragment.GetType() == typeof(Aluminium)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | ALUMINIUM" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Steel)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Concrete)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | CONCRETE" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(GenericIsotropicMaterial)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Timber)) { //TODO: this looks like orthotropic is turned into isotropic !!! IOrthotropic material = materialFragment as IOrthotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff.X; rfMaterial.PoissonRatio = material.PoissonsRatio.Y; rfMaterial.ElasticityModulus = material.YoungsModulus.Z; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | TIMBER" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(GenericOrthotropicMaterial)) { IOrthotropic material = materialFragment as IOrthotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff.X; rfMaterial.PoissonRatio = material.PoissonsRatio.Y; rfMaterial.ElasticityModulus = material.YoungsModulus.Z; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | TIMBER" + "@StandardID | No norm set!"; } else { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; Engine.Base.Compute.RecordWarning("Cannot make " + materialFragment.Name + ". Replaced with standard steel"); rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } return(rfMaterial); }