Model.hm_getactiveplotcontrolvalues_bycollection#
- Model.hm_getactiveplotcontrolvalues_bycollection(plot_type, collection)#
Queries the result values of a collection of entities 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.
collection (Collection) – The collection containing the entities for which the result values are queried. Valid entities are nodes, elements, and components.
- Returns:
hwReturnStatus- Status objectHmQueryResultList- Result list object containingHmQueryResultobjects with the following output data: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
HmQueryResultobjects 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.
Collection of components can contain only a single component entity. Consequently, the output is identical to Model.hm_getactiveplotcontrolvalues_byentity.
HmQueryResult- Result object containing the output values: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.
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 elements ID 100, 101, and 102#import hm import hm.entities as ent model = hm.Model() elems = hm.Collection(model, ent.Element, [100, 101, 102]) _, resultlist = model.hm_getactiveplotcontrolvalues_bycollection(plot_type="contour", collection=elems) for result in resultlist: print(f"Element ID: {result.entity.id}, Contour Value: {result.value}")
Return the minimum and maximum contour values of component ID 3#import hm import hm.entities as ent model = hm.Model() comps = hm.Collection(model, ent.Component, [3]) _, result = model.hm_getactiveplotcontrolvalues_bycollection(plot_type="contour", collection=comps) print(f"Min Value: {result.min}, Max Value: {result.max}")
Return all the corner values of element ID 2100, 2101, and 2102#import hm import hm.entities as ent model = hm.Model() elems = hm.Collection(model, ent.Element, [2100, 2101, 2102]) _, resultlist = model.hm_getactiveplotcontrolvalues_bycollection(plot_type="contour", collection=elems) for result in resultlist: print(f"Element ID: {result.entity.id}") for corner_data in result.plot_info: print(f"Part/Component: {corner_data.entity_identifier}, Value: {corner_data.value}")