Model.convertunit_bycollection#

Model.convertunit_bycollection(collection, source_unit_system, target_unit_system)#

Converts entity values from the source unit system to the target unit system. Only the entities specified on the collection are converted. The function is currently supported in the Radioss and LS-DYNA solver interface.

The following unit systems are supported for conversion:

  • N_m_s_kg

  • kN_mm_ms_kg

  • N_mm_ms_g

  • N_mm_s_T

Parameters:
  • collection (Collection) – The collection containing the entities to convert.

  • source_unit_system (hwString) – The source unit system.

  • target_unit_system (hwString) – The target unit system.

Example#

Convert materials with IDs 1, 2, 3 from source unit system “N_m_s_kg” to target unit system “kN_mm_ms_kg”#
import hm
import hm.entities as ent

model = hm.Model()

model.convertunit_bycollection(
    collection=hm.Collection(model, ent.Material, [1, 2, 3]),
    source_unit_system="N_m_s_kg",
    target_unit_system="kN_mm_ms_kg",
)