Model.hm_getcog#

Model.hm_getcog(collection, reserved_1=0, reserved_2=0, lumpedmassflag=0, system_id=0)#

Returns the mass center-of-gravity coordinates for the selected entities.

Parameters:
  • collection (Collection) – The collection containing the entities. Currently supported for components, elements, materials, properties, parts, plies and laminates.

  • reserved_1 (int) – Reserved for future use. Must be set to 0.

  • reserved_2 (int) – Reserved for future use. Must be set to 0.

  • lumpedmassflag (int) –

    Specifies whether to include lumped mass in the COG calculations.

    0 - Exclude lumped mass.

    1 - Include lumped mass.

  • system_id (int) – The ID of the system to report the COG values relative to.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • coord (numpy.ndarray) - Mass center-of-gravity coordinates

Example#

Get the COG for components with IDs 1 - 5#
import hm
import hm.entities as ent

model = hm.Model()

component_collection = hm.Collection(model, ent.Component, list(range(1, 6)))

_, result = model.hm_getcog(collection=component_collection)

print("COG coordinates:", result.coord)