Model.hm_getclosestnode#
- Model.hm_getclosestnode(x, y, z, elemCollection=Collection(), nodeCollection=Collection())#
Returns the closest node to the point (x,y,z). None is returned if there are no nodes in the database.
- Parameters:
x (double) – The X coordinate of the input point.
y (double) – The Y coordinate of the input point.
z (double) – The Z coordinate of the input point.
elemCollection (Collection) – The collection containing the element entities. If
elemCollectionis given the algorithm only search nodes attached to elements (in components) on the collection.nodeCollection (Collection) – The collection containing the node entities. If
nodeCollectionis given, algorithm ignores nodes on this collection when searching.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:closestNode (Entity) - Entity Type:
Node
Example#
Find the closest node to ( 0,0,0 ) on a quad4 element#import hm import hm.entities as ent model = hm.Model() element_collection = hm.Collection(model, ent.Element, "config=104") _, result = model.hm_getclosestnode(x=0, y=0, z=0, elemCollection=element_collection) print("Closest node to point:", result.closestNode.id)