Model.hm_getboundingbox#

Model.hm_getboundingbox(entityCollection, entityFlag=0, systemID=0, boxType=0)#

Returns the six values defining the bounding box from the specified entities and options.

Parameters:
  • entityCollection (Collection) –

    The collection containing the entities to find the bounding box for.

    List of supported entity classes

    Bag - Bounding box includes all the bounding boxes of its contents, with the exception that sub-bags do not contribute to the bounding box.

    Block - Bounding box includes the 8 corner nodes.

    Component - Bounding box includes the entities as specified in the entity_flag argument.

    Connector - Bounding box includes the bounding box of the connector graphical locations (for example, geometry), and does not include any reaized FE or link entities.

    Contactsurf - Bounding box includes all of the nodes of all of the elemental faces of the contact surface.

    Controlvol - Bounding box contains all of the nodes and elements of the control volume.

    Element - Bounding box includes all nodes of the element, including any orientation nodes.

    Equation - Bounding box includes all of the nodes of the equation.

    Group - The bounding box of a group includes all the bounding boxes of its contents. If its main or secondary definition includes elements, components, sets, or contact surfaces, it will include the bounding boxes of those entities. If the main or secondary definition includes “all”, it is ignored. If the main or secondary definition includes “box” then the boundaries of the box are included, but no attempt is made to find what may be in that box. Only finite plane, finite prism, finite cylinder, and sphere rigid wall geometry definitions are included.

    Laminate - Bounding box includes all of the bounding boxes of its plies and sub-laminates.

    Line - Bounding box includes the faceted representation.

    Loadcol - Bounding box includes all loads and equations in the load collector.

    LoadAcceleration - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadConstraint - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadFlux - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadForce - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadMoment - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadPressure - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadTemperature - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    LoadVelocity - For every load, its bounding box is the bounding box of the entity to which it is attached, be it a node, element, component, set, or geometry entity.

    Node - Bounding box includes the coordinate locations. Definition system is ignored.

    Ply - Bounding box includes all of the elements of the ply.

    Point - Bounding box includes the coordinate locations.

    Set - Property and material sets do not have a bounding box. Sets of sets only explore one level deep into the selection (that is, sets of sets of sets are ignored). The bounding boxes of all other set types include the bounding boxes of those entities in the set.

    Solid - Bounding box includes all of the bounding boxes of all of the surfaces of the solid.

    Subsystem - Bounding box includes all the entities that reside in the subsystems and their children subsystems.

    Surface - Bounding box includes the faceted representation.

    Systcol -Bounding box includes all systems in the system collector.

    System - Bounding box includes the origin of the system. For 3-noded systems, the bounding box includes all three nodes of the system.

    Tag - Bounding box includes the bounding boxes of the tag’s element or node.

    Vectorcol - Bounding box includes all vectors in the vector collector.

    Vector - Bounding box includes the base node of the vector, and a second node if defined.

  • entityFlag (int) –

    This is a bit value used when the entityCollection is of type component. This specifies whether to consider nodes/elems, geometry and/or connectors.

    It is ignored for all other entity types and should be set to 0, but there is no error if bit values are specified that do not correspond to the current entity type.

    The bit values are summed as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3). Valid Bit options are:

    Bit0

    Consideration of nodes or elements. Valid values are:

    0 - Do not consider nodes/elems.

    1 - Consider nodes/elems.

    Bit1

    Consideration of geometry. Valid values are:

    0 - Do not consider geometry.

    1 - Consider geometry.

    Bit2

    Consideration of connectors. Valid values are:

    0 - Do not consider connectors

    1 - Consider connectors.

    Bit3

    Consideration of multibodies or ellipsoids. Valid values are:

    0 - Do not consider multibodies/ellipsoids.

    1 - Consider multibodies/ellipsoids.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Consideration of nodes or elements (Bit0)
    Consideration of geometry (Bit1)
    Consideration of connectors (Bit2)
    Consideration of multibodies or ellipsoids (Bit3)
    Calculated argument value: 0

  • systemID (int) – The ID of the local coordinate system to return the values relative to. A value of 0 represents the global system. Currently only rectangular systems are supported. Ignored if boxType=1.

  • boxType (int) –

    The type of bounding box to return.

    0 - The bounding box is calculated in the specified coordinate system, and the minimum and maximum coordinates are returned.

    1 - The bounding box is calculated according to the part orientation, and the minimum and maximum coordinates, local axes, and dimensions of the box are returned.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for boxType=0:

      • minValues (numpy.ndarray) - Minimum coordinates of the bounding box in the specified system.

      • maxValues (numpy.ndarray) - Maximum coordinates of the bounding box in the specified system.

    • Keys valid for boxType=1:

      • minValues (numpy.ndarray) - Minimum coordinates of the bounding box in the specified system.

      • maxValues (numpy.ndarray) - Maximum coordinates of the bounding box in the specified system.

      • localXAxis (numpy.ndarray) - The x, y, z components of the vector defining the local X-axis direction of the bounding box in the part orientation system.

      • localYAxis (numpy.ndarray) - The x, y, z components of the vector defining the local Y-axis direction of the bounding box in the part orientation system.

      • localZAxis (numpy.ndarray) - The x, y, z components of the vector defining the local Z-axis direction of the bounding box in the part orientation system.

      • boxDim (numpy.ndarray) - The dimensions of the bounding box in the part orientation system.

Examples#

Get the bounding box for the displayed elements oriented relative to the global system#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.CollectionByDisplayed(model, ent.Element)
_, result = model.hm_getboundingbox(entityCollection=element_collection)

print("Minimum coords:", result.minValues)
print("Maximum coords:", result.maxValues)
Get the bounding box for the geometry in components with IDs 1 - 4 oriented relative to rectangular system with ID 100#
import hm
import hm.entities as ent

model = hm.Model()

component_collection = hm.Collection(model, ent.Component, list(range(1, 5)))
_, result = model.hm_getboundingbox(
    entityCollection=component_collection, entityFlag=2, systemID=100
)

print("Minimum coords:", result.minValues)
print("Maximum coords:", result.maxValues)
Get the bounding box for component ID 5 oriented relative to the component orientation#
import hm
import hm.entities as ent

model = hm.Model()

component_collection = hm.Collection(model, ent.Component, [5])

_, result = model.hm_getboundingbox(
    entityCollection=component_collection, entityFlag=1, boxType=1
)

print("Minimum coords:", result.minValues)
print("Maximum coords:", result.maxValues)
print("Local X-axis:", result.localXAxis)
print("Local Y-axis:", result.localYAxis)
print("Local Z-axis:", result.localZAxis)
print("Box dimensions:", result.boxDim)