v2.2
How to work with object reinforcement

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 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);
// TODO: Some actions with quantities
auto pRebarStyle = pReinforcementManager->GetRebarStyle(pRebarUsage->StyleId);
// TODO: Work with rebar style
}
}

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);
// TODO: Some actions with quantities
var rebarStyle = reinforcementManager.GetRebarStyle(rebarUsage.StyleId);
// TODO: Work with rebar style
}
}

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);
// TODO: Work with reinforcement unit style
auto unitsCountQuantity = pUnitUsage->GetQuantities()->Get(Renga::QuantityIds::ReinforcementUnitCount);
// TODO: Some actions with quantities
}
}

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);
// TODO: Work with reinforcement unit style
var unitsCountQuantity = unitUsage.GetQuantities().Get(Renga.QuantityIds.ReinforcementUnitCount);
// TODO: Some actions with quantities
}
}

See also

Related samples

  • ObjectReinforcement