Overview
Renga API allows you to edit the parameters of objects and styles. At the moment, you can edit all the parameters contained in ParameterIds. Parameters of STDL based styles are also available for editing.
To work with parameters use IParameterContainer interface. This interface can be directly obtained from object with IModelObject::GetParameters() method or as an additional interface of IEntity. Note that Renga only allows to edit project between IOperation::Start() and IOperation::Apply() calls. See examples below.
How to edit object parameter container
C++
auto pOperation = pProject->CreateOperation();
pOperation->Start();
for (int i = 0; i < pModelObjectCollection->Count; ++i)
{
auto pModelObject = pModelObjectCollection->GetByIndex(i);
{
auto pParameterContainer = pModelObject->GetParameters();
auto currentHeight = pHeightParameter->GetDoubleValue();
pHeightParameter->SetDoubleValue(currentHeight + 1000);
}
}
pOperation->Apply();
const GUID Wall
Wall object type.
Definition ObjectTypes.h:41
const GUID WallHeight
WallHeight.
Definition ParameterIds.h:140
C#
var operation = project.CreateOperation();
operation.Start();
var model = project.Model;
var modelObjectCollection = model.GetObjects();
int objectCount = modelObjectCollection.Count;
for (int i = 0; i < objectCount; ++i)
{
var modelObject = modelObjectCollection.GetByIndex(i);
if (modelObject.ObjectType == Renga.ObjectTypes.Wall)
{
var parameter = modelObject.GetParameters().Get(Renga.ParameterIds.WallHeight);
var currentHeight = parameter.GetDoubleValue();
parameter.SetDoubleValue(currentHeight + 1000);
}
}
operation.Apply();
How to edit style parameter container
C++
auto pOperation = pProject->CreateOperation();
pOperation->Start();
auto pPipeStyle = pProject->GetPipeStyles()->GetByIndex(0);
auto pParameters = Renga::IParameterContainerPtr{};
pPipeStyle->QueryInterface(&pParameters);
if (pParameters)
{
auto currentDiameter = pParameter->GetDoubleValue();
pParameter->SetDoubleValue(currentDiameter + 100);
}
pOperation->Apply();
const GUID MepPipeOuterDiameter
MepPipeOuterDiameter.
Definition ParameterIds.h:876
C#
var operation = project.CreateOperation();
operation.Start();
var pipeStyle = project.PipeStyles.GetByIndex(0);
var parameters = pipeStyle as Renga.IParameterContainer;
if (parameters != null)
{
var parameter = parameters.Get(Renga.ParameterIds.MepPipeOuterDiameter);
var currentDiameter = parameter.GetDoubleValue();
parameter.SetDoubleValue(currentDiameter + 100);
}
operation.Apply();
See also