private bool SetObject(IMaterialFragment material) { bool success = true; if (material is IIsotropic) { IIsotropic isotropic = material as IIsotropic; success &= m_model.PropMaterial.SetMPIsotropic(material.DescriptionOrName(), isotropic.YoungsModulus, isotropic.PoissonsRatio, isotropic.ThermalExpansionCoeff) == 0; } else if (material is IOrthotropic) { IOrthotropic orthoTropic = material as IOrthotropic; if (CheckPropertyWarning(orthoTropic, x => x.YoungsModulus) && CheckPropertyWarning(orthoTropic, x => x.PoissonsRatio) && CheckPropertyWarning(orthoTropic, x => x.ThermalExpansionCoeff) && CheckPropertyWarning(orthoTropic, x => x.ShearModulus)) { double[] e = orthoTropic.YoungsModulus.ToDoubleArray(); double[] v = orthoTropic.PoissonsRatio.ToDoubleArray(); double[] a = orthoTropic.ThermalExpansionCoeff.ToDoubleArray(); double[] g = orthoTropic.ShearModulus.ToDoubleArray(); success &= m_model.PropMaterial.SetMPOrthotropic(material.DescriptionOrName(), ref e, ref v, ref a, ref g) == 0; } else { success = false; } } success &= m_model.PropMaterial.SetWeightAndMass(material.DescriptionOrName(), 2, material.Density) == 0; SetAdapterId(material, material.Name); return(success); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private bool CreateObject(IMaterialFragment material) { bool success = true; eMatType matType = material.GetMaterialType(); string bhName = material.DescriptionOrName(); int color = 0; string guid = null; string notes = ""; string name = ""; SAP2000Id sap2000id = new SAP2000Id(); if (m_model.PropMaterial.AddMaterial(ref name, matType, "United States", bhName, bhName, guid) == 0) //try to get the material from a dataset { sap2000id.Id = name; } else if (m_model.PropMaterial.SetMaterial(bhName, matType, color, notes, guid) == 0) //create the material { sap2000id.Id = bhName; SetObject(material); } else { CreateElementError("Material", bhName); } SetAdapterId(material, sap2000id); return(success); }
/***************************************************/ private bool SetProfile(FabricatedBoxProfile profile, string sectionName, IMaterialFragment material) { if (profile.TopFlangeThickness != profile.BotFlangeThickness) { Engine.Base.Compute.RecordWarning($"Different thickness of top and bottom flange is not supported in ETABS. Section named {sectionName} pushed to ETABS is using the top thickness for both flanges."); } return(m_model.PropFrame.SetTube(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.TopFlangeThickness, profile.WebThickness) == 0); }
/***************************************************/ private bool SetProfile(ChannelProfile profile, string sectionName, IMaterialFragment material) { bool success = m_model.PropFrame.SetChannel(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.FlangeWidth, profile.FlangeThickness, profile.WebThickness) == 0; if (success && profile.MirrorAboutLocalZ) { RecordFlippingError(sectionName); } return(success); }
/***************************************************/ private bool SetProfile(TSectionProfile profile, string sectionName, IMaterialFragment material) { if (material is Steel || material is Aluminium) { return(m_model.PropFrame.SetSteelTee(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness, profile.RootRadius, profile.MirrorAboutLocalY) == 0); } else if (material is Concrete) { return(m_model.PropFrame.SetConcreteTee(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness, profile.WebThickness, profile.MirrorAboutLocalY) == 0); } else { bool success = m_model.PropFrame.SetTee(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness) == 0; if (success && profile.MirrorAboutLocalY) { RecordFlippingError(sectionName); } return(success); } }
/***************************************************/ /*** Create Methods ***/ /***************************************************/ private bool CreateObject(IMaterialFragment material) { bool success = true; eMatType matType = eMatType.NoDesign; int colour = 0; string guid = null; string notes = ""; string name = ""; if (m_model.PropMaterial.GetMaterial(material.DescriptionOrName(), ref matType, ref colour, ref notes, ref guid) != 0) { m_model.PropMaterial.AddMaterial(ref name, MaterialTypeToCSI(material.IMaterialType()), "", "", ""); m_model.PropMaterial.ChangeName(name, material.DescriptionOrName()); success &= SetObject(material); } if (!success) { Engine.Base.Compute.RecordWarning($"Failed to assign material: {material.DescriptionOrName()}, ETABS may have overwritten some properties with default values"); } return(success); }
private bool SetObject(IMaterialFragment material) { bool success = true; string bhName = material.DescriptionOrName(); if (material is IIsotropic) { IIsotropic isotropic = material as IIsotropic; if (m_model.PropMaterial.SetMPIsotropic(bhName, isotropic.YoungsModulus, isotropic.PoissonsRatio, isotropic.ThermalExpansionCoeff) != 0) { CreatePropertyWarning("Isotropy", "Material", bhName); } } else if (material is IOrthotropic) { IOrthotropic orthoTropic = material as IOrthotropic; double[] e = orthoTropic.YoungsModulus.ToDoubleArray(); double[] v = orthoTropic.PoissonsRatio.ToDoubleArray(); double[] a = orthoTropic.ThermalExpansionCoeff.ToDoubleArray(); double[] g = orthoTropic.ShearModulus.ToDoubleArray(); if (m_model.PropMaterial.SetMPOrthotropic(bhName, ref e, ref v, ref a, ref g) != 0) { CreatePropertyWarning("Orthotropy", "Material", bhName); } } // Set Material Strengths eMatType matType = MaterialTypeToCSI(material.IMaterialType()); switch (matType) { case eMatType.Aluminum: Engine.Base.Compute.RecordWarning("BHoM material aluminum does not have SAP2000 material parameters yet."); break; case eMatType.Steel: // try/catch for casting to steel? Steel steel = material as Steel; if (m_model.PropMaterial.SetOSteel_1(bhName, steel.YieldStress, steel.UltimateStress, steel.YieldStress, steel.UltimateStress, 0, 0, 0, 0, 0, 0, 0) != 0) { CreatePropertyWarning("YieldStress", "Material", bhName); CreatePropertyWarning("UltimateStress", "Material", bhName); } break; case eMatType.Concrete: Concrete concrete = material as Concrete; // name as NW/LW? if (m_model.PropMaterial.SetOConcrete_2(bhName, concrete.CylinderStrength, concrete.CylinderStrength, false, 0, 0, 0, 0, 0, 0) != 0) { CreatePropertyWarning("ConcreteStrength", "Material", bhName); } break; case eMatType.Rebar: Steel reinf = material as Steel; if (m_model.PropMaterial.SetORebar_1(bhName, reinf.YieldStress, reinf.UltimateStress, reinf.YieldStress, reinf.UltimateStress, 0, 0, 0, 0, 0, false) != 0) { CreatePropertyWarning("YieldStress", "Material", bhName); CreatePropertyWarning("UltimateStress", "Material", bhName); } break; case eMatType.Tendon: Steel tendon = material as Steel; if (m_model.PropMaterial.SetOTendon_1(bhName, tendon.YieldStress, tendon.UltimateStress, 0, 0, 0) != 0) { CreatePropertyWarning("YieldStress", "Material", bhName); CreatePropertyWarning("UltimateStress", "Material", bhName); } break; default: Engine.Base.Compute.RecordWarning("BHoM material type not found, no additional design material parameters passed to SAP2000."); m_model.PropMaterial.SetONoDesign(bhName, 0, 0, 0); break; } if (m_model.PropMaterial.SetWeightAndMass(bhName, 2, material.Density) != 0) { CreatePropertyWarning("Density", "Material", bhName); } SetAdapterId(material, material.Name); return(success); }
/***************************************************/ /**** 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); }
/***************************************************/ private bool SetProfile(CircleProfile profile, string sectionName, IMaterialFragment material) { return(m_model.PropFrame.SetCircle(sectionName, material?.DescriptionOrName() ?? "", profile.Diameter) == 0); }
/***************************************************/ private bool SetProfile(RectangleProfile profile, string sectionName, IMaterialFragment material) { return(m_model.PropFrame.SetRectangle(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width) == 0); }
/***************************************************/ private bool SetProfile(FabricatedISectionProfile profile, string sectionName, IMaterialFragment material) { return(m_model.PropFrame.SetISection(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.TopFlangeWidth, profile.TopFlangeThickness, profile.WebThickness, profile.BotFlangeWidth, profile.BotFlangeThickness) == 0); }
/***************************************************/ private bool SetProfile(BoxProfile profile, string sectionName, IMaterialFragment material) { return(m_model.PropFrame.SetTube(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.Thickness, profile.Thickness) == 0); }
/***************************************************/ private bool SetProfile(TubeProfile profile, string sectionName, IMaterialFragment material) { return(m_model.PropFrame.SetPipe(sectionName, material?.DescriptionOrName() ?? "", profile.Diameter, profile.Thickness) == 0); }