convert_objects#
- dlubal.api.rfem.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
Usage
# Retrieve all objects form the IFC model
ifc_model_objects = rfem_app.get_object_list(
[rfem.ifc_objects.IfcModelObject()]
)
# Filter IFC objects to identify those that can be converted into e.g. straight members
straight_members = list()
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
rfem_app.convert_objects(
convert_into=rfem.ConvertObjectInto.CONVERT_IFC_OBJECT_INTO_STRAIGHT_MEMBER,
objects=straight_members,
)
// Retrieve all objects form the IFC model
var ifcObjectList = await RfemApp.get_object_list(
new List<IMessage> { new Rfem.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 Rfem.IfcObjects.IfcModelObject ifcModelObject)
{
string ifcType = ifcModelObject.IfcType;
if (ifcType == "IfcColumn" || ifcType == "IfcBeam")
{
members.Add(ifcModelObject);
}
}
}
// Convert the identified IFC objects into straight members
await RfemApp.convert_objects(
convertInto: Common.ConvertObjectInto.ConvertIfcObjectIntoStraightMember,
objs: members
);