Skip to content

Commit 6fbaad3

Browse files
Fix/node-numbering (#3297)
* tests: add test * tests: testing * fix: removing everything that handled the duplicated points. It is not needed anymore. * chore: adding changelog file 3297.fixed.md --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 0c0f679 commit 6fbaad3

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

doc/changelog.d/3297.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix/node-numbering

src/ansys/mapdl/core/mapdl_extended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ def eplot(self, show_node_numbering=False, vtk=None, **kwargs):
12431243

12441244
pl = kwargs.get("plotter", None)
12451245
pl = MapdlPlotter().switch_scene(pl)
1246+
pl.mapdl = self
12461247

12471248
kwargs.setdefault("title", "MAPDL Element Plot")
12481249
if not self._mesh.n_elem:

src/ansys/mapdl/core/plotting/visualizer.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from numpy.typing import NDArray
3131

3232
from ansys.mapdl.core import _HAS_PYVISTA
33-
from ansys.mapdl.core.misc import get_bounding_box, unique_rows
33+
from ansys.mapdl.core.misc import get_bounding_box
3434
from ansys.mapdl.core.plotting.consts import (
3535
ALLOWED_TARGETS,
3636
BC_D,
@@ -424,16 +424,12 @@ def add_mesh(
424424
)
425425

426426
for label in labels:
427-
# verify points are not duplicates
428-
points = np.atleast_2d(np.array(label["points"]))
429-
_, idx, idx2 = unique_rows(points)
430-
points = points[idx2][idx] # Getting back the initial order.
427+
# Pyvista does not support plotting two labels with the same point.
428+
# It does handle that case by keeping only the first label.
431429

432-
# Converting python order (0 based)
433-
labels_ = np.array(label["labels"] - 1)[idx]
434430
self.add_labels(
435-
points,
436-
labels_,
431+
label["points"],
432+
label["labels"],
437433
show_points=False,
438434
shadow=False,
439435
font_size=font_size,

tests/test_plotting.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,3 +1109,20 @@ def test_node_numbering_order(mapdl, cleared):
11091109
# There is no way to retrieve labels from the plotter object. So we cannot
11101110
# test it.
11111111
pl.show()
1112+
1113+
1114+
def test_lplot_line(mapdl, cleared):
1115+
mapdl.prep7()
1116+
1117+
# Create keypoints 3 keypoints
1118+
mapdl.k(1, 0, 0, 0)
1119+
mapdl.k(2, 1, 0, 0)
1120+
mapdl.k(3, 1, 1, 0)
1121+
1122+
# Create line connecting keypoints 1 and 2
1123+
mapdl.l(1, 2)
1124+
1125+
# Plot the geometry
1126+
mapdl.lplot(
1127+
show_line_numbering=False, show_keypoint_numbering=True, color_lines=True
1128+
)

0 commit comments

Comments
 (0)