BIM Link Example Implement BimApi Properties - idea-statica/ideastatica-public GitHub Wiki
For the RSTAB BimLink, we have defined four files which relate to materials:
Let's describe the RstabMaterialSteel.cs
file below.
- At the top of the file, there are references to the Rstab API as well as the IOM OpenModel.
- The Rstab API provides its own
IMaterial
objects from its API, which we then store on the object when we create the object. - Because of the way materials are defined in Rstab we need to add some additional methods to retrieve information about the material.
- The
GetData()
provides us access to the base material and gives us quick info such as name and id.
- The
- A property is provided to
get
IOM Steel Material. The getter calls the CreateMaterial() methods also defined in the class.- The CreateMaterial() Method 'provides' the IOM steel material relevant to the Code that has been provided through a series of switch statements. Each steel material is then created with the country code requirements.
- Within the
CreateMaterial()
method a call to the abstract Rstab Material class methodFillMaterialData(GetData(), matSteel)
fills the remaining common data of a material. - Minimum Properties of the IIdeaMaterialSteel are Material as well as Id and Name which are inherited from the IIdeaObject interface.
using Dlubal.RSTAB6;
using Dlubal.RSTAB8;
using IdeaRS.OpenModel;
using IdeaRS.OpenModel.Material;
using IdeaStatiCa.BimApi;
using IdeaStatiCa.Plugin;
using System;
namespace IdeaRstabPlugin.BimApi
{
/// <inheritdoc cref="IIdeaMaterialSteel"/>
internal class RstabMaterialSteel : RstabMaterial, IIdeaMaterialSteel
{
private readonly static IPluginLogger _logger = LoggerProvider.GetLogger("bim.rstab.bimapi"); //Logger
public string Id => $"material-steel-{GetData().No}";
public string Name
{
get
{
Utils.ParseMaterialTextID(GetData().TextID, out string name, out string _, out _);
return name;
}
}
public MatSteel Material => CreateMaterial();
private readonly IMaterial _material;
private readonly CountryCode _countryCode;
public RstabMaterialSteel(CountryCode countryCode, IMaterial material)
{
_countryCode = countryCode;
_material = material;
_logger.LogDebug($"Created {nameof(RstabMaterialSteel)} with id {Id}");
}
private Dlubal.RSTAB8.Material GetData()
{
return _material.GetData();
}
private MatSteel CreateMaterial()
{
MatSteel matSteel = null;
switch (_countryCode)
{
case CountryCode.ECEN:
matSteel = SetSteelEc2();
break;
case CountryCode.India:
matSteel = SetSteelIND();
break;
case CountryCode.SIA:
break;
case CountryCode.American:
matSteel = SetSteelAISC();
break;
case CountryCode.Canada:
matSteel = SetSteelCISC();
break;
case CountryCode.Australia:
matSteel = SetSteelAUS();
break;
case CountryCode.RUS:
matSteel = SetSteelRUS();
break;
case CountryCode.CHN:
matSteel = SetSteelCHN();
break;
case CountryCode.HKG:
matSteel = SetSteelHKG();
break;
default:
throw new NotImplementedException($"Unsupported country code {_countryCode}");
}
FillMaterialData(GetData(), matSteel);
return matSteel;
}
private MatSteelEc2 SetSteelEc2()
{
MatSteelEc2 material = new MatSteelEc2();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.fy40 = material.fy;
material.fu40 = material.fu;
return material;
}
private MatSteelIND SetSteelIND()
{
MatSteelIND material = new MatSteelIND();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.GammaOVfu = 1.25;
material.GammaOVfy = 1.25;
return material;
}
private MatSteelAISC SetSteelAISC()
{
MatSteelAISC material = new MatSteelAISC();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.fy40 = material.fy;
material.fu40 = material.fu;
return material;
}
private MatSteelCISC SetSteelCISC()
{
MatSteelCISC material = new MatSteelCISC();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
return material;
}
private MatSteelAUS SetSteelAUS()
{
MatSteelAUS material = new MatSteelAUS();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.PhiOMFu = 1.3;
material.PhiOMFy = 1.3;
return material;
}
private MatSteelRUS SetSteelRUS()
{
MatSteelRUS material = new MatSteelRUS();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.GammaM = 1.03;
return material;
}
private MatSteelHKG SetSteelHKG()
{
MatSteelHKG material = new MatSteelHKG();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.GammaOVfu = 1.25;
material.GammaOVfy = 1.25;
return material;
}
private MatSteelCHN SetSteelCHN()
{
MatSteelCHN material = new MatSteelCHN();
IrsMaterialDB2 matDb = (IrsMaterialDB2)_material.GetDatabaseMaterial();
material.fy = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fyk);
material.fu = matDb.rsGetProperty(DB_MAT_PROPERTY.MAT_PROP_fuk);
material.PhiOMFu = 1.1;
material.PhiOMFy = 1.1;
return material;
}
}
}
For quick reference, the RstabMaterial.cs
contents are shown below. This abstract class provides a method to fill the common material values across steel and concrete materials:
using IdeaRS.OpenModel.Material;
using IdeaStatiCa.BimApi;
namespace IdeaRstabPlugin.BimApi
{
/// <summary>
/// Abstract class for RSTAB implementations of <see cref="IIdeaMaterial"/>.
/// </summary>
internal abstract class RstabMaterial
{
/// <summary>
/// Gravitation acceleration
/// </summary>
private const double g = 10.0;
protected void FillMaterialData(Dlubal.RSTAB8.Material matRstab, IdeaRS.OpenModel.Material.Material matIom)
{
matIom.E = matRstab.ElasticityModulus;
matIom.G = matRstab.ShearModulus;
matIom.Poisson = matRstab.PoissonRatio;
// SpecificWeight is in N/m^3, UnitMass is kg/m^3
matIom.UnitMass = matRstab.SpecificWeight / g;
matIom.ThermalExpansion = matRstab.ThermalExpansion;
matIom.SpecificHeat = 0.6;
matIom.ThermalConductivity = 45;
matIom.StateOfThermalConductivity = ThermalConductivityState.Code;
matIom.StateOfThermalExpansion = ThermalExpansionState.Code;
matIom.StateOfThermalSpecificHeat = ThermalSpecificHeatState.Code;
matIom.StateOfThermalStressStrain = ThermalStressStrainState.Code;
}
}
}
For the RSTAB BimLink, we have defined the following files which relate to Cross-Sections:
Generally a
###CrossSectionByName
class would also be created here. Although RSTAB provides us the ability to define any cross-section either parametrically or by components, therefore, we do not require to fall back to a named conversion.
Two auxiliary classes are created under the model folder which represents component-based cross-sections:
The difference between cross-section generation and material generation is that the Material Interface has a property that generates the material based on the country code provided. Cross-sections are created using the CrossSectionFactory
. An associated utility CssHelperfactory
class is also created for cross-sections which help generate component-based cross-sections.
Each program deals with cross-sections differently. In order to create effective conversion of cross-sections from third-party software to IOM. Learn more about Crosssections in IOM here: IOM Cross-Section Properties