import_model_from#

dlubal.api.rfem.Application.import_model_from(self, *, filepath: str, import_attributes: Any, model_id: ModelId | None = 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:

    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)