Using Helper Classes for Structural and Thermal Assets in BimRv

Evgeniy Tikhonov

November 14, 2019

You can use helper classes in ODA BimRv to create and manipulate physical and thermal properties of materials. The standard approach in .rvt files is to create a structural or thermal asset based on one of the structural classes or thermal types and then set it up for a material object. For example:

StructuralAsset sAsset = new StructuralAsset("Structural asset for concrete material", StructuralAssetClass.Concrete);
sAsset.Behavior = StructuralBehavior.Orthotropic;
sAsset.SetPoissonRatio(.5);
PropertySetElement propSetElem = PropertySetElement.Create(doc, sAsset);
material.StructuralAssetId = propSetElem.Id;

But in .rvt files the only way to access parameters of the asset is to access them through the PropertySetElement and Builtin parameters enumeration.

Parameter paramPoissonRatioX = propSetElem.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD1);
paramPoissonRatioX.Set(.6);
The helper classes

 

structure

 

ODA BimRv provides the helper class OdBmStructuralAssetHelper to register assets in the database and material, and then to access and manipulate the data of assets.

Note that transactions should be used to add and modify elements in a database. To use transactions, include the Database/BmTransaction.h header.

OdBmPropertySetElementPtr pPropSetElement = OdBmPropertySetElement::createObject();
  ODBM_TRANSACTION_BEGIN(t, pDbSrc)
    t.start();

    pDbSrc->addElement(pPropSetElement);
    OdBmStructuralAssetHelper structAssetHelper = OdBmStructuralAssetHelper(pPropSetElement);
    structAssetHelper.setStructuralAssetClass(OdBm::StructuralAssetClass::Metal);
    structAssetHelper.setName(L"Stainless Steel");
    structAssetHelper.setSubClass(L"Steel");
    structAssetHelper.setThermalExpansionCoefficient(OdGeVector3d(0.0000104, 0.0000104, 0.0000104));
    structAssetHelper.setBehavior(OdBm::StructuralBehavior::Isotropic);
    double dYoung = OdBmUnitUtils::convertToInternalUnits(193000., OdBm::DisplayUnitType::DUT_MEGAPASCALS);
    structAssetHelper.setYoungModulus(OdGeVector3d(dYoung, dYoung, dYoung));
    double dSheer = OdBmUnitUtils::convertToInternalUnits(86000., OdBm::DisplayUnitType::DUT_NEWTONS);
    structAssetHelper.setShearModulus(OdGeVector3d(dSheer, dSheer, dSheer));
    structAssetHelper.setPoissonModulus(OdGeVector3d(0.3, 0.3, 0.3));
    double dDensity = OdBmUnitUtils::convertToInternalUnits(8000., OdBm::DisplayUnitType::DUT_CUBIC_FEET);
    structAssetHelper.setDensity(dDensity);

    OdBmMaterialElemPtr pMaterialElem =
        pDbSrc->getObjectId(OdDbHandle(2349)).safeOpenObject();
    pMaterialElem->setStructuralAssetId(pPropSetElement->objectId());

  t.commit();
  ODBM_TRANSACTION_END();

The same works with the thermal asset helper OdBmThermalAssetHelper:

OdBmThermalAssetHelper thermalAssetHelper =
    OdBmThermalAssetHelper(pPropSetElement);
  thermalAssetHelper.setThermalClassType(OdBm::ThermalClassType::Solid);
  thermalAssetHelper.set…
  
  pMaterialElem->setThermalAssetId(objId);

Helpers can also be used to access properties of an existing element in a database.

OdBmDatabasePtr pDb = app->readFile(sTempFile);
    OdBmPropertySetElementPtr pMaterpPropSetElementialElem = pDbSrc->getObjectId(OdDbHandle(2350)).safeOpenObject();
    TEST_ASSERT(! pMaterpPropSetElementialElem.isNull());
    OdBmStructuralAssetHelper sAssetHelper = OdBmStructuralAssetHelper(pMaterpPropSetElementialElem);
OdString sName;
structAssetHelper.getName(sName);