Overview
Reinforcement of a model object is described by IObjectReinforcementModel interface. This interface describes what styles of rebars and reinfrocement units are used in an object. Use IRebarUsage and IReinforcementUnitUsage interfaces to determine what styles are used and to get their geometry and quantities, such as total rebar length, etc. You can learn more about objects reinforcement in Renga help.
How to browse rebars and get their quantities from an object
The code below demonstrates how to browse rebar styles, get total rebar length and total rebar mass for each rebar style used in the object.
C++
void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager)
{
Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr);
pModelObject->QueryInterface(&pReinforcementModel);
auto pRebarUsages = pReinforcementModel->GetRebarUsages();
int rebarUsageCount = pRebarUsages->GetCount();
for (int i = 0; i < rebarUsageCount; ++i)
{
auto pRebarUsage = pRebarUsages->Get(i);
auto pTotalLengthQuantity = pRebarUsage->GetQuantities()->Get(Renga::QuantityIds::TotalRebarLength);
auto pTotalMassQuantity = pRebarUsage->GetQuantities()->Get(Renga::QuantityIds::TotalRebarMass);
auto pRebarStyle = pReinforcementManager->GetRebarStyle(pRebarUsage->StyleId);
}
}
C#
public void browseObjectRebars(Renga.IModelObject modelObject, Renga.IReinforcementUnitStyleManager reinforcementManager)
{
var reinforcementModel = modelObject as Renga.IObjectReinforcementModel;
var rebarUsages = reinforcementModel.GetRebarUsages();
int rebarUsageCount = rebarUsages.Count;
for (int i = 0; i < rebarUsageCount; ++i)
{
var rebarUsage = rebarUsages.Get(i);
var totalLengthQuantity = rebarUsage.GetQuantities().Get(Renga.QuantityIds.TotalRebarLength);
var totalMassQuantity = rebarUsage.GetQuantities().Get(Renga.QuantityIds.TotalRebarMass);
var rebarStyle = reinforcementManager.GetRebarStyle(rebarUsage.StyleId);
}
}
How to browse reinforcement units and get their quantities from an object
The code below demonstrates how to browse reinforcement unit styles, get units count, total rebar length and total rebar mass for each unit style used in the object.
C++
void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager)
{
Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr);
pModelObject->QueryInterface(&pReinforcementModel);
auto pUnitUsages = pReinforcementModel->GetReinforcementUnitUsages();
int unitUsageCount = pUnitUsages->GetCount();
for (int i = 0; i < unitUsageCount; ++i)
{
auto pUnitUsage = pUnitUsages->Get(i);
auto pUnitStyle = pReinforcementManager->GetUnitStyle(pUnitUsage->StyleId);
auto unitsCountQuantity = pUnitUsage->GetQuantities()->Get(Renga::QuantityIds::ReinforcementUnitCount);
}
}
C#
public void browseObjectReinforcementUnits(Renga.IModelObject modelObject, Renga.IReinforcementUnitStyleManager reinforcementManager)
{
var reinforcementModel = modelObject as Renga.IObjectReinforcementModel;
var unitUsages = reinforcementModel.GetReinforcementUnitUsages();
int unitUsageCount = unitUsages.Count;
for (int i = 0; i < unitUsageCount; ++i)
{
var unitUsage = unitUsages.Get(i);
var reinforcementUnitStyle = reinforcementManager.GetUnitStyle(unitUsage.StyleId);
var unitsCountQuantity = unitUsage.GetQuantities().Get(Renga.QuantityIds.ReinforcementUnitCount);
}
}
How to get reinforcement geometry of an object
The code below demonstrates how to get reinforcement geometry.
C++
void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager)
{
Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr);
pModelObject->QueryInterface(&pReinforcementModel);
auto pRebarUsages = pReinforcementModel->GetRebarUsages();
int rebarUsageCount = pRebarUsages->GetCount();
for (int i = 0; i < rebarUsageCount; ++i)
{
auto pRebarUsage = pRebarUsages->Get(i);
auto pGeometry = pRebarUsage->GetRebarGeometry();
auto pPlacements = pRebarUsage->GetPlacements();
}
}
C#
public void browseObjectRebars(Renga.IModelObject modelObject, Renga.IReinforcementUnitStyleManager reinforcementManager)
{
var reinforcementModel = modelObject as Renga.IObjectReinforcementModel;
var rebarUsages = reinforcementModel.GetRebarUsages();
int rebarUsageCount = rebarUsages.Count;
for (int i = 0; i < rebarUsageCount; ++i)
{
var rebarUsage = rebarUsages.Get(i);
var geometry = rebarUsage.GetRebarGeometry();
var placements = rebarUsage.GetPlacements();
}
}
See also
Related samples