Goal: Query the mesh information for the active selection.
Code:
# Macro to demonstrate how to query mesh information for the active selection
meshData = DataModel.MeshDataByName("Global")
sel=ExtAPI.SelectionManager.CurrentSelection
refIds = sel.Ids
# check that current selection is nodes
if sel.SelectionType == SelectionTypeEnum.MeshNodes:
print "%s Nodes Selected" % (refIds.Count)
for meshId in refIds:
node = meshData.NodeById(meshId)
print "Node %s, X = %s, Y = %s, Z = %s" % (meshId, node.X, node.Y, node.Z)
else:
print "Selection is not made of nodes"