The standard way to handle different types of physical assets in an .rvt file (both structural and thermal) is to:
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;
However, this approach restricts access to the asset's parameters to either PropertySetElement
or with the built-in parameter enumeration:
Parameter paramPoissonRatioX = propSetElem.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD1);
paramPoissonRatioX.Set(.6);
Instead of the standard approach, BimRv provides a set of helper classes that help create and manipulate the physical and thermal properties of materials.
An alternative way to create and manipulate physical assets is to use the special helper classes in the picture below:
The OdBmStructuralAssetHelper
and OdBmThermalAssetHelper
classes implement the following functions:
The next code fragments illustrate how to use structural and thermal helper classes respectively.
When considering the source code, note that the modification of elements in a database requires using a database transaction mechanism.
This means that before starting modifications, the transaction should be started,
and after the last modification, it must be committed to store changes in the BimRv database.
To access the transaction handling mechanism in your custom applications, include the
Database/BmTransaction.h
header file.
Using an OdBmStructuralAssetHelper
instance:
OdBmPropertySetElementPtr pPropSetElement = OdBmPropertySetElement::createObject();
pDb->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., OdBmUnitTypeId::kMegapascals);
structAssetHelper.setYoungModulus(OdGeVector3d(dYoung, dYoung, dYoung));
double dSheer = OdBmUnitUtils::convertToInternalUnits(86000., OdBmUnitTypeId::kNewtons);
structAssetHelper.setShearModulus(OdGeVector3d(dSheer, dSheer, dSheer));
structAssetHelper.setPoissonModulus(OdGeVector3d(0.3, 0.3, 0.3));
double dDensity = OdBmUnitUtils::convertToInternalUnits(8000., OdBmUnitTypeId::kCubicFeet);
structAssetHelper.setDensity(dDensity);
OdInt32 handle = pIO->getInt("Enter handle of a OdBmMaterialElem:", OdEd::kInpDefault, -1);
if (handle < 0)
{
pIO->putString(OD_T("Invalid handle"));
return;
}
OdBmMaterialElemPtr pMaterialElem_2 =
pDb->getObjectId(OdDbHandle(handle)).safeOpenObject();
if (pMaterialElem_2.isNull())
{
message.format(L"Invalid handle.");
pIO->putString(message);
return;
}
pMaterialElem_2->setStructuralAssetId(pPropSetElement->objectId());
OdBmThermalAssetHelper thermalAssetHelper = OdBmThermalAssetHelper(pPropSetElement);
thermalAssetHelper.setThermalMaterialType(OdBm::ThermalMaterialType::Solid);
//set needed asset parameters
pMaterialElem_2->setThermalAssetId(pPropSetElement->objectId());
handle = pIO->getInt("Enter handle of a OdBmPropertySetElement:", OdEd::kInpDefault, -1);
if (handle < 0)
{
pIO->putString(OD_T("Invalid handle"));
return;
}
OdBmPropertySetElementPtr pMaterpPropSetElementialElem = pDb->getObjectId(OdDbHandle(2874)).safeOpenObject();
if (pMaterpPropSetElementialElem.isNull())
{
message.format(L"Invalid handle");
pIO->putString(message);
return;
}
OdBmStructuralAssetHelper sAssetHelper = OdBmStructuralAssetHelper(pMaterpPropSetElementialElem);
OdString sName;
structAssetHelper.getName(sName);
Using an OdBmThermalAssetHelper
object:
OdBmThermalAssetHelper thermalAssetHelper = OdBmThermalAssetHelper(pPropSetElement);
thermalAssetHelper.setThermalMaterialType(OdBm::ThermalMaterialType::Solid);
//set needed asset parameters
pMaterialElem_2->setThermalAssetId(pPropSetElement->objectId());
Helper classes also allow you to access properties of database-resident elements:
OdBmPropertySetElementPtr pMaterpPropSetElementialElem = pDb->getObjectId(OdDbHandle(2874)).safeOpenObject();
if (pMaterpPropSetElementialElem.isNull())
{
message.format(L"Invalid handle");
pIO->putString(message);
return;
}
OdBmStructuralAssetHelper sAssetHelper = OdBmStructuralAssetHelper(pMaterpPropSetElementialElem);
OdString sName;
structAssetHelper.getName(sName);
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|