Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/3897.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hold the bc settings per plotter instance
25 changes: 17 additions & 8 deletions src/ansys/mapdl/core/plotting/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@

def _first_use():
# Run first time we use the visualizer
global BC_plot_settings
global _FIRST_USE_RUN
if _FIRST_USE_RUN is True:
return
if _HAS_VISUALIZER:
from ansys.mapdl.core.plotting.plotting_defaults import DefaultSymbol
from ansys.mapdl.core.plotting.theme import _apply_default_theme

_apply_default_theme()
BC_plot_settings = DefaultSymbol()
_FIRST_USE_RUN = True


Expand Down Expand Up @@ -138,6 +135,18 @@ def __init__(
self._notebook = None
self._savefig = None
self._title = None
self._bc_settings = None

@property
def bc_settings(self):
if self._bc_settings is None:
self._make_bc_settings()
return self._bc_settings

def _make_bc_settings(self):
from ansys.mapdl.core.plotting.plotting_defaults import DefaultSymbol

self._bc_settings = DefaultSymbol()

def _bc_labels_checker(self, bc_labels):
"""Make sure we have allowed parameters and data types for ``bc_labels``"""
Expand Down Expand Up @@ -601,13 +610,13 @@ def bc_nodes_plot(
orient=False,
scale="scale",
# tolerance=0.05,
geom=BC_plot_settings(each_label)["glyph"],
geom=self.bc_settings(each_label)["glyph"],
)
name_ = f"{each_label}"
self.scene.add_mesh(
glyphs,
# name_filter=None,
color=BC_plot_settings(each_label)["color"],
color=self.bc_settings(each_label)["color"],
style="surface",
# style='wireframe',
# line_width=3,
Expand Down Expand Up @@ -658,11 +667,11 @@ def bc_nodes_plot(
# something it can be seen properly in the legend
label_ = value[1]
if "U" in label_:
value = [BC_plot_settings("UY")["glyph"], label_, value[2]]
value = [self.bc_settings("UY")["glyph"], label_, value[2]]
elif "F" in label_:
value = [BC_plot_settings("FX")["glyph"], label_, value[2]]
value = [self.bc_settings("FX")["glyph"], label_, value[2]]
else:
value = [BC_plot_settings(label_)["glyph"], label_, value[2]]
value = [self.bc_settings(label_)["glyph"], label_, value[2]]

if symbol == value[1]:
sorted_dict[key] = value
Expand Down
Loading