create_object#

dlubal.api.rfem.Application.create_object(self, obj, model_id: ModelId | None = None)#

Creates a single object in the model.

Parameters:
  • obj (obj) – An object to be created. Refer to the dlubal.api.rfem for available objects.

  • model_id (ModelId | None) – Unique identifier of the model.

Returns:

ID of the created object

Return type:

ObjectId


Example

# Create an object of type Material in the active model
rfem_app.create_object(
    rfem.structure_core.Material(
        no=1,
        name="S235"
    )
)

# Create an object of type Node in the specific model (by model_id)
rfem_app.create_object(
    rfem.structure_core.Node(
        no=1,
        coordinate_1=10.0
    ),
    common.ModelId(
        id=model_id
    )
)

Tip

It’s not necessary to specify all attributes of an object if the default values meet your requirements. For example, if coordinate_2 defaults to 0.0, it can be omitted unless a specific value is needed.