convert_objects#
- dlubal.api.rstab.Application.convert_objects(self, *, convert_into, objs, model_id=None)#
- Converts specified objects into a different type. - Parameters:
- convert_into (ConvertObjectInto) – Specifies the target conversion type. 
- objs (list) – Objects to be converted. 
- model_id (ModelId | None) – Unique identifier of the model. If None, the active model is used. 
 
- Returns:
- None 
 
Method Type: Core
Usage
# Retrieve all objects form the IFC model
ifc_model_objects = rstab_app.get_object_list(
    [rstab.ifc_objects.IfcModelObject()]
)
straight_members = list()
# Filter IFC objects to identify those that can be converted into e.g. straight members
for ifc_object in ifc_model_objects:
    ifc_type = ifc_object.ifc_type
    if ifc_type in ["IfcColumn", "IfcBeam"]:
        straight_members.append(ifc_object)
# Convert the identified IFC objects into straight members
rstab_app.convert_objects(
    convert_into=rstab.ConvertObjectInto.CONVERT_IFC_OBJECT_INTO_STRAIGHT_MEMBER,
    objects=straight_members,
)
// Retrieve all objects form the IFC model
var ifcObjectList = await RstabApp.get_object_list(
    new List<IMessage> { new Rstab.IfcObjects.IfcModelObject { } }
);
// Filter IFC objects to identify those that can be converted into e.g. straight members
List<IMessage> members = new List<IMessage>();
foreach (var ifcObject in ifcObjectList)
{
    if (ifcObject is Rstab.IfcObjects.IfcModelObject ifcModelObject)
    {
        string ifcType = ifcModelObject.IfcType;
        if (ifcType == "IfcColumn" || ifcType == "IfcBeam")
        {
            members.Add(ifcModelObject);
        }
    }
}
// Convert the identified IFC objects into straight members
await RstabApp.convert_objects(
    convertInto: Common.ConvertObjectInto.ConvertIfcObjectIntoStraightMember,
    objs: members
);