Model.hm_holedetectiongetwasherelementslist#

Model.hm_holedetectiongetwasherelementslist(index)#

Returns the washer elements layer-wise. This must be preceded by a call to Model.hm_holedetectionfindholes().

Parameters:

index (int) – The index of the node/line to get the associated hole index.

Returns:

Example#

Detect holes on all elements in the model and write out to a text file the washer elements layer by layer for each detected hole that has a washer#
import hm
import hm.entities as ent

model = hm.Model()

with open("C:/temp/washer.txt", "w") as washersfile:

    model.hm_holedetectioninit()
    elem_collection = hm.Collection(model, ent.Element)
    model.hm_holedetectionsetentities(collection=elem_collection)
    model.hm_holedetectionfindholes(find=1)  # For holes we need to set find=1

    _, result = model.hm_holedetectiongetnumberofholes()
    num_holes = result.numberOfHoles

    if num_holes > 0:
        washersfile.write(f"Number of Shell Holes = {num_holes}\n")

        for n in range(num_holes):
            _, result = model.hm_holedetectiongetwasherelementslist(index=n)

            holedetailslist = result.entityList

            washersfile.write(f"hole index = {n, holedetailslist}\n")

    model.hm_holedetectionend()

    washersfile.close()