Model.hm_getprincipalaxes#

Model.hm_getprincipalaxes(collection, location_flag=0)#

Returns the principal axes direction cosine values for the selected entities. The values are always returned relative to the global axes.

Parameters:
  • collection (Collection) – The collection containing the entities to query. Currently supported for components and elements.

  • location_flag (int) –

    Specifies the location about which the principal axes are calculated. Valid values are:

    0 - Global (0,0,0). Default.

    1 - COG location.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • principalAxesComponents (numpy.ndarray) - The principal axes direction cosine values. Returned as 1st_direction_x, 1st_direction_y, 1st_direction_z, 2nd_direction_x, 2nd_direction_y, 2nd_direction_z, 3rd_direction_x, 3rd_direction_y, 3rd_direction_z.

Example#

Get the principal axes 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_getprincipalaxes(collection=component_collection)

print("Principal axes direction cosine values:", result.principalAxesComponents)