Skip to content

Commit f77980f

Browse files
committed
Merge branch 'main' into release/0.62
2 parents bb220d1 + 11ce5a4 commit f77980f

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

requirements/requirements_docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Sphinx==4.5.0
22
ansys-mapdl-reader==0.51.14
33
imageio-ffmpeg==0.4.7
4-
imageio==2.19.2
4+
imageio==2.19.3
55
jupyter_sphinx==0.3.2
66
jupyterlab>=3.2.8
77
matplotlib==3.5.2

src/ansys/mapdl/core/launcher.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
import time
1212
import warnings
1313

14-
import ansys.platform.instancemanagement as pypim
14+
try:
15+
import ansys.platform.instancemanagement as pypim
16+
17+
_HAS_PIM = True
18+
except ModuleNotFoundError: # pragma: no cover
19+
_HAS_PIM = False
20+
1521
import appdirs
1622

1723
from ansys.mapdl import core as pymapdl
@@ -547,6 +553,11 @@ def launch_remote_mapdl(
547553
ansys.mapdl.core.mapdl._MapdlCore
548554
An instance of Mapdl.
549555
"""
556+
if not _HAS_PIM: # pragma: no cover
557+
raise ModuleNotFoundError(
558+
"The package 'ansys-platform-instancemanagement' is required to use this function."
559+
)
560+
550561
pim = pypim.connect()
551562
instance = pim.create_instance(product_name="mapdl", product_version=version)
552563
instance.wait_for_ready()
@@ -1249,7 +1260,7 @@ def launch_mapdl(
12491260

12501261
# Start MAPDL with PyPIM if the environment is configured for it
12511262
# and the user did not pass a directive on how to launch it.
1252-
if pypim.is_configured() and exec_file is None:
1263+
if _HAS_PIM and exec_file is None and pypim.is_configured():
12531264
LOG.info("Starting MAPDL remotely. The startup configuration will be ignored.")
12541265
return launch_remote_mapdl(cleanup_on_exit=cleanup_on_exit)
12551266

src/ansys/mapdl/core/mapdl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def __init__(
182182
self._ignore_errors = False
183183
self._print_com = print_com # print the command /COM input.
184184
self._cached_routine = None
185+
self._geometry = None
185186

186187
# Setting up loggers
187188
self._log = logger.add_instance_logger(
@@ -619,10 +620,11 @@ def geometry(self):
619620
>>> mapdl.geometry.line_select([3, 4, 5], sel_type='R')
620621
621622
"""
623+
if self._geometry == None:
624+
self._geometry = self._create_geometry()
622625
return self._geometry
623626

624-
@property
625-
def _geometry(self): # pragma: no cover
627+
def _create_geometry(self): # pragma: no cover
626628
"""Return geometry cache"""
627629
from ansys.mapdl.core.mapdl_geometry import Geometry
628630

src/ansys/mapdl/core/mapdl_grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def _reset_cache(self):
670670
if self._mesh_rep is not None:
671671
self._mesh_rep._reset_cache()
672672

673-
if self.geometry is not None:
673+
if self._geometry is not None:
674674
self._geometry._reset_cache()
675675

676676
@property

0 commit comments

Comments
 (0)