Model.getnodesinsidedomaintomark#

Model.getnodesinsidedomaintomark(nodes_collection, element_id, tolerance, calcminlen)#

Places the displayed nodes inside an element to the specified collection.

Parameters:
  • nodes_collection (Collection) – The output collection containing the node entities must be placed.

  • element_id (unsigned int) – The element ID within which the nodes are to be found. Can only be a 2D or 3D element.

  • tolerance (double) – Out-of-plane tolerance value, which should be between 0 and 1. For more information, see bullet 1 in note below.

  • calcminlen (int) – A flag to indicate if the calculation of minimum length should be exact. Can be either 0 or 1. For more information, see bullet 2 in note below.

Note

  1. The calcminlen parameter is used to determine if there are nodes very close to the edge of a solid element, and almost collinear to it. In most cases, setting this value to 0 should be adequate. Setting the value to 1 slows down the execution of the function.

  2. If this function is used while working on a large model, or if this function is being called repeatedly in a macro, it is highly recommended to turn off the display of portions of the model that are known to be completely outside of the domain (element) where the nodes are needed. Since this function works on the displayed nodes and elements of the model, the speed of the function is greatly increased.

Examples#

Find the nodes inside an element of ID 101 and place them in an entity set#
import hm
import hm.entities as ent

model = hm.Model()

node_collection = hm.Collection(model, ent.Node, populate=False)

model.getnodesinsidedomaintomark(
        nodes_collection=node_collection, element_id=101, tolerance=0.001, calcminlen=0
)

newSet = ent.Set(model)
newSet.cardimage = "SET_GRID"
newSet.ids = list(node_collection)
Find nodes inside each and every displayed hexa8 element in a model and then creates an entity set containing all those nodes#
import hm
import hm.entities as ent

model = hm.Model()

total_node_entity_list = list()


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

for elem in element_collection:
    if elem.config == 208:
        node_collection = hm.Collection(model, ent.Node, populate=False)
        model.getnodesinsidedomaintomark(
             nodes_collection=node_collection,
             element_id=elem.id,
             tolerance=0.001,
             calcminlen=0,
        )
        total_node_entity_list.extend(list(node_collection))

newSet = ent.Set(model, name="PenetrationNodes")
newSet.cardimage = "SET_GRID"
newSet.ids = total_node_entity_list

Note

For 2D elements, the tolerance value helps in capturing nodes that are close to, but lie outside the plane of the element.

In the case of 3D elements, this value is applied in turn to each face of the element to capture out-of-plane nodes.

In general, you may either have to adjust the tolerance values to get the desired nodes, or manually add/remove nodes, as necessary.