import_model_from#
- dlubal.api.rfem.Application.import_model_from(self, *, filepath, import_attributes, model_id=None)#
Imports model from the specified file
- Parameters:
filepath (str) – Path to the file to be imported
import_attributes (google.protobuf.any_pb2.Any) –
Specifies the format and attributes of the import.
- Supported message types:
rfem_import_attributes_IfcImportAttributes
model_id (ModelId | None) – Unique identifier of the model. If not specified, the active model is used.
Example
# Import IFC model
ifc_file_path = os.path.join(os.path.dirname(__file__), 'src', 'ifc_structure.ifc')
rfem_app.import_model_from(
filepath=ifc_file_path,
import_attributes=rfem.import_export.IfcImportAttributes()
)
# Get all imported IFC models
ifc_model_list = rfem_app.get_object_list([rfem.ifc_objects.IfcFileModelObject()])
ifc_model = ifc_model_list[0]
# Edit IFC model
edited_ifc_model = rfem.ifc_objects.IfcFileModelObject(
no=ifc_model.no,
mirror_axis_z=True)
rfem_app.update_object(edited_ifc_model)
// Import IFC model
string ifcFilePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "src", "ifc_structure.ifc");
var ifcAttributes = new rfem.ImportExport.IfcImportAttributes();
Any packedAttributes = Any.Pack(ifcAttributes);
await rfem_app.import_model_from(
filepath: ifcFilePath,
importAttributes: packedAttributes
);
// Get all imported IFC models
var ifcModelList = await rfem_app.get_object_list(ObjectType.IfcFileModelObject);
var ifcModel = ifcModelList.ObjectId[0];
// Edit IFC model
var editedIfcModel = new rfem.IfcObjects.IfcFileModelObject
{
No = ifcModel.No,
MirrorAxisZ = true
};
await rfem_app.update_object(editedIfcModel);