nsel

Query.nsel(n)

Returns selection status of a node.

Returns a SelectionStatus object with values:

1 - SELECTED 0 - UNDEFINED -1 - UNSELECTED

Parameters

n (int) – Node number

Return type

SelectionStatus

Returns

mapdl.ansys.core.inline_functions.SelectionStatus – Status of node

Examples

Here we create a single node and interrogate its selection status.

>>> from ansys.mapdl.core import launch_mapdl
>>> from ansys.mapdl.core.inline_functions import Query
>>> mapdl = launch_mapdl()
>>> mapdl.prep7()
>>> n1 = mapdl.n(1, 0, 0, 0)
>>> n1
1

We can use Query.nsel to interrogate the selection status of the node. The response is an enum.IntEnum object. If you query a node that does not exist, it will return a status SelectionStatus.UNDEFINED.

>>> q = Query(mapdl)
>>> q.nsel(n1)
<SelectionStatus.SELECTED: 1>
>>> mapdl.nsel('NONE')
>>> q.nsel(n1)
<SelectionStatus.UNSELECTED: -1>
>>> q.nsel(0)
<SelectionStatus.UNDEFINED: 0>