Model.hm_getedgeloops#

Model.hm_getedgeloops(collection, looptype=255, surf_collection=Collection(), featureangle=0.0, restricttoinput=0)#

Returns surface and element free and non-manifold edge loop entities. The return is a list of loops. Each loop is an ordered list of either surface edge or element node entities that define each loop. The first value in each loop list is the loop type. The remaining values are the ordered node/surface edge entities defining the loop. If the loop is closed, the first and last entity object are the same.

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

  • looptype (int) –

    The type of loop types to find.

    Bit values are used and the value is calculated as (1*Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3 + 16*Bit4 + 32*Bit5 + 64*Bit6 + 128*Bit7). If not specified, all loop types are returned. Valid Bit options are:

    Bit0

    Consider open free edge loops. Valid values are:

    0 - Do not consider open free edge loops

    1 - Consider open free edge loops

    Bit1

    Consider closed free edge loops. Valid values are:

    0 - Do not consider closed free edge loops

    1 - Consider closed free edge loops

    Bit2

    Consider open t-connections. Valid values are:

    0 - Do not consider open t-connections

    1 - Consider open t-connections

    Bit3

    Consider closed t-connections. Valid values are:

    0 - Do not consider closed t-connections

    1 - Consider closed t-connections

    Bit4

    Consider open x-connections. Valid values are:

    0 - Do not consider open x-connections

    1 - Consider open x-connections

    Bit5

    Consider closed x-connections. Valid values are:

    0 - Do not consider closed x-connections

    1 - Consider closed x-connections

    Bit6

    Consider open feature edge loops. Valid values are:

    0 - Do not consider open feature edge loops

    1 - Consider open feature edge loops

    Bit7

    Consider closed feature edge loops. Valid values are:

    0 - Do not consider closed feature edge loops

    1 - Consider closed feature edge loops

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Consider open free edge loops (Bit0)
    Consider closed free edge loops (Bit1)
    Consider open t-connections (Bit2)
    Consider closed t-connections (Bit3)
    Consider open x-connections (Bit4)
    Consider closed x-connections (Bit5)
    Consider open feature edge loops (Bit6)
    Consider closed feature edge loops (Bit7)
    Calculated argument value: 0

  • surf_collection (Collection) – The collection containing the entities. Currently supported for surfaces and elements.

  • featureangle (double) – This is relevant to finding feature edges only. When an edge is shared by two surfaces, and the average angle along the edge between these two surfaces is greater than featureangle, then it is considered a feature edge. The angle is measured in degrees. The default value is the model’s default feature angle preference.

  • restricttoinput (int) –

    0 - Loops are completed naturally for the whole model, which might result in including edges that are not in the input specified by surf_collection.

    1 - The loop output is restricted to the set of edges that are given by the input only.

Returns:

  • hwReturnStatus - Status object

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

    • loopType (int) - The type of loop.

      0 - Undefined loop

      1 - Open free edge loop

      2 - Closed free edge loop

      4 - Open t-connection

      8 - Closed t-connection

      16 - Open x-connection

      32 - Closed x-connection

      64 - Open feature edge loop

      128 - Closed feature edge loop

    • loopEntities (EntityList) - The list of entity objects representing the loop. For collection containing surfaces, the entities are surface edges. For collection containing elements, the entities are element nodes.

Example#

Find all edge loops on displayed elements#
import hm
import hm.entities as ent

model = hm.Model()

elements = hm.CollectionByDisplayed(model,ent.Element)

_, resultlist = model.hm_getedgeloops(collection=elements, looptype=255)

for result in resultlist:
    print("Loop Type:", result.loopType)
    print("Number of Loop Entities:", len(result.loopEntities))