From aebbb075ae26ba5d7aded587c98656c46ceb4270 Mon Sep 17 00:00:00 2001 From: German Date: Wed, 8 Nov 2023 13:44:40 +0100 Subject: [PATCH 01/15] * Adding `non_interactive` section. Documenting exceptions and how to work. * Changing headers syntax. * Adding tabs apdl/python. --- doc/source/links.rst | 3 +- doc/source/user_guide/mapdl.rst | 453 ++++++++++++++++++++++---------- 2 files changed, 315 insertions(+), 141 deletions(-) diff --git a/doc/source/links.rst b/doc/source/links.rst index a4a445b702..61d1e470c8 100644 --- a/doc/source/links.rst +++ b/doc/source/links.rst @@ -108,6 +108,7 @@ .. _tds_article_web_app_1: https://towardsdatascience.com/ansys-in-a-python-web-app-part-1-post-processing-with-pydpf-44d2fbaa6135 .. _tds_article_web_app_2: https://towardsdatascience.com/ansys-in-a-python-web-app-part-2-pre-processing-solving-with-pymapdl-50428c18f8e7 .. _paraview_question_read_rst: https://discourse.paraview.org/t/reading-ansys-apdl-rst-results-in-paraview/9706 +.. _python_context_manager: https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers .. #Github links: .. _gh_creating_pat: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token @@ -150,7 +151,7 @@ .. _wsl_launching_mapdl: https://github.com/ansys/pymapdl/issues/2315 .. _pymapdl_latest_github_release: https://github.com/ansys/pymapdl/releases/latest .. _pymapdl_latest_pdf_doc: https://github.com/ansys/pymapdl/releases/download/v%%PYMAPDLVERSION%%.0/pymapdl-Documentation-%%PYMAPDLVERSION%%.0.pdf - +.. _pymapdl_discussion_speed_pymapdl_mapdl: https://github.com/ansys/pymapdl/discussions/757 .. #Python .. _using_venv: https://docs.python.org/3/library/venv.html diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index bfaa5dc813..ab1f4a99d0 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -1,18 +1,43 @@ .. _ref_mapdl_user_guide: -************************** +========================== PyMAPDL language and usage -************************** +========================== + This page gives you an overview of the PyMAPDL API for the :class:`Mapdl ` class. For more information, see :ref:`ref_mapdl_api`. Overview --------- +======== When calling MAPDL commands as functions, each command has been translated from its original MAPDL all CAPS format to a PEP8 compatible format. For example, ``ESEL`` is now the :func:`Mapdl.esel() ` method. + + +.. tab-set:: + + .. tab-item:: APDL + :sync: key1 + + .. code:: apdl + + ! Selecting elements whose centroid x coordinate + ! is between the 1 and 2. + ESEL, S, CENT, X, 1, 2 + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + # Selecting elements whose centroid x coordinate + # is between the 1 and 2. + # returns an array of selected elements ids + mapdl.esel("S", "CENT", "X", 1, 2) + + Additionally, MAPDL commands containing a ``/`` or ``*`` have had those characters removed, unless this causes a conflict with an existing name. Most notable is @@ -23,33 +48,74 @@ method to differentiate it from ``solu``. Out of the 1500 MAPDL commands, about 15 start with ``slash (/)`` and 8 start with ``star (*)``. -MAPDL commands that normally have an empty space, such as -``ESEL,S,TYPE,,1``, should include an empty string when called by Python: -.. code:: python +.. tab-set:: - mapdl.esel("s", "type", "", 1) + .. tab-item:: APDL + :sync: key1 -Or, these commands can be called using keyword arguments: + .. code:: apdl -.. code:: python + *STATUS + /SOLU + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + mapdl.startstatus() + mapdl.slashsolu() + + +MAPDL commands that can accept an empty space as argument, such as +``ESEL,S,TYPE,,1``, should include an empty string when called by Python, +or, these commands can be called using keyword arguments: + +.. tab-set:: + + .. tab-item:: APDL + :sync: key1 + + .. code:: apdl - mapdl.esel("s", "type", vmin=1) + ESEL,S,TYPE,,1 + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + mapdl.esel("s", "type", "", 1) + mapdl.esel("s", "type", vmin=1) + None of these restrictions apply to commands run with the :func:`Mapdl.run() ` method. It might be easier to run some of these commands, such as ``"/SOLU"``: -.. code:: python +.. tab-set:: - mapdl.run("/SOLU") - mapdl.solve() + .. tab-item:: APDL + :sync: key1 -You can use the alternative: + .. code:: apdl + + /SOLU + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + # The next three functions are equivalent. Enter the solution processor. + mapdl.run("/SOLU") + mapdl.slashsolu() + mapdl.solution() -.. code:: python - mapdl.slashsolu() +Running in non-interactive mode +------------------------------- Some commands can only be run non-interactively from within a script. PyMAPDL gets around this restriction by writing the commands @@ -66,60 +132,158 @@ method. Here is an example: mapdl.run("*VWRITE,LABEL(1),VALUE(1,1),VALUE(1,2),VALUE(1,3)") mapdl.run("(1X,A8,' ',F10.1,' ',F10.1,' ',1F5.3)") -Note that macros created within PyMAPDL (rather than loaded from -a file) do not appear to run correctly. For example, here is the macro -``DISP`` created using the ``*CREATE`` command within APDL: + +You can then view the final response of the non-interactive context with the +:attr:`Mapdl.last_response ` attribute. + +Using :meth:`Mapdl.non_interactive() ` +can also be useful to run commands on the server side without the interaction +of Python. This can speed up things greatly, but you should be aware of how +APDL works. An interesting discussion about speed comparison between PyMAPDL and APDL +can be found in `here `_. + +It is recommended to use +:meth:`Mapdl.non_interactive() ` with precaution. + +How non-interactive context manager works +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The :meth:`Mapdl.non_interactive() ` is implemented +as a `context manager `_ which means that there are some actions +happening when entering and exit the context. +When entering the context, :class:`Mapdl ` stops sending any APDL +command to the MAPDL instance. +Instead, it allocates a buffer for those APDL commands. +For each PyMAPDL command inside that context, PyMAPDL stores the equivalent MAPDL command +inside that buffer. +Right before exiting the context, PyMAPDL creates a text file with all these APDL commands, sends it to +the MAPDL instance and runs it using +:func:`Mapdl.input() `. + + +For instance, the following :meth:`non_interactive context `: + +.. code:: python + + with mapdl.non_interactive: + mapdl.nsel("all") + mapdl.nsel("R", "LOC", "Z", 10) + +generates the following input for MAPDL: .. code:: apdl - ! SELECT NODES AT Z = 10 TO APPLY DISPLACEMENT - *CREATE,DISP + NSEL,ALL NSEL,R,LOC,Z,10 - D,ALL,UZ,ARG1 - NSEL,ALL - /OUT,SCRATCH - SOLVE - *END - ! Call the function - *USE,DISP,-.032 - *USE,DISP,-.05 - *USE,DISP,-.1 +which is executed with a :func:`Mapdl.input() ` call. -It should be written as follows: +Because of the non-interactive context not running all the commands until the end, +you might find issues interacting inside it, with Python for instance. +For example, running python commands such as +:func:`Mapdl.get_array() ` +inside the context can give you out-of-sync responses. +The following code snippet is a demonstration of this kind of problem: .. code:: python - def DISP( - ARG1="", - ARG2="", - ARG3="", - ARG4="", - ARG5="", - ARG6="", - ARG7="", - ARG8="", - ARG9="", - ARG10="", - ARG11="", - ARG12="", - ARG13="", - ARG14="", - ARG15="", - ARG16="", - ARG17="", - ARG18="", - ): - mapdl.nsel("R", "LOC", "Z", 10) # SELECT NODES AT Z = 10 TO APPLY DISPLACEMENT - mapdl.d("ALL", "UZ", ARG1) - mapdl.nsel("ALL") - mapdl.run("/OUT,SCRATCH") - mapdl.solve() + # Create some keypoints + mapdl.clear() + mapdl.k(1, 0, 0, 0) + mapdl.k(2, 1, 0, 0) + + with mapdl.non_interactive: + mapdl.k(3, 2, 0, 0) + klist_inside = mapdl.get_array("KP", item1="KLIST") + # Here is where PyMAPDL sends the commands to the MAPDL instance and execute 'mapdl.k(3,2,0,0)' (`K,3,2,0,0` + + klist_outside = mapdl.get_array("KP", item1="KLIST") + + assert klist_inside != klist_outside # Evaluates to true + +In the above script, the values obtained by +:func:`Mapdl.get_array() ` are different: + +.. code:: pycon + + >>> print(klist_inside) + array([1., 2.]) + >>> print(klist_outside) + array([1., 2., 3.]) + +This is because the first :func:`Mapdl.get_array() ` +call is executed actually *before* the :func:`Mapdl.k() ` call. + +It is recommend to not retrieve any data in a pythonic way from the MAPDL instance while in the +:meth:`non_interactive context `. +Being aware of this kind of behavior and how +:meth:`non_interactive context ` +works is crucial for an advanced usage of PyMAPDL. - DISP(-0.032) - DISP(-0.05) - DISP(-0.1) +MAPDL macros +------------ +Note that macros created within PyMAPDL (rather than loaded from +a file) do not appear to run correctly. For example, here is the macro +``DISP`` created using the ``*CREATE`` command within APDL and within PyMAPDL: + + +.. tab-set:: + + .. tab-item:: APDL + :sync: key1 + + .. code:: apdl + + ! SELECT NODES AT Z = 10 TO APPLY DISPLACEMENT + *CREATE,DISP + NSEL,R,LOC,Z,10 + D,ALL,UZ,ARG1 + NSEL,ALL + /OUT,SCRATCH + SOLVE + *END + + ! Call the function + *USE,DISP,-.032 + *USE,DISP,-.05 + *USE,DISP,-.1 + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + def DISP( + ARG1="", + ARG2="", + ARG3="", + ARG4="", + ARG5="", + ARG6="", + ARG7="", + ARG8="", + ARG9="", + ARG10="", + ARG11="", + ARG12="", + ARG13="", + ARG14="", + ARG15="", + ARG16="", + ARG17="", + ARG18="", + ): + mapdl.nsel("R", "LOC", "Z", 10) # SELECT NODES AT Z = 10 TO APPLY DISPLACEMENT + mapdl.d("ALL", "UZ", ARG1) + mapdl.nsel("ALL") + mapdl.run("/OUT,SCRATCH") + mapdl.solve() + + + DISP(-0.032) + DISP(-0.05) + DISP(-0.1) If you have an existing input file with a macro, you can convert it using the :func:`convert_script() ` @@ -133,7 +297,7 @@ method, setting``macros_as_functions=True``: Additional options when running commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------------------------------- Commands can be run in ``mute`` or ``verbose`` mode, which allows you to suppress or print the output as it is being run for any MAPDL command. This can be especially helpful for long-running commands @@ -160,7 +324,7 @@ Run a command and stream its output while it is being run: Running several commands or an input file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +----------------------------------------- You can run several MAPDL commands as a unified block using the :func:`Mapdl.input_strings() ` method. This is useful when using PyMAPDL with older MAPDL scripts. For example: @@ -226,73 +390,81 @@ Mechanical, you can run that with: Conditional statements and loops -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-------------------------------- APDL conditional statements such as ``*IF`` must be either implemented Pythonically or by using the :attr:`Mapdl.non_interactive ` attribute. For example: -.. code:: apdl - - *IF,ARG1,EQ,0,THEN - *GET,ARG4,NX,ARG2 ! RETRIEVE COORDINATE LOCATIONS OF BOTH NODES - *GET,ARG5,NY,ARG2 - *GET,ARG6,NZ,ARG2 - *GET,ARG7,NX,ARG3 - *GET,ARG8,NY,ARG3 - *GET,ARG9,NZ,ARG3 - *ELSE - *GET,ARG4,KX,ARG2 ! RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS - *GET,ARG5,KY,ARG2 - *GET,ARG6,KZ,ARG2 - *GET,ARG7,KX,ARG3 - *GET,ARG8,KY,ARG3 - *GET,ARG9,KZ,ARG3 - *ENDIF - -This should be implemented as follows: - -.. code:: python - - with mapdl.non_interactive: - mapdl.run("*IF,ARG1,EQ,0,THEN") - mapdl.run("*GET,ARG4,NX,ARG2 ") # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES - mapdl.run("*GET,ARG5,NY,ARG2") - mapdl.run("*GET,ARG6,NZ,ARG2") - mapdl.run("*GET,ARG7,NX,ARG3") - mapdl.run("*GET,ARG8,NY,ARG3") - mapdl.run("*GET,ARG9,NZ,ARG3") - mapdl.run("*ELSE") - mapdl.run( - "*GET,ARG4,KX,ARG2 " - ) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS - mapdl.run("*GET,ARG5,KY,ARG2") - mapdl.run("*GET,ARG6,KZ,ARG2") - mapdl.run("*GET,ARG7,KX,ARG3") - mapdl.run("*GET,ARG8,KY,ARG3") - mapdl.run("*GET,ARG9,KZ,ARG3") - mapdl.run("*ENDIF") - -Or, implemented Pythonically as follows: - -.. code:: python - - # MAPDL parameters can be obtained using load_parameters - if ARG1 == 0: - mapdl.run("*GET,ARG4,NX,ARG2 ") # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES - mapdl.run("*GET,ARG5,NY,ARG2") - mapdl.run("*GET,ARG6,NZ,ARG2") - mapdl.run("*GET,ARG7,NX,ARG3") - mapdl.run("*GET,ARG8,NY,ARG3") - mapdl.run("*GET,ARG9,NZ,ARG3") - else: - mapdl.run( - "*GET,ARG4,KX,ARG2 " - ) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS - mapdl.run("*GET,ARG5,KY,ARG2") - mapdl.run("*GET,ARG6,KZ,ARG2") - mapdl.run("*GET,ARG7,KX,ARG3") - mapdl.run("*GET,ARG8,KY,ARG3") - mapdl.run("*GET,ARG9,KZ,ARG3") +.. tab-set:: + + .. tab-item:: APDL + :sync: key1 + + .. code:: apdl + + *IF,ARG1,EQ,0,THEN + *GET,ARG4,NX,ARG2 ! RETRIEVE COORDINATE LOCATIONS OF BOTH NODES + *GET,ARG5,NY,ARG2 + *GET,ARG6,NZ,ARG2 + *GET,ARG7,NX,ARG3 + *GET,ARG8,NY,ARG3 + *GET,ARG9,NZ,ARG3 + *ELSE + *GET,ARG4,KX,ARG2 ! RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS + *GET,ARG5,KY,ARG2 + *GET,ARG6,KZ,ARG2 + *GET,ARG7,KX,ARG3 + *GET,ARG8,KY,ARG3 + *GET,ARG9,KZ,ARG3 + *ENDIF + + .. tab-item:: Python-Non interactive + :sync: key3 + + .. code:: python + + with mapdl.non_interactive: + mapdl.run("*IF,ARG1,EQ,0,THEN") + mapdl.run("*GET,ARG4,NX,ARG2 ") # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES + mapdl.run("*GET,ARG5,NY,ARG2") + mapdl.run("*GET,ARG6,NZ,ARG2") + mapdl.run("*GET,ARG7,NX,ARG3") + mapdl.run("*GET,ARG8,NY,ARG3") + mapdl.run("*GET,ARG9,NZ,ARG3") + mapdl.run("*ELSE") + mapdl.run( + "*GET,ARG4,KX,ARG2 " + ) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS + mapdl.run("*GET,ARG5,KY,ARG2") + mapdl.run("*GET,ARG6,KZ,ARG2") + mapdl.run("*GET,ARG7,KX,ARG3") + mapdl.run("*GET,ARG8,KY,ARG3") + mapdl.run("*GET,ARG9,KZ,ARG3") + mapdl.run("*ENDIF") + + + .. tab-item:: Python + :sync: key2 + + .. code:: python + + # MAPDL parameters can be obtained using load_parameters + if ARG1 == 0: + mapdl.run("*GET,ARG4,NX,ARG2 ") # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES + mapdl.run("*GET,ARG5,NY,ARG2") + mapdl.run("*GET,ARG6,NZ,ARG2") + mapdl.run("*GET,ARG7,NX,ARG3") + mapdl.run("*GET,ARG8,NY,ARG3") + mapdl.run("*GET,ARG9,NZ,ARG3") + else: + mapdl.run( + "*GET,ARG4,KX,ARG2 " + ) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS + mapdl.run("*GET,ARG5,KY,ARG2") + mapdl.run("*GET,ARG6,KZ,ARG2") + mapdl.run("*GET,ARG7,KX,ARG3") + mapdl.run("*GET,ARG8,KY,ARG3") + mapdl.run("*GET,ARG9,KZ,ARG3") APDL loops using ``*DO`` or ``*DOWHILE`` should also be implemented using the :attr:`Mapdl.non_interactive ` @@ -300,7 +472,7 @@ attribute or implemented Pythonically. Warnings and errors -~~~~~~~~~~~~~~~~~~~ +------------------- Errors are handled Pythonically. For example: .. code:: python @@ -340,7 +512,7 @@ example: Prompts -~~~~~~~ +------- Prompts from MAPDL automatically continued as if MAPDL is in batch mode. Commands requiring user input, such as the :func:`Mapdl.vwrite() ` method fail @@ -348,7 +520,7 @@ and must be entered in non-interactively. APDL command logging --------------------- +==================== While ``ansys-mapdl-core`` is designed to make it easier to control an APDL session by calling it using Python, it might be necessary to call MAPDL again using an input file generated from a PyMAPDL script. This @@ -372,7 +544,7 @@ For example: This code writes the following to the ``"apdl.log"`` file: -.. code:: text +.. code:: apdl /PREP7, K,1,0,0,0 @@ -384,14 +556,14 @@ This allows for the translation of a Python script to an APDL script except for conditional statements, loops, or functions. Use the ``lgwrite`` method -~~~~~~~~~~~~~~~~~~~~~~~~~~ +-------------------------- Alternatively, if you only want the database command output, you can use the :func:`Mapdl.lgwrite ` method to write the entire database command log to a file. Interactive breakpoint ----------------------- +====================== In most circumstances, it is necessary or preferable to open up the MAPDL GUI. The :class:`Mapdl ` class has the :func:`Mapdl.open_gui() ` method, which @@ -440,8 +612,8 @@ changes made in the GUI affect the script. You can experiment in the GUI, and the script is left unaffected. -Run a batch ------------- +Run a batch job +=============== Instead of running a MAPDL batch by calling MAPDL with an input file, you can instead define a function that runs MAPDL. This example runs a mesh convergence study based on the maximum stress of a cylinder @@ -587,7 +759,8 @@ Here is the output from the script: Chain commands in MAPDL ------------------------ +======================= + MAPDL permits several commands on one line by using the separation character ``"$"``. This can be utilized within PyMAPDL to effectively chain several commands together and send them to MAPDL for execution @@ -630,7 +803,7 @@ the chained commands with the Sending arrays to MAPDL ------------------------ +======================= You can send ``numpy`` arrays or Python lists directly to MAPDL using the :attr:`Mapdl.Parameters ` attribute. This is far more efficient than individually sending parameters to @@ -663,7 +836,7 @@ was a Python dictionary: Download a remote MAPDL file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------------------- When running MAPDL in gRPC mode, remote MAPDL files can be listed and downloaded using the :class:`Mapdl ` class with the :func:`Mapdl.download() ` @@ -713,7 +886,7 @@ Or, filter by extensions as shown in this example: Upload a local MAPDL file -~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------- You can upload a local MAPDL file as the remote MAPDL instance with the :func:`Mapdl.upload() ` method: @@ -732,7 +905,7 @@ You can upload a local MAPDL file as the remote MAPDL instance with the Unsupported MAPDL commands and other considerations ---------------------------------------------------- +=================================================== Most MAPDL commands have been mapped Pythonically into their equivalent methods. Some commands, however, are not supported because either they are not applicable to an interactive session or they require @@ -743,7 +916,7 @@ handled on the MAPDL server. .. _ref_unsupported_commands: Unavailable commands -~~~~~~~~~~~~~~~~~~~~ +-------------------- Some commands are unavailable in PyMAPDL for a variety of reasons. Some of these commands do not make sense in a Python context. @@ -858,7 +1031,7 @@ method. The results should be same as running them in a normal batch MAPDL sessi .. _ref_unsupported_interactive_commands: Unsupported "interactive" commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------------------------- The following commands can be only run in non-interactive mode (inside a :attr:`Mapdl.non_interactive ` block or @@ -888,7 +1061,7 @@ are unsupported. Environment variables ---------------------- +===================== There are several PyMAPDL-specific environment variables that can be used to control the behavior or launching of PyMAPDL and MAPDL. From 141fa66859bd4aee5834a20b4543b275dfd50bbe Mon Sep 17 00:00:00 2001 From: German Date: Wed, 8 Nov 2023 13:47:48 +0100 Subject: [PATCH 02/15] Avoiding retriving parameters in non_interactive --- src/ansys/mapdl/core/parameters.py | 11 +++++++++++ tests/test_parameters.py | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/ansys/mapdl/core/parameters.py b/src/ansys/mapdl/core/parameters.py index 3b7487184b..3d6f2ac210 100644 --- a/src/ansys/mapdl/core/parameters.py +++ b/src/ansys/mapdl/core/parameters.py @@ -292,6 +292,10 @@ def type(self) -> int: @supress_logging def _parm(self): """Current MAPDL parameters""" + if self._mapdl._store_commands: + # in interactive mode + return {} + params = interp_star_status( self._mapdl.starstatus(avoid_non_interactive=True, mute=False) ) @@ -326,6 +330,13 @@ def __repr__(self): def __getitem__(self, key): """Return a parameter""" + if self._mapdl._store_commands: + raise MapdlRuntimeError( + "Cannot use `mapdl.parameters` to retrieve parameters when in " + "`non_interactive` mode. " + "Exit non_interactive mode before using this method." + ) + if not isinstance(key, str): raise TypeError("Parameter name must be a string") key = key.upper() diff --git a/tests/test_parameters.py b/tests/test_parameters.py index 85b187c8a9..2516f3a64f 100644 --- a/tests/test_parameters.py +++ b/tests/test_parameters.py @@ -427,3 +427,15 @@ def test_parameter_contains(mapdl, cleared): def test_non_existing_parameter(mapdl, cleared): with pytest.raises(KeyError): mapdl.parameters["A"] + + +def test_non_interactive(mapdl): + mapdl.parameters["asdf"] = 2 + with pytest.raises(MapdlRuntimeError): + with mapdl.non_interactive: + par = mapdl.parameters["asdf"] + + with mapdl.non_interactive: + mapdl.parameters["qwer"] = 3 + + assert mapdl.parameters["qwer"] == 3 From 9d162389d629b4f50fdd8f12ad26601945f29071 Mon Sep 17 00:00:00 2001 From: German Date: Wed, 8 Nov 2023 14:02:16 +0100 Subject: [PATCH 03/15] Fixing vale --- doc/source/user_guide/mapdl.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index ab1f4a99d0..03880d7438 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -15,6 +15,7 @@ translated from its original MAPDL all CAPS format to a PEP8 compatible format. For example, ``ESEL`` is now the :func:`Mapdl.esel() ` method. +.. vale off .. tab-set:: @@ -37,6 +38,7 @@ compatible format. For example, ``ESEL`` is now the # returns an array of selected elements ids mapdl.esel("S", "CENT", "X", 1, 2) +.. vale on Additionally, MAPDL commands containing a ``/`` or ``*`` have had those characters removed, unless @@ -201,7 +203,7 @@ The following code snippet is a demonstration of this kind of problem: assert klist_inside != klist_outside # Evaluates to true -In the above script, the values obtained by +In the preceding script, the values obtained by :func:`Mapdl.get_array() ` are different: .. code:: pycon From ea508a2a772bd19e1c4bbfb3b23ecf3b180a9393 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:57:50 +0100 Subject: [PATCH 04/15] Apply suggestions from code review --- doc/source/user_guide/mapdl.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 03880d7438..3bc494f81c 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -15,7 +15,6 @@ translated from its original MAPDL all CAPS format to a PEP8 compatible format. For example, ``ESEL`` is now the :func:`Mapdl.esel() ` method. -.. vale off .. tab-set:: @@ -31,14 +30,13 @@ compatible format. For example, ``ESEL`` is now the .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python # Selecting elements whose centroid x coordinate # is between the 1 and 2. # returns an array of selected elements ids mapdl.esel("S", "CENT", "X", 1, 2) -.. vale on Additionally, MAPDL commands containing a ``/`` or ``*`` have had those characters removed, unless From e273c537978fad7f87544aa6efa327ba7a11a9ca Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:11:53 +0100 Subject: [PATCH 05/15] Apply suggestions from code review --- doc/source/user_guide/mapdl.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 3bc494f81c..5cfb6dd89f 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -62,7 +62,7 @@ start with ``star (*)``. .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python mapdl.startstatus() mapdl.slashsolu() @@ -84,7 +84,7 @@ or, these commands can be called using keyword arguments: .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python mapdl.esel("s", "type", "", 1) mapdl.esel("s", "type", vmin=1) @@ -106,7 +106,7 @@ these commands, such as ``"/SOLU"``: .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python # The next three functions are equivalent. Enter the solution processor. mapdl.run("/SOLU") @@ -252,7 +252,7 @@ a file) do not appear to run correctly. For example, here is the macro .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python def DISP( ARG1="", @@ -421,7 +421,7 @@ attribute. For example: .. tab-item:: Python-Non interactive :sync: key3 - .. code:: python + .. code:: Python with mapdl.non_interactive: mapdl.run("*IF,ARG1,EQ,0,THEN") @@ -446,7 +446,7 @@ attribute. For example: .. tab-item:: Python :sync: key2 - .. code:: python + .. code:: Python # MAPDL parameters can be obtained using load_parameters if ARG1 == 0: From e0ae893e91be3403f2ae06b4f674c7e3ce22f5ee Mon Sep 17 00:00:00 2001 From: German Date: Wed, 8 Nov 2023 17:31:09 +0100 Subject: [PATCH 06/15] Fixing vale --- doc/source/user_guide/mapdl.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 5cfb6dd89f..99b57c74f5 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -30,7 +30,7 @@ compatible format. For example, ``ESEL`` is now the .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python # Selecting elements whose centroid x coordinate # is between the 1 and 2. @@ -62,7 +62,7 @@ start with ``star (*)``. .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python mapdl.startstatus() mapdl.slashsolu() @@ -84,7 +84,7 @@ or, these commands can be called using keyword arguments: .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python mapdl.esel("s", "type", "", 1) mapdl.esel("s", "type", vmin=1) @@ -106,7 +106,7 @@ these commands, such as ``"/SOLU"``: .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python # The next three functions are equivalent. Enter the solution processor. mapdl.run("/SOLU") @@ -180,7 +180,7 @@ which is executed with a :func:`Mapdl.input() ` ca Because of the non-interactive context not running all the commands until the end, you might find issues interacting inside it, with Python for instance. -For example, running python commands such as +For example, running Python commands such as :func:`Mapdl.get_array() ` inside the context can give you out-of-sync responses. The following code snippet is a demonstration of this kind of problem: @@ -252,7 +252,7 @@ a file) do not appear to run correctly. For example, here is the macro .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python def DISP( ARG1="", @@ -421,7 +421,7 @@ attribute. For example: .. tab-item:: Python-Non interactive :sync: key3 - .. code:: Python + .. code:: python with mapdl.non_interactive: mapdl.run("*IF,ARG1,EQ,0,THEN") @@ -446,7 +446,7 @@ attribute. For example: .. tab-item:: Python :sync: key2 - .. code:: Python + .. code:: python # MAPDL parameters can be obtained using load_parameters if ARG1 == 0: From 59c3e740b57a010f6f9f55917949c57ed44d1498 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:05:05 +0100 Subject: [PATCH 07/15] Apply suggestions from code review Co-authored-by: Camille <78221213+clatapie@users.noreply.github.com> --- doc/source/user_guide/mapdl.rst | 36 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 99b57c74f5..3c4f74f72d 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -448,23 +448,29 @@ attribute. For example: .. code:: python - # MAPDL parameters can be obtained using load_parameters if ARG1 == 0: - mapdl.run("*GET,ARG4,NX,ARG2 ") # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES - mapdl.run("*GET,ARG5,NY,ARG2") - mapdl.run("*GET,ARG6,NZ,ARG2") - mapdl.run("*GET,ARG7,NX,ARG3") - mapdl.run("*GET,ARG8,NY,ARG3") - mapdl.run("*GET,ARG9,NZ,ARG3") + mapdl.get(ARG4,"NX",ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES + mapdl.get(ARG5,"NY",ARG2) + mapdl.get(ARG6,"NZ",ARG2) + mapdl.get(ARG7,"NX",ARG3) + mapdl.get(ARG8,"NY",ARG3) + mapdl.get(ARG9,"NZ",ARG3) else: - mapdl.run( - "*GET,ARG4,KX,ARG2 " - ) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS - mapdl.run("*GET,ARG5,KY,ARG2") - mapdl.run("*GET,ARG6,KZ,ARG2") - mapdl.run("*GET,ARG7,KX,ARG3") - mapdl.run("*GET,ARG8,KY,ARG3") - mapdl.run("*GET,ARG9,KZ,ARG3") + mapdl.get(ARG4,"KX",ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS + mapdl.get(ARG5,"KY",ARG2) + mapdl.get(ARG6,"KZ",ARG2) + mapdl.get(ARG7,"KX",ARG3) + mapdl.get(ARG8,"KY",ARG3) + mapdl.get(ARG9,"KZ",ARG3) +In any case, the vales of `ARGX` parameters is not retrieved from the MAPDL instance. +Meaning you cannot use those arguments in python code unless you do: + +.. code:: python + + ARG4 = mapdl.parameters["ARG4"] + ARG5 = mapdl.parameters["ARG5"] + # ... + # etc APDL loops using ``*DO`` or ``*DOWHILE`` should also be implemented using the :attr:`Mapdl.non_interactive ` From 0b2fd994f20ba073653de88c609dbae483a48542 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:05:32 +0000 Subject: [PATCH 08/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/source/user_guide/mapdl.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 3c4f74f72d..0f036c4f53 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -449,19 +449,19 @@ attribute. For example: .. code:: python if ARG1 == 0: - mapdl.get(ARG4,"NX",ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES - mapdl.get(ARG5,"NY",ARG2) - mapdl.get(ARG6,"NZ",ARG2) - mapdl.get(ARG7,"NX",ARG3) - mapdl.get(ARG8,"NY",ARG3) - mapdl.get(ARG9,"NZ",ARG3) + mapdl.get(ARG4, "NX", ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH NODES + mapdl.get(ARG5, "NY", ARG2) + mapdl.get(ARG6, "NZ", ARG2) + mapdl.get(ARG7, "NX", ARG3) + mapdl.get(ARG8, "NY", ARG3) + mapdl.get(ARG9, "NZ", ARG3) else: - mapdl.get(ARG4,"KX",ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS - mapdl.get(ARG5,"KY",ARG2) - mapdl.get(ARG6,"KZ",ARG2) - mapdl.get(ARG7,"KX",ARG3) - mapdl.get(ARG8,"KY",ARG3) - mapdl.get(ARG9,"KZ",ARG3) + mapdl.get(ARG4, "KX", ARG2) # RETRIEVE COORDINATE LOCATIONS OF BOTH KEYPOINTS + mapdl.get(ARG5, "KY", ARG2) + mapdl.get(ARG6, "KZ", ARG2) + mapdl.get(ARG7, "KX", ARG3) + mapdl.get(ARG8, "KY", ARG3) + mapdl.get(ARG9, "KZ", ARG3) In any case, the vales of `ARGX` parameters is not retrieved from the MAPDL instance. Meaning you cannot use those arguments in python code unless you do: From 8a2478987da99434fcb749c2d5bea68ff7185ece Mon Sep 17 00:00:00 2001 From: German Date: Mon, 20 Nov 2023 17:13:30 +0100 Subject: [PATCH 09/15] Fixing vale and format issues --- doc/source/user_guide/mapdl.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 0f036c4f53..9f6f412fc2 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -462,8 +462,9 @@ attribute. For example: mapdl.get(ARG7, "KX", ARG3) mapdl.get(ARG8, "KY", ARG3) mapdl.get(ARG9, "KZ", ARG3) -In any case, the vales of `ARGX` parameters is not retrieved from the MAPDL instance. -Meaning you cannot use those arguments in python code unless you do: + +The values of ``ARGX`` parameters are not retrieved from the MAPDL instance. +Hence you cannot use those arguments in Python code unless you use the following commands: .. code:: python From a7343f6be66e9d1270f1874e209e371c4df7f420 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:16:45 +0100 Subject: [PATCH 10/15] Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- doc/source/user_guide/mapdl.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 9f6f412fc2..fb7d79b2ce 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -24,7 +24,7 @@ compatible format. For example, ``ESEL`` is now the .. code:: apdl ! Selecting elements whose centroid x coordinate - ! is between the 1 and 2. + ! is between 1 and 2. ESEL, S, CENT, X, 1, 2 .. tab-item:: Python @@ -33,7 +33,7 @@ compatible format. For example, ``ESEL`` is now the .. code:: python # Selecting elements whose centroid x coordinate - # is between the 1 and 2. + # is between 1 and 2. # returns an array of selected elements ids mapdl.esel("S", "CENT", "X", 1, 2) @@ -136,29 +136,29 @@ method. Here is an example: You can then view the final response of the non-interactive context with the :attr:`Mapdl.last_response ` attribute. -Using :meth:`Mapdl.non_interactive() ` -can also be useful to run commands on the server side without the interaction +Using the :meth:`Mapdl.non_interactive() ` +method can also be useful to run commands on the server side without the interaction of Python. This can speed up things greatly, but you should be aware of how APDL works. An interesting discussion about speed comparison between PyMAPDL and APDL can be found in `here `_. -It is recommended to use -:meth:`Mapdl.non_interactive() ` with precaution. +You should use the +:meth:`Mapdl.non_interactive() ` method with caution. -How non-interactive context manager works -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +How the non-interactive context manager works +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The :meth:`Mapdl.non_interactive() ` is implemented -as a `context manager `_ which means that there are some actions +The :meth:`Mapdl.non_interactive() ` method is implemented +as a `context manager `_, which means that there are some actions happening when entering and exit the context. -When entering the context, :class:`Mapdl ` stops sending any APDL +When entering the context, the class:`Mapdl ` instance stops sending any APDL command to the MAPDL instance. Instead, it allocates a buffer for those APDL commands. For each PyMAPDL command inside that context, PyMAPDL stores the equivalent MAPDL command inside that buffer. Right before exiting the context, PyMAPDL creates a text file with all these APDL commands, sends it to -the MAPDL instance and runs it using -:func:`Mapdl.input() `. +the MAPDL instance, and runs it using the +:meth:`Mapdl.input() ` method. For instance, the following :meth:`non_interactive context `: From 119b4540c5f4dc0f7e815b87048da3d3ff85b890 Mon Sep 17 00:00:00 2001 From: German Date: Tue, 21 Nov 2023 16:17:49 +0100 Subject: [PATCH 11/15] Code review --- doc/source/user_guide/mapdl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 9f6f412fc2..557733409d 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -140,7 +140,7 @@ Using :meth:`Mapdl.non_interactive() ` can also be useful to run commands on the server side without the interaction of Python. This can speed up things greatly, but you should be aware of how APDL works. An interesting discussion about speed comparison between PyMAPDL and APDL -can be found in `here `_. +can be found in `Speed comparison between PyMAPDL and APDL `_. It is recommended to use :meth:`Mapdl.non_interactive() ` with precaution. From 393d3e0f3eff0d6127c203eacd36973ade32fb34 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:53:53 +0100 Subject: [PATCH 12/15] Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- doc/source/user_guide/mapdl.rst | 27 +++++++++++++-------------- src/ansys/mapdl/core/parameters.py | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index e7dea24564..97e44c7f36 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -161,7 +161,7 @@ the MAPDL instance, and runs it using the :meth:`Mapdl.input() ` method. -For instance, the following :meth:`non_interactive context `: +For instance, this example code uses the :meth:`non_interactive context ` method to generate input for MAPDL: .. code:: python @@ -169,7 +169,7 @@ For instance, the following :meth:`non_interactive context ` ca Because of the non-interactive context not running all the commands until the end, you might find issues interacting inside it, with Python for instance. -For example, running Python commands such as -:func:`Mapdl.get_array() ` +For example, running Python commands such as the +:meth:`Mapdl.get_array() ` method inside the context can give you out-of-sync responses. The following code snippet is a demonstration of this kind of problem: @@ -201,8 +201,8 @@ The following code snippet is a demonstration of this kind of problem: assert klist_inside != klist_outside # Evaluates to true -In the preceding script, the values obtained by -:func:`Mapdl.get_array() ` are different: +In the preceding script, the values obtained by the +:meth:`Mapdl.get_array() ` method are different: .. code:: pycon @@ -211,21 +211,20 @@ In the preceding script, the values obtained by >>> print(klist_outside) array([1., 2., 3.]) -This is because the first :func:`Mapdl.get_array() ` +This is because the first :meth:`Mapdl.get_array() ` call is executed actually *before* the :func:`Mapdl.k() ` call. -It is recommend to not retrieve any data in a pythonic way from the MAPDL instance while in the -:meth:`non_interactive context `. -Being aware of this kind of behavior and how -:meth:`non_interactive context ` -works is crucial for an advanced usage of PyMAPDL. +You should not retrieve any data in a Pythonic way from the MAPDL instance while using the +:meth:`non_interactive context ` method. +Being aware of this kind of behavior and how the :meth:`non_interactive context ` method +works is crucial for advanced usage of PyMAPDL. MAPDL macros ------------ Note that macros created within PyMAPDL (rather than loaded from -a file) do not appear to run correctly. For example, here is the macro -``DISP`` created using the ``*CREATE`` command within APDL and within PyMAPDL: +a file) do not appear to run correctly. For example, here is the ``DISP`` +macro created using the ``*CREATE`` command within APDL and within PyMAPDL: .. tab-set:: diff --git a/src/ansys/mapdl/core/parameters.py b/src/ansys/mapdl/core/parameters.py index 3d6f2ac210..714ee9779a 100644 --- a/src/ansys/mapdl/core/parameters.py +++ b/src/ansys/mapdl/core/parameters.py @@ -334,7 +334,7 @@ def __getitem__(self, key): raise MapdlRuntimeError( "Cannot use `mapdl.parameters` to retrieve parameters when in " "`non_interactive` mode. " - "Exit non_interactive mode before using this method." + "Exit `non_interactive` mode before using this method." ) if not isinstance(key, str): From cf534190a5178447cb15cf10f28bbf2289fa889f Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:54:30 +0100 Subject: [PATCH 13/15] Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- doc/source/user_guide/mapdl.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 97e44c7f36..4d9ed18c3d 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -176,7 +176,7 @@ The preceding code generates this input for MAPDL: NSEL,ALL NSEL,R,LOC,Z,10 -which is executed with a :func:`Mapdl.input() ` call. +This MAPLD input is executed with a :meth:`Mapdl.input() ` method call. Because of the non-interactive context not running all the commands until the end, you might find issues interacting inside it, with Python for instance. @@ -212,7 +212,7 @@ In the preceding script, the values obtained by the array([1., 2., 3.]) This is because the first :meth:`Mapdl.get_array() ` -call is executed actually *before* the :func:`Mapdl.k() ` call. +method call is executed *before* the :meth:`Mapdl.k() ` method call. You should not retrieve any data in a Pythonic way from the MAPDL instance while using the :meth:`non_interactive context ` method. @@ -521,7 +521,7 @@ Prompts ------- Prompts from MAPDL automatically continued as if MAPDL is in batch mode. Commands requiring user input, such as the -:func:`Mapdl.vwrite() ` method fail +:meth:`Mapdl.vwrite() ` method, fail and must be entered in non-interactively. From a2ad1fd01e2d6e1d9ca48faa7b4d64752490d5ed Mon Sep 17 00:00:00 2001 From: German Date: Tue, 21 Nov 2023 16:55:12 +0100 Subject: [PATCH 14/15] error typo --- src/ansys/mapdl/core/parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/mapdl/core/parameters.py b/src/ansys/mapdl/core/parameters.py index 3d6f2ac210..e9960b352b 100644 --- a/src/ansys/mapdl/core/parameters.py +++ b/src/ansys/mapdl/core/parameters.py @@ -338,7 +338,7 @@ def __getitem__(self, key): ) if not isinstance(key, str): - raise TypeError("Parameter name must be a string") + raise TypeError("Parameter name must be a string.") key = key.upper() with self.full_parameters_output: From a59525c1d5ca9951fb1aad4d4e1e470c1c84004c Mon Sep 17 00:00:00 2001 From: German Date: Tue, 21 Nov 2023 17:03:17 +0100 Subject: [PATCH 15/15] fixing link --- doc/source/user_guide/mapdl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/mapdl.rst b/doc/source/user_guide/mapdl.rst index 4d9ed18c3d..b8475296f8 100644 --- a/doc/source/user_guide/mapdl.rst +++ b/doc/source/user_guide/mapdl.rst @@ -151,7 +151,7 @@ How the non-interactive context manager works The :meth:`Mapdl.non_interactive() ` method is implemented as a `context manager `_, which means that there are some actions happening when entering and exit the context. -When entering the context, the class:`Mapdl ` instance stops sending any APDL +When entering the context, the :class:`Mapdl ` instance stops sending any APDL command to the MAPDL instance. Instead, it allocates a buffer for those APDL commands. For each PyMAPDL command inside that context, PyMAPDL stores the equivalent MAPDL command