How to extract all node ids of a named selection via scripting, irrespective of whether it has geometric entities (faces for example) or nodes?
Here is an example code which takes the name of the named selection (please make sure the name is unique and collects all the node ids into a list.
myNS = ExtAPI.DataModel.GetObjectsByName("test_ns")[0] allNodeIds = [] geomIds = myNS.Location.Ids Mesh = ExtAPI.DataModel.MeshDataByName("Global") if myNS.Location.SelectionType == SelectionTypeEnum.GeometryEntities: for geomId in geomIds: mR = Mesh.MeshRegionById(geomId) nodeIds = mR.NodeIds allNodeIds.extend(nodeIds) else: allNodeIds = myNS.Location.Ids allNodeIds = list(set(allNodeIds)) print(len(allNodeIds))