Model.hm_getactiveplotcontrolvalues_byentity#

Model.hm_getactiveplotcontrolvalues_byentity(plot_type, entity)#

Queries the result values of a specified entity for an active plot control.

Parameters:
  • plot_type (hwString) – The type of plot for which the result values are queried. Valid values are contour, vector, tensor, and marker.

  • entity (Entity) – The entity for which the result values are queried. This can be a node, element, or a component.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for entity types node and element, and plot type contour:

      • entity (Entity) - The entity for which the result values are queried.

      • value (float) - The result value for the specified entity.

    • Keys valid for entity types node and element, and plot type vector and tensor:

      • entity (Entity) - The entity for which the result values are queried.

      • value (numpy.ndarray) - The result values for the specified entity (3 float values for vector plots, 6 float values for tensor plots).

    • Keys valid for entity types component and plot type contour:

      • min (float) - The minimum result value for the specified component.

      • max (float) - The maximum result value for the specified component.

    • Keys valid for entity types node and element, plot type contour for entities with multiple result values associated with them (e.g., boundary nodes when aggregation across parts is disabled, or elements with contour data enabled):

      • entity (Entity) - The entity for which the result values are queried.

      • plot_info (HmQueryResultList) - Result list object containing HmQueryResult objects with the following output data:

        • entity_identifier (str) - The identifier of the part/component the value is associated with.

        • value (float) - The result value for the specified node and part/component.

Note

If the result data is not available for the specified entity, the result value will be returned as “N/A” (string value).

Note

If the function is used as part of a script that creates the queried plot, it is required to call Model.hm_redraw before using this function to ensure the graphics are refreshed and the data can be extracted.

Example#

Return the contour value of element ID 741#
import hm
import hm.entities as ent

model = hm.Model()

elem = ent.Element(model, 741)

_, result = model.hm_getactiveplotcontrolvalues_byentity("contour", elem)

print(f"Element ID: {result.entity.id}, Contour Value: {result.value}")
Return the minimum and maximum contour values of component ID 172#
import hm
import hm.entities as ent

model = hm.Model()

comp = ent.Component(model, 172)

_, result = model.hm_getactiveplotcontrolvalues_byentity("contour", comp)

print(f"Min Value: {result.min}, Max Value: {result.max}")
Return all the corner values of element ID 2100#
import hm
import hm.entities as ent

model = hm.Model()

elem = ent.Element(model, 2100)

_, result = model.hm_getactiveplotcontrolvalues_byentity("contour", elem)

for corner_data in result.plot_info:
    print(f"Part/Component: {corner_data.entity_identifier}, Value: {corner_data.value}")