v2.37
 
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 reinforcement 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);
// Your code here
auto pRebarStyle = pReinforcementManager->GetRebarStyle(pRebarUsage->StyleId);
// 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);
// Your code here
var rebarStyle = reinforcementManager.GetRebarStyle(rebarUsage.StyleId);
// 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);
// Work with reinforcement unit style
auto unitsCountQuantity = pUnitUsage->GetQuantities()->Get(Renga::QuantityIds::ReinforcementUnitCount);
// Your code here
}
}

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);
// Work with reinforcement unit style
var unitsCountQuantity = unitUsage.GetQuantities().Get(Renga.QuantityIds.ReinforcementUnitCount);
// Your code here
}
}

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();
// Your code here
auto pPlacements = pRebarUsage->GetPlacements();
// Your code here
}
}

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();
// Your code here
var placements = rebarUsage.GetPlacements();
// Your code here
}
}

See also

Related samples

  • ObjectReinforcement