/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static IMaterialFragment FromRFEM(this rf.Material material) { IMaterialFragment bhMaterial = null; string[] stringArr = material.TextID.Split('@'); MaterialType matType = material.GetMaterialType();// Engine.Adapters.RFEM.Query.GetMaterialType(material); string matName = Engine.Adapters.RFEM.Query.GetMaterialName(material); switch (matType) { case MaterialType.Aluminium: bhMaterial = Engine.Structure.Create.Aluminium(matName); break; case MaterialType.Steel: bhMaterial = Engine.Structure.Create.Steel(matName); break; case MaterialType.Concrete: bhMaterial = Engine.Structure.Create.Concrete(matName); break; case MaterialType.Timber: //TODO: as this uses vector over double assumption is the the below turns Timber into an incorrect Isotropic material !!! BH.oM.Geometry.Vector young = new oM.Geometry.Vector() { X = material.ElasticityModulus, Y = material.ElasticityModulus, Z = material.ElasticityModulus }; BH.oM.Geometry.Vector poissons = new oM.Geometry.Vector() { X = material.PoissonRatio, Y = material.PoissonRatio, Z = material.PoissonRatio }; BH.oM.Geometry.Vector shear = new oM.Geometry.Vector() { X = material.ShearModulus, Y = material.ShearModulus, Z = material.ShearModulus }; BH.oM.Geometry.Vector thermal = new oM.Geometry.Vector() { X = material.ThermalExpansion, Y = material.ThermalExpansion, Z = material.ThermalExpansion }; bhMaterial = Engine.Structure.Create.Timber(matName, young, poissons, shear, thermal, material.SpecificWeight, 0.05); break; case MaterialType.Rebar: case MaterialType.Tendon: case MaterialType.Glass: case MaterialType.Cable: case MaterialType.Undefined: default: break; } bhMaterial.SetAdapterId(typeof(RFEMId), material.No); return(bhMaterial); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFAttribute CreateMaterial(IMaterialFragment material) { IFAttribute lusasMaterial = null; if (material is IIsotropic) { IIsotropic isotropic = material as IIsotropic; if (d_LusasData.existsAttribute("Material", material.DescriptionOrName())) { lusasMaterial = d_LusasData.getAttribute("Material", material.DescriptionOrName()); } else { if (CheckPropertyWarning(isotropic, x => x.YoungsModulus) && CheckPropertyWarning(isotropic, x => x.PoissonsRatio) && CheckPropertyWarning(isotropic, x => x.ThermalExpansionCoeff) && CheckPropertyWarning(isotropic, x => x.Density)) { lusasMaterial = d_LusasData.createIsotropicMaterial(material.DescriptionOrName(), isotropic.YoungsModulus, isotropic.PoissonsRatio, isotropic.Density, isotropic.ThermalExpansionCoeff); } } } else if (material is IOrthotropic) { IOrthotropic orthotropic = material as IOrthotropic; if (d_LusasData.existsAttribute("Material", material.DescriptionOrName())) { lusasMaterial = d_LusasData.getAttribute("Material", material.DescriptionOrName()); } else { if (CheckPropertyWarning(orthotropic, x => x.YoungsModulus) && CheckPropertyWarning(orthotropic, x => x.PoissonsRatio) && CheckPropertyWarning(orthotropic, x => x.ThermalExpansionCoeff) && CheckPropertyWarning(orthotropic, x => x.ShearModulus) && CheckPropertyWarning(orthotropic, x => x.Density)) { lusasMaterial = d_LusasData.createOrthotropicAxisymmetricMaterial(material.DescriptionOrName(), orthotropic.YoungsModulus.X, orthotropic.YoungsModulus.Y, orthotropic.YoungsModulus.Z, orthotropic.ShearModulus.X, orthotropic.PoissonsRatio.X, orthotropic.PoissonsRatio.Y, orthotropic.PoissonsRatio.Z, 0.0, orthotropic.Density, 0.0); lusasMaterial.setValue("ax", orthotropic.ThermalExpansionCoeff.X); lusasMaterial.setValue("ay", orthotropic.ThermalExpansionCoeff.Y); lusasMaterial.setValue("az", orthotropic.ThermalExpansionCoeff.Z); lusasMaterial.setValue("axy", System.Math.Sqrt(System.Math.Pow(orthotropic.ThermalExpansionCoeff.X, 2) + System.Math.Pow(orthotropic.ThermalExpansionCoeff.Y, 2))); } } } if (lusasMaterial != null) { int adapterIdName = lusasMaterial.getID(); material.SetAdapterId(typeof(LusasId), adapterIdName); return(lusasMaterial); } return(null); }