From aa784804f05b793c1c2d162d9dbc553f97088dfc Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:09:21 +0100 Subject: [PATCH 01/10] feat: adding ``graphics`` submodule --- .../mapdl_commands/graphics/annotation.rst | 45 +- doc/source/mapdl_commands/graphics/graphs.rst | 33 +- doc/source/mapdl_commands/graphics/index.rst | 28 + .../mapdl_commands/graphics/labeling.rst | 49 +- .../mapdl_commands/graphics/scaling.rst | 33 +- doc/source/mapdl_commands/graphics/set_up.rst | 43 + doc/source/mapdl_commands/graphics/setup.rst | 39 - doc/source/mapdl_commands/graphics/style.rst | 45 +- doc/source/mapdl_commands/graphics/views.rst | 38 +- .../{graphics_ => graphics}/__init__.py | 10 +- .../core/_commands/graphics/annotation.py | 842 +++++++++ .../mapdl/core/_commands/graphics/graphs.py | 339 ++++ .../mapdl/core/_commands/graphics/labeling.py | 1237 +++++++++++++ .../mapdl/core/_commands/graphics/scaling.py | 239 +++ .../mapdl/core/_commands/graphics/set_up.py | 1530 +++++++++++++++++ .../mapdl/core/_commands/graphics/style.py | 923 ++++++++++ .../mapdl/core/_commands/graphics/views.py | 545 ++++++ .../core/_commands/graphics_/annotation.py | 871 ---------- .../mapdl/core/_commands/graphics_/graphs.py | 374 ---- .../core/_commands/graphics_/labeling.py | 1224 ------------- .../mapdl/core/_commands/graphics_/scaling.py | 447 ----- .../mapdl/core/_commands/graphics_/setup.py | 1313 -------------- .../mapdl/core/_commands/graphics_/style.py | 729 -------- .../mapdl/core/_commands/graphics_/views.py | 457 ----- src/ansys/mapdl/core/commands.py | 16 +- 25 files changed, 5876 insertions(+), 5573 deletions(-) create mode 100644 doc/source/mapdl_commands/graphics/index.rst create mode 100644 doc/source/mapdl_commands/graphics/set_up.rst delete mode 100644 doc/source/mapdl_commands/graphics/setup.rst rename src/ansys/mapdl/core/_commands/{graphics_ => graphics}/__init__.py (91%) create mode 100644 src/ansys/mapdl/core/_commands/graphics/annotation.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/graphs.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/labeling.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/scaling.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/set_up.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/style.py create mode 100644 src/ansys/mapdl/core/_commands/graphics/views.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/annotation.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/graphs.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/labeling.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/scaling.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/setup.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/style.py delete mode 100644 src/ansys/mapdl/core/_commands/graphics_/views.py diff --git a/doc/source/mapdl_commands/graphics/annotation.rst b/doc/source/mapdl_commands/graphics/annotation.rst index a32ec936573..1184b9bf445 100644 --- a/doc/source/mapdl_commands/graphics/annotation.rst +++ b/doc/source/mapdl_commands/graphics/annotation.rst @@ -1,26 +1,31 @@ -.. _ref_annotation_api: -********** +.. _ref_annotation: + + Annotation -********** +========== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.annotation -These GRAPHICS commands are used to annotate a display with notes and -symbols. +.. autoclass:: ansys.mapdl.core._commands.graphics.annotation.Annotation .. autosummary:: - :toctree: _autosummary/ - - Mapdl.an3d - Mapdl.annot - Mapdl.anum - Mapdl.lspec - Mapdl.lsymbol - Mapdl.slash_pcircle - Mapdl.pmore - Mapdl.polygon - Mapdl.pspec - Mapdl.pwedge - Mapdl.tlabel - Mapdl.tspec + :template: base.rst + :toctree: _autosummary + + + Annotation.an3d + Annotation.annot + Annotation.anum + Annotation.lspec + Annotation.lsymbol + Annotation.pcircle + Annotation.pmore + Annotation.polygon + Annotation.pwedge + Annotation.slashlarc + Annotation.slashline + Annotation.slashpspec + Annotation.tlabel + Annotation.tspec diff --git a/doc/source/mapdl_commands/graphics/graphs.rst b/doc/source/mapdl_commands/graphics/graphs.rst index 0afd86b213f..4c5fc934430 100644 --- a/doc/source/mapdl_commands/graphics/graphs.rst +++ b/doc/source/mapdl_commands/graphics/graphs.rst @@ -1,21 +1,24 @@ -.. _ref_graphs_api: -****** +.. _ref_graphs: + + Graphs -****** +====== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.graphs -These GRAPHICS commands are used to control the way line graphs are -displayed. +.. autoclass:: ansys.mapdl.core._commands.graphics.graphs.Graphs .. autosummary:: - :toctree: _autosummary/ - - Mapdl.axlab - Mapdl.grid - Mapdl.gropt - Mapdl.grtyp - Mapdl.gthk - Mapdl.xrange - Mapdl.yrange + :template: base.rst + :toctree: _autosummary + + + Graphs.axlab + Graphs.grid + Graphs.gropt + Graphs.grtyp + Graphs.gthk + Graphs.xrange + Graphs.yrange diff --git a/doc/source/mapdl_commands/graphics/index.rst b/doc/source/mapdl_commands/graphics/index.rst new file mode 100644 index 00000000000..3cf0e8c47ae --- /dev/null +++ b/doc/source/mapdl_commands/graphics/index.rst @@ -0,0 +1,28 @@ + +.. _ref_graphics: + +Graphics +======== + +.. list-table:: + + * - :ref:`ref_labeling` + * - :ref:`ref_set_up` + * - :ref:`ref_scaling` + * - :ref:`ref_views` + * - :ref:`ref_style` + * - :ref:`ref_annotation` + * - :ref:`ref_graphs` + + +.. toctree:: + :maxdepth: 1 + :hidden: + + labeling + set_up + scaling + views + style + annotation + graphs diff --git a/doc/source/mapdl_commands/graphics/labeling.rst b/doc/source/mapdl_commands/graphics/labeling.rst index 7445b7972ed..932a94f2ba2 100644 --- a/doc/source/mapdl_commands/graphics/labeling.rst +++ b/doc/source/mapdl_commands/graphics/labeling.rst @@ -1,29 +1,32 @@ -.. _ref_labeling_api: -******** +.. _ref_labeling: + + Labeling -******** +======== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.labeling -These GRAPHICS commands are used to add helpful labels and symbols to -displays. +.. autoclass:: ansys.mapdl.core._commands.graphics.labeling.Labeling .. autosummary:: - :toctree: _autosummary/ - - Mapdl.cformat - Mapdl.clabel - Mapdl.contour - Mapdl.cval - Mapdl.gformat - Mapdl.hbc - Mapdl.number - Mapdl.pbc - Mapdl.pbf - Mapdl.plopts - Mapdl.pnum - Mapdl.psf - Mapdl.psymb - Mapdl.triad - Mapdl.udoc + :template: base.rst + :toctree: _autosummary + + + Labeling.cformat + Labeling.clabel + Labeling.contour + Labeling.cval + Labeling.gformat + Labeling.hbc + Labeling.number + Labeling.pbc + Labeling.pbf + Labeling.plopts + Labeling.pnum + Labeling.psf + Labeling.psymb + Labeling.triad + Labeling.udoc diff --git a/doc/source/mapdl_commands/graphics/scaling.rst b/doc/source/mapdl_commands/graphics/scaling.rst index 063276bb84b..b3b64216768 100644 --- a/doc/source/mapdl_commands/graphics/scaling.rst +++ b/doc/source/mapdl_commands/graphics/scaling.rst @@ -1,21 +1,24 @@ -.. _ref_scaling_api: -******* +.. _ref_scaling: + + Scaling -******* +======= + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.scaling -These GRAPHICS commands are used to scale various parts of the -display. +.. autoclass:: ansys.mapdl.core._commands.graphics.scaling.Scaling .. autosummary:: - :toctree: _autosummary/ - - Mapdl.iclwid - Mapdl.icscale - Mapdl.ratio - Mapdl.shrink - Mapdl.sscale - Mapdl.txtre - Mapdl.vscale + :template: base.rst + :toctree: _autosummary + + + Scaling.iclwid + Scaling.icscale + Scaling.ratio + Scaling.shrink + Scaling.slashdscale + Scaling.sscale + Scaling.vscale diff --git a/doc/source/mapdl_commands/graphics/set_up.rst b/doc/source/mapdl_commands/graphics/set_up.rst new file mode 100644 index 00000000000..9fb6de27e15 --- /dev/null +++ b/doc/source/mapdl_commands/graphics/set_up.rst @@ -0,0 +1,43 @@ + +.. _ref_set_up: + + +SetUp +===== + + +.. currentmodule:: ansys.mapdl.core._commands.graphics.set_up + +.. autoclass:: ansys.mapdl.core._commands.graphics.set_up.SetUp + +.. autosummary:: + :template: base.rst + :toctree: _autosummary + + + SetUp.cmap + SetUp.color + SetUp.device + SetUp.dsys + SetUp.dv3d + SetUp.gcmd + SetUp.gcolumn + SetUp.gfile + SetUp.gplot + SetUp.graphics + SetUp.gresume + SetUp.gsave + SetUp.gtype + SetUp.image + SetUp.immed + SetUp.jpeg + SetUp.mrep + SetUp.noerase + SetUp.pngr + SetUp.pstatus + SetUp.replot + SetUp.seg + SetUp.show + SetUp.slashreset + SetUp.tiff + SetUp.window diff --git a/doc/source/mapdl_commands/graphics/setup.rst b/doc/source/mapdl_commands/graphics/setup.rst deleted file mode 100644 index ff8e58f1d4a..00000000000 --- a/doc/source/mapdl_commands/graphics/setup.rst +++ /dev/null @@ -1,39 +0,0 @@ -.. _ref_graphics_setup_api: - -***** -Setup -***** - -.. currentmodule:: ansys.mapdl.core - -These GRAPHICS commands are used for general graphics control, such as -window setup, color settings, specifications saving, etc. - -.. autosummary:: - :toctree: _autosummary/ - - Mapdl.color - Mapdl.device - Mapdl.dsys - Mapdl.dv3d - Mapdl.gcmd - Mapdl.gcolumn - Mapdl.gfile - Mapdl.gplot - Mapdl.graphics - Mapdl.gresume - Mapdl.gsave - Mapdl.gtype - Mapdl.image - Mapdl.jpeg - Mapdl.mrep - Mapdl.pcopy - Mapdl.pngr - Mapdl.pscr - Mapdl.pstatus - Mapdl.replot - Mapdl.slashreset - Mapdl.seg - Mapdl.show - Mapdl.tiff - Mapdl.window diff --git a/doc/source/mapdl_commands/graphics/style.rst b/doc/source/mapdl_commands/graphics/style.rst index e02d8c9c1de..22a7e62ae08 100644 --- a/doc/source/mapdl_commands/graphics/style.rst +++ b/doc/source/mapdl_commands/graphics/style.rst @@ -1,26 +1,31 @@ -.. _ref_style_api: -***** +.. _ref_style: + + Style -***** +===== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.style -These GRAPHICS commands are used to change the way a model is -displayed. +.. autoclass:: ansys.mapdl.core._commands.graphics.style.Style .. autosummary:: - :toctree: _autosummary/ - - Mapdl.cplane - Mapdl.ctype - Mapdl.edge - Mapdl.eshape - Mapdl.facet - Mapdl.gline - Mapdl.gmarker - Mapdl.gmface - Mapdl.light - Mapdl.normal - Mapdl.shade - Mapdl.trlcy + :template: base.rst + :toctree: _autosummary + + + Style.cplane + Style.ctype + Style.edge + Style.eshape + Style.facet + Style.gline + Style.gmarker + Style.gmface + Style.light + Style.normal + Style.shade + Style.slashtype + Style.trlcy + Style.txtre diff --git a/doc/source/mapdl_commands/graphics/views.rst b/doc/source/mapdl_commands/graphics/views.rst index 6fae00ee2a4..332b80941d1 100644 --- a/doc/source/mapdl_commands/graphics/views.rst +++ b/doc/source/mapdl_commands/graphics/views.rst @@ -1,23 +1,27 @@ -.. _ref_views_api: -***** +.. _ref_views: + + Views -***** +===== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.graphics.views -These GRAPHICS commands are used to control the view of the model. +.. autoclass:: ansys.mapdl.core._commands.graphics.views.Views .. autosummary:: - :toctree: _autosummary/ - - Mapdl.angle - Mapdl.auto - Mapdl.dist - Mapdl.focus - Mapdl.user - Mapdl.vcone - Mapdl.view - Mapdl.vup - Mapdl.xfrm - Mapdl.zoom + :template: base.rst + :toctree: _autosummary + + + Views.angle + Views.auto + Views.dist + Views.focus + Views.user + Views.vcone + Views.view + Views.vup + Views.xfrm + Views.zoom diff --git a/src/ansys/mapdl/core/_commands/graphics_/__init__.py b/src/ansys/mapdl/core/_commands/graphics/__init__.py similarity index 91% rename from src/ansys/mapdl/core/_commands/graphics_/__init__.py rename to src/ansys/mapdl/core/_commands/graphics/__init__.py index a827eef7045..bc9a75ca366 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/__init__.py +++ b/src/ansys/mapdl/core/_commands/graphics/__init__.py @@ -20,4 +20,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from . import annotation, graphs, labeling, scaling, setup, style, views +from . import ( + annotation, + graphs, + labeling, + scaling, + set_up, + style, + views, +) diff --git a/src/ansys/mapdl/core/_commands/graphics/annotation.py b/src/ansys/mapdl/core/_commands/graphics/annotation.py new file mode 100644 index 00000000000..9192f631a7c --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/annotation.py @@ -0,0 +1,842 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Annotation: + + def lsymbol( + self, + x: str = "", + y: str = "", + symang: str = "", + symtyp: int | str = "", + symsiz: str = "", + keybmp: str = "", + **kwargs, + ): + r"""Creates annotation symbols (GUI). + + Mechanical APDL Command: `/LSYMBOL `_ + + Parameters + ---------- + x : str + X location for symbol (-1.0 < X < 2.0). + + y : str + Y location for symbol (-1.0 < Y < 1.0). + + symang : str + Symbol orientation angle. + + symtyp : int or str + Symbol type: + + * ``1`` - Arrow. + + * ``2`` - Tee. + + * ``3`` - Circle. + + * ``4`` - Triangle. + + * ``5`` - Star. + + symsiz : str + Symbol size multiplier (0.1 to 20.0). Defaults to 1.0. + + keybmp : str + If ``KEYBMP`` = 1, the annotation is a bitmap. ``SYMTYP`` will then be a number from 1-99, + indicating the bitmap type (see notes), and ``X`` and ``Y`` will define the lower left corner of + the bitmap. The ``SYMANG``, ``SYMSIZ`` arguments are ignored. If ``KEYBMP`` = 0, or blank, then + the argument definitions above apply. + + Notes + ----- + + .. _s-LSYMBOL_notes: + + Defines annotation symbols to be written directly onto the display at a specified location. This is + a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation + is used. This command is not intended to be typed in directly in a Mechanical APDL session (although + it can + be included in an input file for batch input or for use with the :ref:`input` command). + + All symbols are shown on subsequent displays unless the annotation is turned off or deleted. Use the + :ref:`lspec` command to set the attributes of the symbol. + + The ``KEYBMP`` argument reads the symtype argument to determine which bitmap to insert. This bitmap + is defined by an integer between 1 and 99. Numbers 1 through 40 correspond to the standard texture + values found in the :ref:`txtre` command, while numbers 51 through 99 correspond to user supplied + bitmaps, as defined using the Filename option of the :ref:`txtre` command. Numbers 51 through 57 are + predefined (the logos, clamps and arrows available from the GUI) but can be overridden. Numbers 41 + through 50 are reserved. + + This command is valid in any processor. + """ + command = f"/LSYMBOL,{x},{y},{symang},{symtyp},{symsiz},{keybmp}" + return self.run(command, **kwargs) + + def lspec( + self, lcolor: str = "", linstl: int | str = "", xlnwid: str = "", **kwargs + ): + r"""Specifies annotation line attributes (GUI). + + Mechanical APDL Command: `/LSPEC `_ + + Parameters + ---------- + lcolor : str + + linstl : int or str + Line style: + + * ``0`` - Solid line. + + * ``1`` - Dashed line. + + xlnwid : str + Line width multiplier (1.0 to 20.0). Defaults to 1.0. + + Notes + ----- + + .. _s-LSPEC_notes: + + This command specifies annotation line attributes to control certain characteristics of the lines + created via the :ref:`slashline`, :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, + :ref:`pcircle`, and :ref:`pwedge` commands. + + The command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + This command is valid in any processor. + """ + command = f"/LSPEC,{lcolor},{linstl},{xlnwid}" + return self.run(command, **kwargs) + + def slashlarc( + self, + xcentr: str = "", + ycentr: str = "", + xlrad: str = "", + angle1: str = "", + angle2: str = "", + **kwargs, + ): + r"""Creates annotation arcs (GUI). + + Mechanical APDL Command: `/LARC `_ + + Parameters + ---------- + xcentr : str + Arc X center location (-1.0 < X < 1.0). + + ycentr : str + Arc Y center location (-1.0 < Y < 1.0). + + xlrad : str + Arc radius length. + + angle1 : str + Starting angle of arc. + + angle2 : str + Ending angle of arc. The arc is drawn counterclockwise from the starting angle, ``ANGLE1``, to + the ending angle, ``ANGLE2``. + + Notes + ----- + + .. _s-LARC_notes: + + This command defines annotation arcs to be written directly onto the display at a specified + location. + + The command is generated by the Graphical User Interface (GUI) and will appear in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + All arcs are shown on subsequent displays unless the annotation is turned off or deleted. Issueu + :ref:`lspec` to set the attributes of the arc. + + This command is valid in any processor. + """ + command = f"/LARC,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" + return self.run(command, **kwargs) + + def slashline( + self, x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs + ): + r"""Creates annotation lines (GUI). + + Mechanical APDL Command: `/LINE `_ + + Parameters + ---------- + x1 : str + Line X starting location (-1.0 < X < 2.0). + + y1 : str + Line Y starting location (-1.0 < Y < 1.0). + + x2 : str + Line X ending location (-1.0 < X < 2.0). + + y2 : str + Line Y ending location (-1.0 < Y < 1.0). + + Notes + ----- + + .. _s-LINE_notes: + + This command defines annotation lines to be written directly onto the display at a specified + location. + + The command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + All lines are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` to set the attributes of the line. + + This command is valid in any processor. + """ + command = f"/LINE,{x1},{y1},{x2},{y2}" + return self.run(command, **kwargs) + + def slashpspec( + self, + pcolor: int | str = "", + kfill: int | str = "", + kbordr: int | str = "", + **kwargs, + ): + r"""Creates annotation polygon attributes (GUI). + + Mechanical APDL Command: `/PSPEC `_ + + Parameters + ---------- + pcolor : int or str + Polygon color (0 :math:`` ``PCOLOR`` :math:`` 15): + + * ``0`` - Black. + + * ``1`` - Red-Magenta. + + * ``2`` - Magenta. + + * ``3`` - Blue-Magenta. + + * ``4`` - Blue. + + * ``5`` - Cyan-Blue. + + * ``6`` - Cyan. + + * ``7`` - Green-Cyan. + + * ``8`` - Green. + + * ``9`` - Yellow-Green. + + * ``10`` - Yellow. + + * ``11`` - Orange. + + * ``12`` - Red. + + * ``13`` - Dark Gray. + + * ``14`` - Light Gray. + + * ``15`` - White. + + kfill : int or str + Polygon fill key: + + * ``0`` - Hollow polygon. + + * ``1`` - Filled polygon. + + kbordr : int or str + Polygon border key: + + * ``0`` - No border. + + * ``1`` - Border. + + Notes + ----- + + .. _s-PSPEC_notes: + + Creates annotation polygon attributes to control certain characteristics of the polygons created via + :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, and :ref:`pwedge`. + + This command is generated by the graphical user interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with + :ref:`input` ). + + This command is valid in any processor. + """ + command = f"/PSPEC,{pcolor},{kfill},{kbordr}" + return self.run(command, **kwargs) + + def polygon( + self, + nvert: str = "", + x1: str = "", + y1: str = "", + x2: str = "", + y2: str = "", + x3: str = "", + y3: str = "", + x4: str = "", + y4: str = "", + **kwargs, + ): + r"""Creates annotation polygons (GUI). + + Mechanical APDL Command: `/POLYGON `_ + + Parameters + ---------- + nvert : str + Number of vertices of polygon (3 :math:`` ``NVERT`` :math:`` 8). Use :ref:`pmore` for + polygons with more than 4 vertices. + + x1 : str + X location for vertex 1 of polygon (-1.0 < X < 2.0). + + y1 : str + Y location for vertex 1 of polygon (-1.0 < Y < 1.0). + + x2 : str + X location for vertex 2 of polygon (-1.0 < X < 2.0). + + y2 : str + Y location for vertex 2 of polygon (-1.0 < Y < 1.0). + + x3 : str + X location for vertex 3 of polygon (-1.0 < X < 2.0). + + y3 : str + Y location for vertex 3 of polygon (-1.0 < Y < 1.0). + + x4 : str + X location for vertex 4 of polygon (-1.0 < X < 2.0). + + y4 : str + Y location for vertex 4 of polygon (-1.0 < Y < 1.0). + + Notes + ----- + + .. _s-POLYGON_notes: + + Creates annotation polygons to be written directly onto the display at a specified location. This is + a command generated by the Graphical User Interface (GUI) and will appear in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + All polygons are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the polygon. Issue :ref:`pmore` to + define the 5th through 8th vertices of the polygon. + + This command is valid in any processor. + """ + command = f"/POLYGON,{nvert},{x1},{y1},{x2},{y2},{x3},{y3},{x4},{y4}" + return self.run(command, **kwargs) + + def pwedge( + self, + xcentr: str = "", + ycentr: str = "", + xlrad: str = "", + angle1: str = "", + angle2: str = "", + **kwargs, + ): + r"""Creates an annotation wedge (GUI). + + Mechanical APDL Command: `/PWEDGE `_ + + Parameters + ---------- + xcentr : str + Wedge X center location (-1.0 < X < 2.0). + + ycentr : str + Wedge Y center location (-1.0 < Y < 1.0). + + xlrad : str + Wedge radius length. + + angle1 : str + Starting angle of wedge. + + angle2 : str + Ending angle of wedge. The wedge is drawn counterclockwise from the starting angle, ``ANGLE1``, + to the ending angle, ``ANGLE2``. + + Notes + ----- + + .. _s-PWEDGE_notes: + + Creates an annotation wedge to be written directly onto the display at a specified location. This is + a command generated by the Graphical User Interface (GUI) and will appear in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + All wedges are shown on subsequent displays unless the annotation is disabled or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the wedge. + + This command is valid in any processor. + """ + command = f"/PWEDGE,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" + return self.run(command, **kwargs) + + def pmore( + self, + x5: str = "", + y5: str = "", + x6: str = "", + y6: str = "", + x7: str = "", + y7: str = "", + x8: str = "", + y8: str = "", + **kwargs, + ): + r"""Creates an annotation polygon (GUI). + + Mechanical APDL Command: `/PMORE `_ + + Parameters + ---------- + + x5 : str + X location for vertex 5 of polygon (-1.0 < X < 2.0). + + y5 : str + Y location for vertex 5 of polygon (-1.0 < Y < 1.0). + + x6 : str + X location for vertex 6 of polygon (-1.0 < X < 2.0). + + y6 : str + Y location for vertex 6 of polygon (-1.0 < Y < 1.0). + + x7 : str + X location for vertex 7 of polygon (-1.0 < X < 2.0). + + y7 : str + Y location for vertex 7 of polygon (-1.0 < Y < 1.0). + + x8 : str + X location for vertex 8 of polygon (-1.0 < X < 2.0). + + y8 : str + Y location for vertex 8 of polygon (-1.0 < Y < 1.0). + + Notes + ----- + + .. _s-PMORE_notes: + + Defines the 5th through 8th vertices of an annotation polygon ( :ref:`polygon` ). This is a command + generated by the Graphical User Interface (GUI) and appears in the log file ( :file:`Jobname.LOG` ) + if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with the :ref:`input` command). + + This command is valid in any processor. + """ + command = f"/PMORE,,{x5},{y5},{x6},{y6},{x7},{y7},{x8},{y8}" + return self.run(command, **kwargs) + + def pcircle(self, xcentr: str = "", ycentr: str = "", xlrad: str = "", **kwargs): + r"""Creates an annotation circle (GUI). + + Mechanical APDL Command: `/PCIRCLE `_ + + Parameters + ---------- + xcentr : str + Circle X center location (-1.0 < X < 2.0). + + ycentr : str + Circle Y center location (-1.0 < Y < 1.0). + + xlrad : str + Circle radius length. + + Notes + ----- + + .. _s-PCIRCLE_notes: + + Creates an annotation circle to be written directly onto the display at a specified location. This + is a command generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + This command is not intended to be typed in directly in a Mechanical APDL session (although it can + be + included in an input file for batch input or for use with the :ref:`input` command). + + All circles are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the circle. + + This command is valid in any processor. + """ + command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" + return self.run(command, **kwargs) + + def tspec( + self, + tcolor: int | str = "", + tsize: str = "", + txthic: int | str = "", + pangle: str = "", + iangle: str = "", + **kwargs, + ): + r"""Creates annotation text attributes (GUI). + + Mechanical APDL Command: `/TSPEC `_ + + Parameters + ---------- + tcolor : int or str + Text color (0 :math:`` ``TCOLOR`` :math:`` 15): + + * ``0`` - Black. + + * ``1`` - Red-Magenta. + + * ``2`` - Magenta. + + * ``3`` - Blue-Magenta. + + * ``4`` - Blue. + + * ``5`` - Cyan-Blue. + + * ``6`` - Cyan. + + * ``7`` - Green-Cyan. + + * ``8`` - Green. + + * ``9`` - Yellow-Green. + + * ``10`` - Yellow. + + * ``11`` - Orange. + + * ``12`` - Red. + + * ``13`` - Dark Gray. + + * ``14`` - Light Gray. + + * ``15`` - White. + + tsize : str + Text size factor. + + txthic : int or str + Text thickness key: + + * ``1`` - normal. + + * ``2`` - twice as thick. + + * ``3`` - three times as thick. + + * ``4`` - four times as thick. + + pangle : str + Text path angle (0.0 < ``angle`` < 360.0). + + iangle : str + Text italic angle (0.0 < ``angle`` < 45.0). + + Notes + ----- + + .. _s-TSPEC_notes: + + This command defines annotation text attributes to control certain characteristics of the text + created via :ref:`tlabel`. This command is generated by the Graphical User Interface (GUI) and + appears in the log file ( :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + This command is valid in any processor. + """ + command = f"/TSPEC,{tcolor},{tsize},{txthic},{pangle},{iangle}" + return self.run(command, **kwargs) + + def tlabel(self, xloc: str = "", yloc: str = "", text: str = "", **kwargs): + r"""Creates annotation text (GUI). + + Mechanical APDL Command: `/TLABEL `_ + + Parameters + ---------- + xloc : str + Text ``X`` starting location (-1.0 < ``X`` < 1.6). + + yloc : str + Text Y starting location (-1.0 < ``Y`` < 1.0). + + text : str + Text string (60 characters maximum). Parameter substitution may be forced within the text by + enclosing the parameter name or parametric expression within percent (%) signs. + + Notes + ----- + + .. _s-TLABEL_notes: + + Defines annotation text to be written directly onto the display at a specified location. This + command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + All text is shown on subsequent displays unless the annotation is disabled or deleted. Issue + :ref:`tspec` to set the attributes of the text. + + This command is valid in any processor. + """ + command = f"/TLABEL,{xloc},{yloc},{text}" + return self.run(command, **kwargs) + + def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): + r"""Activates graphics for annotating displays (GUI). + + Mechanical APDL Command: `/ANNOT `_ + + Parameters + ---------- + lab : str + Annotation control key: + + * ``OFF`` - Turns off annotation for each subsequent display (default). + + * ``ON`` - Turns on annotation for each subsequent display. + + * ``DELE`` - Deletes all annotation. + + * ``SAVE`` - Saves annotation on a file. Use ``VAL1`` for file name (defaults to :file:`Jobname` ) and ``VAL2`` + for the extension (defaults to ANO). + + * ``SCALE`` - Sets annotation scale factor (direct input only). Use ``VAL1`` for value (0.1 to 10.0) (defaults to + 1.0). + + * ``XORIG`` - Sets the annotation x origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). + + * ``YORIG`` - Sets annotation y origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). + + * ``SNAP`` - Sets annotation snap (menu button input only). Use ``VAL1`` for value (0.002 to 0.2) (defaults to + 0.002). + + * ``STAT`` - Displays current annotation status. + + * ``DEFA`` - Sets annotation specifications to the default values. + + * ``REFR`` - Redisplays annotation graphics. + + * ``TMOD`` - Sets the annotation text mode. If ``VAL1`` = 1, annotation text will be drawn in scalable bitmap + fonts (default). If ``VAL1`` = 0, annotation text will be drawn with stroke text. + + val1 : str + Value (or file name) as noted with label above. + + val2 : str + Value (or file name extension) as noted with label above. + + Notes + ----- + + .. _s-ANNOT_notes: + + This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if + annotation is used. This command is not intended to be typed in directly in a Mechanical APDL + session + (although it can be included in an input file for batch input or for use with the :ref:`input` + command). + + You cannot use the "!" and "$" characters in Mechanical APDL text annotation. + + :ref:`annot` activates annotation graphics for adding annotation to displays. Commands representing + the annotation instructions are automatically created by the annotation functions in the GUI and + written to :file:`Jobname.LOG`. + + The annotation commands are :ref:`annot`, :ref:`anum`, :ref:`tlabel`, :ref:`slashline`, + :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, :ref:`pwedge`, + :ref:`tspec`, :ref:`lspec`, and :ref:`slashpspec`. Annotation graphics are relative to the full + Graphics Window and are not affected by Mechanical APDL window-specific commands ( :ref:`window`, + :ref:`view`, etc.). + + This command is valid in any processor. + """ + command = f"/ANNOT,{lab},{val1},{val2}" + return self.run(command, **kwargs) + + def an3d(self, **kwargs): + r"""Specifies 3D annotation functions + + Mechanical APDL Command: `/AN3D `_ + + Notes + ----- + + .. _AN3D_notes: + + Because 3D annotation is applied in relation to the XYZ coordinates of the anchor, you can transform + your model, and the annotation will maintain the spatial relationship with the model. This works + within reason, and there are instances where changing the perspective or the size of the model will + change the apparent relationship between the annotation and the model. + + The overall 3D dimensions of your model are defined by a bounding box. If portions of your model's + bounding box lie outside of the visible area of your graphics window (if you are zoomed in on a + specific area of your model), it can affect the placement of your 3D annotations. Zooming out will + usually overcome this problem. + + 3D annotation is valid for the Cartesian ( :ref:`csys`,0) coordinate system only. If you want to + annotate a model you created in another coordinate system, use 2D annotation (note that 2D + annotations do not remain anchored for dynamic rotations or transformations). + + When you apply user defined bitmaps, the size of the annotation can vary. Use the options menu of + the 3D annotation widget to adjust the size and placement of your bitmaps. + + You cannot use the "!" and "$" characters in Mechanical APDL text annotation. + + The GUI generates this command during 3D annotation operations and inserts the command into the log + file ( :file:`Jobname.LOG` ). You should NOT type this command directly during a Mechanical APDL + session + (although the command can be included in an input file for batch input or for use with the + :ref:`input` command). + """ + command = "/AN3D" + return self.run(command, **kwargs) + + def anum( + self, + num: str = "", + type_: int | str = "", + xhot: str = "", + yhot: str = "", + **kwargs, + ): + r"""Specifies the annotation number, type, and hot spot (GUI). + + Mechanical APDL Command: `/ANUM `_ + + **Command default:** + + .. _s-ANUM_default: + + Number, type, and hot spot are automatically determined. + + Parameters + ---------- + num : str + Annotation number. Mechanical APDL automatically assigns the lowest available number. You cannot + assign a higher number if a lower number is available; the program substitutes the lowest + available number in place of any user-specified higher number. + + type_ : int or str + Annotation internal type number. If ``TYPE`` = DELE, delete annotation ``NUM``. + + * ``1`` - Text + + * ``2`` - Block text (not available in GUI) + + * ``3`` - Dimensions + + * ``4`` - Lines + + * ``5`` - Rectangles + + * ``6`` - Circles + + * ``7`` - Polygons + + * ``8`` - Arcs + + * ``9`` - Wedges, pies + + * ``11`` - Symbols + + * ``12`` - Arrows + + * ``13`` - Bitmap + + xhot : str + X hot spot (-1.0 < X < 2.0). Used for menu button item delete. + + yhot : str + Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. + + Notes + ----- + + .. _s-ANUM_notes: + + This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if + annotation is used. This command is not intended to be typed in directly in a Mechanical APDL + session + (although it can be included in an input file for batch input or for use with the :ref:`input` + command). + + Type 13 (bitmap) annotation applies user defined bitmaps defined using the FILE option of the + :ref:`txtre` command. + + This command is valid in any processor. + """ + command = f"/ANUM,{num},{type_},{xhot},{yhot}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/graphs.py b/src/ansys/mapdl/core/_commands/graphics/graphs.py new file mode 100644 index 00000000000..9ddeb7f0fc3 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/graphs.py @@ -0,0 +1,339 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Graphs: + + def xrange(self, xmin: str = "", xmax: str = "", **kwargs): + r"""Specifies a linear abscissa (X) scale range. + + Mechanical APDL Command: `/XRANGE `_ + + Parameters + ---------- + xmin : str + Minimum abscissa scale value. + + xmax : str + Maximum abscissa scale value. + + Notes + ----- + + .. _s-XRANGE_notes: + + Specifies a linear abscissa (X) scale range for the line graph display. Use :ref:`xrange`,DEFAULT to + return to automatic scaling. + + Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, + LOGX). + + This command is valid in any processor. + """ + command = f"/XRANGE,{xmin},{xmax}" + return self.run(command, **kwargs) + + def yrange(self, ymin: str = "", ymax: str = "", num: str = "", **kwargs): + r"""Specifies a linear ordinate (Y) scale range. + + Mechanical APDL Command: `/YRANGE `_ + + Parameters + ---------- + ymin : str + Minimum ordinate scale value. + + ymax : str + Maximum ordinate scale value. + + num : str + Y-axis number to which range applies (defaults to 1). Valid numbers are 1 to 3 for + :ref:`grtyp`,2 and 1 to 6 for :ref:`grtyp`,3. If ALL, apply to all Y-axes. + + Notes + ----- + + .. _s-YRANGE_notes: + + Specifies a linear ordinate (Y) scale range for the line graph display. Use :ref:`yrange`,DEFAULT to + return to automatic scaling. For multiple Y-axes graphs ( :ref:`grtyp` ), see :ref:`gropt`, ASCAL to + automatically scale the additional Y-axes. + + Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, + LOGY). + + This command is valid in any processor. + """ + command = f"/YRANGE,{ymin},{ymax},{num}" + return self.run(command, **kwargs) + + def axlab(self, axis: str = "", lab: str = "", **kwargs): + r"""Labels the X and Y axes on graph displays. + + Mechanical APDL Command: `/AXLAB `_ + + **Command default:** + + .. _s-AXLAB_default: + + Labels are determined by the program. + + Parameters + ---------- + axis : str + Axis specifier: + + * ``X`` - Apply label to X axis. + + * ``Y`` - Apply label to Y axis. + + lab : str + Axis label (user defined text up to 30 characters long). Leave blank to reestablish the default + for ``Axis`` axis. + + Notes + ----- + + .. _s-AXLAB_notes: + + This command is valid in any processor. + """ + command = f"/AXLAB,{axis},{lab}" + return self.run(command, **kwargs) + + def grtyp(self, kaxis: int | str = "", **kwargs): + r"""Selects single or multiple Y-axes graph displays. + + Mechanical APDL Command: `/GRTYP `_ + + Parameters + ---------- + kaxis : int or str + Axis selection key: + + * ``0 or 1`` - Single Y-axis. Up to 10 curves scaled to a single Y-axis. + + * ``2`` - Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves with + widely differing numbering ranges. + + * ``3`` - Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves maximum). + Allows clearer display with an isometric view. The default view when ``KAXIS`` = 3 is View,1,1,2,3. + + Notes + ----- + + .. _s-GRTYP_notes: + + The basic line graph has one or more curves plotted against the same Y and X axes. Multiple curve + graphs can also be plotted with individual Y axes and the same X axis. The Y axis of the first curve + is referred to as the base Y-axis and the Y axes of the other curves as additional Y axes. Curves + are numbered sequentially from 1 (the base curve) in the order in which they are displayed. See the + :ref:`axlab`, :ref:`gropt`, :ref:`grid`, and :ref:`gthk` commands for other display options. + + This command is valid in any processor. + """ + command = f"/GRTYP,{kaxis}" + return self.run(command, **kwargs) + + def gropt(self, lab: str = "", key: str = "", **kwargs): + r"""Sets various line graph display options. + + Mechanical APDL Command: `/GROPT `_ + + Parameters + ---------- + lab : str + Apply display style as selected from the following labels: + + * ``AXDV`` - Axis division (tick) marks (defaults to ``KEY`` = ON). + + * ``AXNM`` - Axis scale numbers (defaults to ``KEY`` = ON, which puts numbers at the back plane of the graph). If + ``KEY`` = FRONT, numbers are on the front plane of the graph. + + * ``AXNSC`` - Axis number size scale factor. Input the scale value for ``KEY`` (defaults to 1.0). + + * ``ASCAL`` - Automatic scaling of additional Y-axes for multi-curve ( :ref:`grtyp`, 2 or 3) graphs (defaults to + ``KEY`` = ON). If ``KEY`` = OFF, use base Y-axis scaling (see the :ref:`yrange` command). + + * ``LOGX`` - Log X scale (defaults to ``KEY`` = OFF (linear)). + + * ``LOGY`` - Log Y scale (applies only to the base Y axis) (defaults to ``KEY`` = OFF (linear)). + + * ``FILL`` - Color fill areas under curves (defaults to ``KEY`` = OFF). + + * ``CGRID`` - Superimpose background grid ( :ref:`grid` ) over areas under filled curves (defaults to ``KEY`` = + OFF). + + * ``DIG1`` - Number of significant digits before decimal point for axis values. Input the value for ``KEY`` + (defaults to 4). + + * ``DIG2`` - Number of significant digits after decimal point for axis values. Input the value for ``KEY`` + (defaults to 3). + + * ``VIEW`` - View key for graph displays (defaults to ``KEY`` = OFF, in which case the view is (0,0,1) for 2D + graph displays or (1,2,3) for 3D graph displays). If ``KEY`` = ON, the view settings for graph + displays are the same as the view settings for the model. + + * ``REVX`` - Plots the values on the X-axis in reverse order. + + * ``REVY`` - Plots the values on the Y-axis in reverse order. + + * ``DIVX`` - Determines the number of divisions (grid markers) that will be plotted on the X axis. + + * ``DIVY`` - Determines the number of divisions (grid markers) that will be plotted on the Y axis. + + * ``LTYP`` - Specifies whether program-generated ( ``KEY`` = 1) or system-derived ( ``KEY`` = 0) fonts are used + for the axis labels. + + * ``CURL`` - Determines the position of the curve labels. If ( ``KEY`` = 1), the curve label will be plotted in + the legend column, and the label will be displayed in the same color as the curve. If ( ``KEY`` = 0) + the curve labels will be plotted near the curve. (default). + + * ``XAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount from the + default (along the bottom) location for the X axis. If ``KEY`` = 1.0, a full offset occurs (the X + axis is moved to the top of the graph). If ``KEY`` = 0.5, the axis is offset to the midpoint of the + graph, and if ``KEY`` = 0 the axis remains in the original position, along the bottom of the graph. + For any offset, a grey copy of the original axis (containing the axis numbering) remains at the + original location. + + * ``YAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount from the + default (along the left side of the graph) location for the Y axis. If ``KEY`` = 1.0, a full offset + occurs (the Y axis is moved to the right side of the graph). If ``KEY`` = 0.5, the axis is offset to + the midpoint of the graph, and if ``KEY`` = 0 the axis remains in the original position, along the + left side of the graph. For any offset, a gray copy of the original axis (containing the axis + numbering) remains at the original location. + + key : str + Option values: + + * ``OFF (0)`` - Do not apply selected style. + + * ``ON (1)`` - Apply selected style. + + * ``nnnn`` - If ``Lab`` is DIG1 or DIG2, input the number of digits. + + * ``nn`` - If ``Lab`` is AXNSC, input the scale factor. + + * ``FRONT`` - If ``Lab`` is AXNM, FRONT may also be input. + + * ``Ndiv`` - If ``Lab`` is DIVX or DIVY, determines the number of divisions (1-99) that will be applied to the + axis. + + * ``Kfont`` - If ``Lab`` is LTYP, ``Kfont`` is ON (1) or OFF(0). ON uses program-generated fonts for the axis + labels, while OFF uses SYSTEM (Windows, X-system, etc.) fonts. Default: ``Kfont`` = ON (Mechanical APDL + fonts). + + Notes + ----- + + .. _s-GROPT_notes: + + Sets various line graph display options. Issue :ref:`gropt`,STAT to display the current settings. + + Issue :ref:`gropt`,DEFA to reset default specifications. + + Unless you issue :ref:`gropt`,VIEW,ON, the program indicates that graph-view manipulation is + inactive. + + See :ref:`axlab`, :ref:`grtyp`, :ref:`grid`, and :ref:`gthk` for other graph-control options. + + Automatic scaling using the :ref:`xrange` and :ref:`yrange` commands often yields inappropriate + range values for logarithmic scales ( :ref:`gropt`, LOGX or :ref:`gropt`, LOGY). + + This command is valid in any processor. + """ + command = f"/GROPT,{lab},{key}" + return self.run(command, **kwargs) + + def grid(self, key: str = "", **kwargs): + r"""Selects the type of grid on graph displays. + + Mechanical APDL Command: `/GRID `_ + + Parameters + ---------- + key : str + Grid key: + + * ``0 (OFF)`` - No grid. + + * ``1 (ON)`` - Full grid (X and Y grid lines). + + * ``2 (X)`` - Partial grid (X grid lines only). + + * ``3 (Y)`` - Partial grid (Y grid lines only) + + Notes + ----- + + .. _s-GRID_notes: + + Selects the type of grid on graph displays. Graphs with multiple Y-axes can have multiple grids ( + :ref:`grtyp` ). The grid of the first curve is also used as the background grid (above and behind + the curve). Grids for other curves are limited to be under the curves. See also :ref:`gthk` and + :ref:`gropt` for other grid options. + + This command is valid in any processor. + """ + command = f"/GRID,{key}" + return self.run(command, **kwargs) + + def gthk(self, label: str = "", thick: int | str = "", **kwargs): + r"""Sets line thicknesses for graph lines. + + Mechanical APDL Command: `/GTHK `_ + + Parameters + ---------- + label : str + Apply thicknesses as selected from the following labels: + + * ``AXIS`` - Modify thickness of ordinate and abscissa axes on graph displays. + + * ``GRID`` - Modify thickness of grid lines on graph displays. + + * ``CURVE`` - Modify thickness of curve lines (when no area fill ( :ref:`gropt` )). + + thick : int or str + Thickness ratio (whole numbers only, from -1 to 10): + + * ``-1`` - Do not draw the curve, but show only the markers specified by :ref:`gmarker`. + + * ``0 or 1`` - Thin lines. + + * ``2`` - The default thickness. + + * ``3`` - 1.5 times the default thickness. + + * ``etc.`` - (up to 10) + + Notes + ----- + + .. _s-GTHK_notes: + + Sets line thicknesses for graph lines (in raster mode only). Use :ref:`gthk`,STAT to show settings. + + This command is valid in any processor. + """ + command = f"/GTHK,{label},{thick}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py new file mode 100644 index 00000000000..6ea180307a3 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -0,0 +1,1237 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Labeling: + + def hbc(self, wn: str = "", key: str = "", **kwargs): + r"""Determines how boundary condition symbols are displayed in a display window. + + Mechanical APDL Command: `/HBC `_ + + Parameters + ---------- + wn : str + Window reference number. This number can be any window numbered 1 to 5, or ALL (for all active + windows). Default = 1. + + key : str + Controls hidden-surface boundary condition display behavior: + + ON, YES or 1 = Enable - Your boundary condition symbols are processed by the hidden-surface + algorithm (for 2D graphics devices) and use an improved pressure-contour display (for 2D and 3D + graphics devices). + + OFF, NO or 0 (default) = Disable (default) - Your boundary condition symbols are not processed + by the hidden-surface algorithm.. + + Notes + ----- + + .. _s-HBC_notes: + + With :ref:`hbc`, ``WN``,ON in effect, Mechanical APDL does not display symbols obscured by the model + in the + current view (that is, symbols inside of or behind the model are not drawn). This behavior lessens + display clutter. + """ + command = f"/HBC,{wn},{key}" + return self.run(command, **kwargs) + + def cformat(self, nfirst: str = "", nlast: str = "", **kwargs): + r"""Controls the graphical display of alphanumeric character strings for parameters, components, + assemblies, and tables. + + Mechanical APDL Command: `/CFORMAT `_ + + Parameters + ---------- + nfirst : str + Display the first ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 32. + + nlast : str + Display the last ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 0. + + Notes + ----- + + .. _s-CFORMAT_notes: + + Use this command to control the length of the character string that is shown in the graphics window + for a parameter, component, assembly, or table name. + + The total number of characters ( ``NFIRST`` + ``NLAST`` +3) cannot exceed 32. + + If ``NFIRST`` is greater than zero and ``NLAST`` = 0, only the ``NFIRST`` characters are displayed, + followed by an ellipsis. + + If ``NFIRST`` = 0 and ``NLAST`` is greater than zero, only the ``NLAST`` characters are displayed, + preceded by an ellipsis (...). + + If both ``NFIRST`` and ``NLAST`` are greater than zero, the name will be shown as ``NFIRST``, + followed by an ellipsis (...), followed by ``NLAST``, up to a maximum of 32 characters. + + For example, if ``NFIRST`` = 6 and ``NLAST`` = 3, and the character string is LENGTHOFSIDEONE, then + it will appear in the graphics window as LENGTH...ONE. + + If the actual length of the character string is less than the specified combination of ``NFIRST`` + + ``NLAST`` +3, then the actual string will be used. + + This command is valid in any processor. + """ + command = f"/CFORMAT,{nfirst},{nlast}" + return self.run(command, **kwargs) + + def cval( + self, + wn: str = "", + v1: str = "", + v2: str = "", + v3: str = "", + v4: str = "", + v5: str = "", + v6: str = "", + v7: str = "", + v8: str = "", + **kwargs, + ): + r"""Specifies nonuniform contour values on stress displays. + + Mechanical APDL Command: `/CVAL `_ + + **Command default:** + + .. _s-CVAL_default: + + Nine contour values uniformly spaced between the extreme values. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + v1 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v2 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v3 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v4 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v5 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v6 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v7 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v8 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + Notes + ----- + + .. _s-CVAL_notes: + + This command is similar to the :ref:`contour` command. With :ref:`cval`, however, you define the + upper level of each contour band instead of having the contours uniformly distributed over the + range. The minimum value (including a zero value for the first band) for a contour band cannot be + specified. If you use both :ref:`contour` and :ref:`cval`, the last command issued takes precedence. + + This command is valid in any processor. + """ + command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" + return self.run(command, **kwargs) + + def contour( + self, + wn: str = "", + ncont: str = "", + vmin: str = "", + vinc: str = "", + vmax: str = "", + **kwargs, + ): + r"""Specifies the uniform contour values on stress displays. + + Mechanical APDL Command: `/CONTOUR `_ + + **Command default:** + + .. _s-CONTOUR_default: + + Nine contour values uniformly spaced between the extreme values, or no contours if the ratio of + range to minimum value (or range to maximum if minimum = 0) is less than 0.001. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + ncont : str + Number of contour values. ``NCONT`` defaults to 9 for X11 or WIN32 and to 128 for X11c or + WIN32C. The default graphics window display for 3D devices is a smooth continuous shading effect + that spans the maximum of 128 contours available. Use the :ref:`dv3d` command to create defined + banding for your contour values (values of 9 and 128 are displayed in smooth shading only). The + legend, however, will display only nine color boxes, which span the full range of colors + displayed in the graphics window. + + vmin : str + Minimum contour value. If ``VMIN`` = AUTO, automatically calculate contour values based upon + ``NCONT`` uniformly spaced values over the min-max extreme range. Or, if ``VMIN`` = USER, set + contour values to those of the last display (useful when last display automatically calculated + contours). + + vinc : str + Value increment (positive) between contour values. Defaults to ( ``VMAX`` - ``VMIN`` ) + ``/NCONT``. + + vmax : str + Maximum contour value. Ignored if both ``VMIN`` and ``VINC`` are specified. + + Notes + ----- + + .. _s-CONTOUR_notes: + + Values represent contour lines in vector mode, and the algebraic maximum of contour bands in raster + mode. + + Regardless of how many contours ( ``NCONT`` ) are specified, the actual number of contours appearing + on your display depends also on the device name, whether the display is directed to the screen or to + a file, the display mode (vector or raster), and the number of color planes. (All of those items are + controlled via :ref:`show`.) In any case, regardless of whether they are smoothed or banded, only + 128 contours can be displayed. + + For more information about changing the number of contours, see `Creating Geometric Results Displays + `_. + + When the current Mechanical APDL graphics are not displayed as Multi-Plots: + + If the current device is a 3D device ( :ref:`show`,3D), the model contours in all active windows are + the same, even if separate :ref:`contour` commands are issued for each active window. Mechanical + APDL + maintains a single data structure (segment) containing one set of contours. The program displays the + same segment in all windows. The view settings of each window constitute the only differences in the + contour plots in the active windows. + + This command is valid in any processor. + + For alternate specifications, see :ref:`cval`. + """ + command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" + return self.run(command, **kwargs) + + def clabel(self, wn: str = "", key: int | str = "", **kwargs): + r"""Specifies contour labeling. + + Mechanical APDL Command: `/CLABEL `_ + + **Command default:** + + .. _s-CLABEL_default: + + Show contour line labels. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + key : int or str + Labeling key: + + * ``0 or 1`` - Label contours with legend or color (default). + + * ``-1`` - No contour labeling. + + * ``N`` - Same as 1 except show alphabetic legend only on every ``N`` th element. + + Notes + ----- + + .. _s-CLABEL_notes: + + Labels contours for identification with alphabetic legend for vector displays and color for raster + displays. Number of contours is automatically reduced to 9 (or fewer) for clarity. Use + :ref:`contour` command to increase (24 maximum for alphabetic labeling; no limit for color + labeling). + + This command is valid in any processor. + """ + command = f"/CLABEL,{wn},{key}" + return self.run(command, **kwargs) + + def number(self, nkey: int | str = "", **kwargs): + r"""Specifies whether numbers, colors, or both are used for displays. + + Mechanical APDL Command: `/NUMBER `_ + + Parameters + ---------- + nkey : int or str + Numbering style: + + * ``0`` - Color (terminal dependent) the numbered items and show numbers. + + * ``1`` - Color the numbered items. Do not show the numbers. + + * ``2`` - Show the numbers. Do not color the items. + + * ``-1`` - Do not color the items or show the numbers. For contour plots, the resulting display will vary (see + below). + + Notes + ----- + + .. _s-NUMBER_notes: + + Specifies whether numbers, colors, or both are used for numbering displays ( :ref:`pnum` ) of nodes, + elements, keypoints, lines, areas, and volumes. + + Shading is also available for terminals configured with more than 4 color planes ( :ref:`show` ). + Color automatically appears for certain items and may be manually controlled (off or on) for other + items. + + When you suppress color ( ``NKEY`` = -1) your contour plots will produce different results, + depending on your graphics equipment. For non-3D devices (X11, Win32, etc.) your contour plot will + be white (no color). For 3D devices, such as OpenGL, the resulting display will be in color. + + The following items are automatically given discrete colors: Boundary condition symbols ( :ref:`pbc` + ), curves on graph displays, and distorted geometry on postprocessing displays. Contour lines in + postprocessing displays are automatically colored based upon a continuous, rather than a discrete, + spectrum so that red is associated with the highest contour value. On terminals with raster + capability ( :ref:`show` ), the area between contour lines is filled with the color of the higher + contour. + + Explicit entity colors or the discrete color mapping may be changed with the :ref:`color` command. + + This command is valid in any processor. + """ + command = f"/NUMBER,{nkey}" + return self.run(command, **kwargs) + + def pbf(self, item: str = "", key: int | str = "", **kwargs): + r"""Shows magnitude of body-force loads on displays. + + Mechanical APDL Command: `/PBF `_ + + **Command default:** + + .. _s-PBF_default: + + No body-force load contours displayed. + + Parameters + ---------- + item : str + Label identifying the item: + + * ``TEMP`` - Applied temperatures. + + * ``FLUE`` - Applied fluences. + + * ``HGEN`` - Applied heat generation rates. + + * ``JS`` - Applied current density magnitude. + + * ``JSX`` - X-component of current density. + + * ``JSY`` - Y-component of current density. + + * ``JSZ`` - Z-component of current density. + + * ``PHASE`` - Phase angle of applied load. + + * ``MVDI`` - Applied magnetic virtual displacements flag. + + * ``CHRGD`` - Applied electric charge density. + + key : int or str + Symbol key: + + * ``0`` - Do not show body-force load contours. + + * ``1`` - Show body-force load contours. + + * ``2`` - Show current density as a vector (not a contour). + + Notes + ----- + + .. _s-PBF_notes: + + Shows body-force loads as contours on displays for the selected elements. + + The effects of the **/PBF** command are not cumulative (that is, the command does not modify an + existing setting from a + previously issued **/PBF** command). If you issue multiple **/PBF** commands during an analysis, + only the setting specified by the most recent :ref:`pbf` command applies. + + Use :ref:`pstatus` or :ref:`pbf`,STAT to display settings. Use :ref:`pbf`,DEFA to reset all + specifications back to default. See also the :ref:`psf` and :ref:`pbc` command for other display + contours. + + Portions of this command are not supported by PowerGraphics ( :ref:`graphics`,POWER). + + This command is valid in any processor. + """ + command = f"/PBF,{item},,{key}" + return self.run(command, **kwargs) + + def plopts(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls graphics options on subsequent displays. + + Mechanical APDL Command: `/PLOPTS `_ + + **Command default:** + + .. _s-PLOPTS_default: + + See individual label defaults. + + The Multi-legend mode ( :ref:`plopts`,INFO,3) is the default for contour legend displays. + + Parameters + ---------- + label : str + Apply display items as selected from the following labels: + + * ``INFO`` - Controls the display of the legend (ON or OFF) and allows the choice of preset or Multi-legend + placement. Control is provided by the ``KEY`` values. (Defaults to ``KEY`` =3 when the GUI is on. + Defaults to ``KEY`` = 2 otherwise.) + + * ``LEG1`` - Header portion of legend column (defaults to ON). + + * ``LEG2`` - View portion of legend column (defaults to ON (except off with contour displays)). + + * ``LEG3`` - View the contour section of the legend column (defaults to ON). + + * ``FRAME`` - Frame border lines around windows (defaults to ON). + + * ``TITLE`` - Title (bottom left text) (defaults to ON). + + * ``MINM`` - Min-Max symbols on contour displays (defaults to ON). + + * ``LOGO`` - Ansys logo (defaults to OFF (displayed as text at top of legend column)). If ``KEY`` = ON, + the text is removed from legend column but the logo symbol is displayed in whichever active window + is either in the uppermost right corner and on top, or if there is no window in that location, then + in the window to the furthest right of the screen. Version information remains in the legend column. + + * ``WINS`` - Controls whether graphics windows automatically stretch or shrink to adjust to screen size as the + legend column is turned off or on ( :ref:`plopts`,INFO) (defaults to ON). If WINS is on and the + legend column is changed from off to on, all windows are shrunk regardless of what their correct + size is. + + * ``WP`` - Working plane (defaults to OFF). The working plane is drawn as part of the display ( not just an + overlaid image as in :ref:`wpstyl` ). This option is best used in combination with a hidden-line + technique ( :ref:`slashtype` ). + + * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the + display as follows: + + 0 – No date or time displays are included in your legend. 1 – Only the date is shown. 2 – Both + the date and time are shown (default). + + * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the + display as follows: + + 0 – The Mechanical APDL jobname is not included in your legend (default). 1 – The Mechanical APDL jobname is + included in your legend. + + key : int or str + Switch: + + * ``OFF or 0`` - Do not apply this display item. For ``Label`` = DATE, no time or date are displayed. + + * ``ON or 1`` - Apply this display item. For ``Label`` = DATE, show only the date. + + * ``AUTO or 2`` - For ``Label`` = INFO, initiate Auto-legend mode. If the display has contours, the legend is ON; if + the display has no contours, the legend is OFF. For ``Label`` = DATE, display both the date and + time. + + * ``3`` - For ``Label`` = INFO, switch to Multi-legend mode. See the :ref:`udoc` command for the available + legend configurations. + + Notes + ----- + + .. _s-PLOPTS_notes: + + Use :ref:`plopts`,STAT to display settings. Use :ref:`plopts`,DEFA to reset all specifications back + to their defaults. + + When you perform multiple results displays, contours on the legend column may be truncated. To avoid + this, specify :ref:`plopts`,LEG1,0. + + The Multi-legend mode provides a number of legend data item priority and placement options. These + options are accessed via the GUI at Utility Menu> PlotCtrls> Window Controls> Window Options. The + :ref:`udoc` command provides command line o ptions for this capability. + + This command is valid in any processor. + + This command is not available for Academic Research or Teaching level products + """ + command = f"/PLOPTS,{label},{key}" + return self.run(command, **kwargs) + + def pbc( + self, + item: str = "", + key: int | str = "", + min: str = "", + max: str = "", + abs: str = "", + **kwargs, + ): + r"""Shows boundary condition (BC) symbols and values on displays. + + Mechanical APDL Command: `/PBC `_ + + **Command default:** + + .. _s-PBC_default: + + No symbols displayed. + + Parameters + ---------- + item : str + Label identifying the item: + + * ``U`` - Applied translational constraints (UX, UY, UZ). + + * ``ROT`` - Applied rotational constraints (ROTX, ROTY, ROTZ). + + * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3...., TTOP). + + * ``PRES`` - Applied fluid pressures. + + * ``V`` - Applied flow velocities (VX, VY, VZ). + + * ``VOLT`` - Applied voltages. + + * ``MAG`` - Applied scalar magnetic potentials. + + * ``A`` - Applied vector magnetic potentials. + + * ``CONC`` - Concentration. + + * ``CHRG`` - Applied electric charge. + + * ``F or FORC`` - Applied structural forces (FX, FY, FZ). + + * ``M or MOME`` - Applied structural moments (MX, MY, MZ). + + * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3...., HTOP). + + * ``FLOW`` - Applied fluid flow. + + * ``AMPS`` - Applied current flow. + + * ``FLUX`` - Applied magnetic flux. + + * ``CSG`` - Applied magnetic current segments. + + * ``RATE`` - Diffusion flow rate. + + * ``MAST`` - Master degrees of freedom. + + * ``CP`` - Coupled nodes. + + * ``CE`` - Nodes in constraint equations. + + * ``NFOR`` - POST1 nodal forces. + + * ``NMOM`` - POST1 nodal moments + + * ``RFOR`` - POST1 reaction forces. + + * ``RMOM`` - POST1 reaction moments (MX, MY, MZ). + + * ``PATH`` - Path geometry (undistorted) associated with the :ref:`path` command after a :ref:`pdef` or + :ref:`pvect` command has been issued. + + * ``ACEL`` - Global acceleration (ACELX, ACELY, ACELZ vector). + + * ``OMEG`` - Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, DOMEGY, DOMEGZ + vector). + + * ``ALL`` - Represents all appropriate labels. + + key : int or str + Symbol key: + + * ``0`` - Do not show symbol. + + * ``1`` - Show symbol. + + * ``2`` - Plot value next to symbol. + + min : str + Minimum value in a range of values plotted on screen. + + max : str + Maximum value in a range of values plotted on screen. + + abs : str + Absolute number. If ``KEY`` = 2 and ``ABS`` = 0, a number falling between the ``MIN`` and + ``MAX`` is displayed. If ``ABS`` is not specified, it defaults to 0. If ``KEY`` = 2 and ``ABS`` + = 1, an absolute value falling between the ``MIN`` and ``MAX`` is displayed. ``ABS`` = 1 lets + you eliminate the display of numbers whose absolute values are less than a desired tolerance. + For example, if ``ABS`` = 1, ``MIN`` = 10 and ``MAX`` = 1e8, values such as.83646 and -5.59737 + are not displayed. + + Notes + ----- + + .. _s-PBC_notes: + + The **/PBC** command adds degree of freedom constraint, force load, and other symbols to displays. + + Symbols are applied to the selected nodes only. All arrow and arrowhead symbols are oriented in the + nodal coordinate system and lie in two perpendicular planes. Force arrows are scaled proportional to + their magnitude. (If ``KEY`` = 1, use :ref:`vscale` to change arrow length.) For scalar quantities, + the specific component direction (that is, x, y, or z) of the symbol has no meaning, but the + positive or negative sense (for example, positive or negative x) represents a positive or negative + scalar value, respectively. + + The effects of the **/PBC** command are not cumulative (that is, the command does not modify an + existing setting from a + previously issued **/PBC** command). If you issue multiple **/PBC** commands during an analysis, + only the setting specified by the most recent :ref:`pbc` command applies. + + Use :ref:`pstatus` or :ref:`pbc`,STAT to display settings. Use :ref:`pbc`,DEFA to reset all + specifications back to default. See the :ref:`psf` and :ref:`pbf` commands for other display + symbols. + + In a `cyclic symmetry analysis + `_, the + :ref:`pbc` command is deactivated when `cyclic expansion + `_ + is active ( :ref:`cycexpand`,,ON). To view boundary conditions on the `base sector + `_, + deactivate cyclic expansion ( :ref:`cycexpand`,,OFF) and issue this command: :ref:`pbc`,ALL,,1 + + + Issuing the command :ref:`pbc`,PATH,,1 displays all defined paths. + + The :ref:`pbc` command is valid in any processor. + """ + command = f"/PBC,{item},,{key},{min},{max},{abs}" + return self.run(command, **kwargs) + + def psf( + self, + item: str = "", + comp: str = "", + key: int | str = "", + kshell: int | str = "", + color: str = "", + **kwargs, + ): + r"""Shows surface load symbols on model displays. + + Mechanical APDL Command: `/PSF `_ + + **Command default:** + + .. _s-PSF_default: + + No surface load symbols are displayed. + + Parameters + ---------- + item : str + Labels identifying the surface load to be shown; see. + + comp : str + Labels identifying the surface load to be shown; see. + + key : int or str + Key to turn surface load symbols on or off: + + * ``0`` - Off (default). + + * ``1`` - On, shown as face outlines. Line surface loads ( :ref:`sfl` ) on solid model plots are shown as + arrows. + + * ``2`` - On, shown as arrows. + + * ``3`` - On, shown as color filled surfaces. Line and area surface loads ( :ref:`sfl` and :ref:`sfa` ) on + solid model plots are shown as arrows. + + kshell : int or str + Visibility key for shell elements. + + * ``0`` - Off (default), surface load symbols are displayed only on visible load faces. + + * ``1`` - On, surface load symbols are displayed even if load face is not visible. + + color : str + Visibility key for contour legend. + + * ``ON`` - The symbols (arrows or face outlines) will show up in color with the legend showing the + corresponding color labels (default). + + * ``OFF`` - The contour legend will not be displayed. The symbols (arrows or face outlines) will show up in + grey. The size of the arrows will be proportional to the applied load. + + Notes + ----- + + .. _s-PSF_notes: + + :ref:`psf` determines whether and how to show surface loads on subsequent model displays. + + If surface loads are applied to solid model entities, only solid model plots show the load symbols; + node and element plots do not show them unless the loads are transferred ( :ref:`sftran` or + :ref:`sbctran` ). Similarly, solid model plots do not show the load symbols if surface loads are + applied to nodes and elements. For node and element plots of shell element models, the surface load + symbols are shown only if the load face is visible from the current viewing direction. + + The effects of the **/PSF** command are not cumulative (that is, the command does not modify an + existing setting from a + previously issued :ref:`psf` command). Only the setting specified via the most recent :ref:`psf` + command applies. + + If you issue a `postprocessing (POST1) + `_ + plot command that produces result contours (such as :ref:`plnsol` ), :ref:`psf` has no effect. This + behavior prevents conflicting contours in the graphics window. + + When using the radiosity method ( ``Item`` = RDSF and ``Comp`` = ENCL) with ``Key`` = 2, the + radiation arrows point outward from any element face. + + :ref:`psf`,STAT displays current :ref:`psf` settings, and :ref:`psf`,DEFA resets them back to + default. + + Other useful commands are :ref:`pnum`,SVAL,1 to show the values of the surface loads, :ref:`vscale` + to change arrow lengths, and :ref:`pbc` and :ref:`pbf` to activate other load symbols. + + For beam elements, only the colors representing shear (GREEN) and normal (RED) pressures are + displayed for the arrows. The color of these arrows does not correspond to the magnitudes in the + contour legend. The length of these arrows does, however, correlate to the relative magnitude of the + pressures. + + For elements SURF159, SOLID272, SOLID273, PIPE288 and PIPE289, :ref:`psf` is not available when + displaying elements with shapes determined from the real constants or section definition ( + :ref:`eshape` ). For PIPE288 and PIPE289, only external loads applied via :ref:`sfbeam` are + displayed. + + This command is valid in any processor. + + **/PSF - Valid Item and Component Labels** + + .. flat-table:: + :header-rows: 1 + + * - Item + - Comp + - Description + - Comments + * - :rspan:`14` PRES [ ] + - NORM (or blank) + - Applied pressure normal to the face (real component only). + - For element types other than SURF153, SURF154 and SURF156. + * - NORM + - Applied pressure normal to the face (real component). + - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ ] + * - TANX + - Applied pressure in the element tangential x direction (real component). + * - TANY + - Applied pressure in the element tangential- y direction (real component). + * - INRM + - Applied pressure normal to the face (imaginary component). + * - ITNX + - Applied pressure in the element tangential x direction (imaginary component). + * - ITNY + - Applied pressure in the element tangential y direction (imaginary component). + * - LOCX + - Applied pressure in the local x direction (real component). + - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ ] + * - LOCY + - Applied pressure in the local y direction (real component). + * - LOCZ + - Applied pressure in the local z direction (real component). + * - ILCX + - Applied pressure in the local x direction (imaginary component). + * - ILCY + - Applied pressure in the local y direction (imaginary component). + * - ILCZ + - Applied pressure in the local z direction (imaginary component). + * - RVEC + - Applied pressure in the user-defined direction (real component). + - :rspan:`1` For `supported structural element`_ with``KCSYS`` = 2. [ ] + * - IVEC + - Applied pressure in the user-defined direction (imaginary component). + * - :rspan:`1` CONV + - HCOEF + - Applied convection (film coefficient). + - + * - TBULK + - Applied convection (bulk temperature). + - + * - :rspan:`1` RAD + - EMIS + - Applied radiation (emissivity). + - + * - TAMB + - Applied radiation (ambient temperature). + - + * - :rspan:`1` RDSF + - EMSS + - Radiation emissivity. + - + * - ENCL + - Enclosure number. + - + * - FSIN + - + - Fluid-solid interface number. + - + * - HFLUX + - + - Applied heat flux. + - + * - FSI + - + - Acoustic fluid-structure interface flag. + - + * - IMPD + - + - Applied acoustic impedance. + - + * - :rspan:`1` SHLD + - COND + - Applied conductivity. + - + * - MUR + - Applied relative permeability. + - + * - MXWF + - + - Maxwell force flag. + - + * - INF + - + - Exterior surface flag. + - + * - CHRGS + - + - Applied electric surface charge density. + - + * - BLI + - + - Boundary layer impedance flag. + - + + Pressure loads apply to the element coordinate system (KEYOPT(2) = 0). Adjust appropriately for a + local coordinate system (KEYOPT(2) = 1). See, and in the Element Reference. + + ``KCSYS`` is specified when issuing :ref:`sfcontrol`. + """ + command = f"/PSF,{item},{comp},{key},{kshell},{color}" + return self.run(command, **kwargs) + + def psymb(self, label: str = "", key: int | str = "", **kwargs): + r"""Shows various symbols on displays. + + Mechanical APDL Command: `/PSYMB `_ + + Parameters + ---------- + label : str + Show symbols as selected from the following labels: + + * ``CS`` - Local coordinate systems. + + * ``NDIR`` - Nodal coordinate systems (on rotated nodes only). + + * ``ESYS`` - Element coordinate systems (element displays only). + + * ``LDIR`` - Line directions (line displays only). + + * ``LDIV`` - Controls the display of element divisions on lines. + + * ``ADIR`` - Area direction symbol (for keypoint, line, area and volume plots). + + * ``LAYR`` - Layer orientations (relative to the projected element x-axis) or fiber orientations in smeared + reinforcing elements. Used only within an element display. Use ``KEY`` to specify the layer number. + + * ``ECON`` - Element mesh symbols on keypoints and lines. + + * ``DOT`` - Larger symbols displayed for node and keypoint locations. When ``Label`` = DOT, ``KEY`` = 1 by + default. + + * ``XNOD`` - Extra node of surface or circuit elements. + + * ``FBCS`` - Force boundary condition scaling. Subsequent ``KEY`` value determines whether or not to scale the + applied and derived forces/moments to the same maximum value. + + * ``DEFA`` - Resets the symbol keys so that Mechanical APDL displays none of the symbols controlled by the :ref:`psymb` + command. The value of the ``KEY`` field is ignored. + + * ``STAT`` - Prints the status of the settings of the symbol keys controlled by the :ref:`psymb` command. The + ``KEY`` field is ignored. + + * ``MARK`` - Controls the marker size ( :ref:`gmarker` ). When ``Label`` = MARK, ``KEY`` = 10 by default. + + key : int or str + Symbol key: + + * ``-1`` - Effective only if ``Label`` = LAYR and solid shape element display ( :ref:`eshape` ) is active. + Orientation of all layers appears with the solid shape element display. + + * ``0`` - No symbol (default). If ``Label`` = LDIV, then ``KEY`` = 0 indicates that the displayed element + divisions will correspond to the existing mesh (the word MESHED or EXISTING can also be + substituted). Also, for ``Label`` = LDIV, if you execute any meshing command (such as :ref:`amesh` + or :ref:`vmesh` ), ``KEY`` is set to 0 (MESHED) automatically. If ``Label`` = FBCS, then ``KEY`` = 0 + indicates that boundary condition scaling will not be common. The applied and derived forces/moments + will be scaled to their respective maximum values. + + * ``1`` - Include symbol. If ``Label`` = LDIV, then ``KEY`` = 1 indicates that the displayed line divisions + will correspond to the value assigned by :ref:`lesize` (the word LESIZE can also be substituted). + Also, for ``Label`` = LDIV, if you execute the :ref:`lesize` command, ``KEY`` is set to 1 (LESIZE) + automatically. If ``Label`` = FBCS, then ``KEY`` = 1 indicates that boundary condition scaling will + be common. The applied and derived forces/moments will be scaled to the same maximum value. + + * ``N`` - If ``Label`` = LAYR, then ``N`` is equal to the layer number. If ``Label`` = DOT, then ``N`` can be + equal to 0,1,.....15, indicating the dot size. If ``Label`` = MARK, then ``N`` can be equal to + 1,.....10, indicating the marker size. If + + ``Label`` = LDIV, then ``KEY`` = -1, indicates that no element divisions will be displayed (the + word OFF can also be substituted). + + Notes + ----- + + .. _s-PSYMB_notes: + + Includes various symbols on the display. Triads are right-handed with x displayed as the longest + leg. Where color is displayed, x is white, y is green, and z is blue. For beams, x is always along + the length of the element. For lines, an arrow represents the direction of a line, from the + beginning keypoint to the end keypoint. See :ref:`plopts` command for additional display options. + Use :ref:`pstatus` or :ref:`psymb`,STAT to display settings. Use :ref:`psymb`,DEFA to reset all + specifications back to their defaults. The command :ref:`psymb`,ECON,1 causes the symbol "M" to be + displayed on keypoints and lines associated with meshed entities. When you issue the command + :ref:`psymb`,DOT,1, a larger symbol is displayed for each node and keypoint location. Using + :ref:`psymb`,MARK,1, a smaller marker size can be displayed. + + PowerGraphics ( :ref:`graphics`,POWER) does not support :ref:`psymb`,ESYS and :ref:`psymb`,LAYR. + + If ``KEY`` = ``N`` and PowerGraphics is off, the centroid of the surface elements is connected to + the extra node using a gray line. However, if PowerGraphics is on, the color of the line connecting + the centroid to the extra node is the same as that for the elements themselves (as determined by + :ref:`pnum` ). + + When ``Label`` = LAYR, the layer systems can be visualized with all current-technology layered + elements and the smeared reinforcing element REINF265. To use :ref:`psymb`,LAYR with REINF265, first + set the vector-mode graphics option ( :ref:`device`,VECTOR,1). + + This command is valid in any processor. + """ + command = f"/PSYMB,{label},{key}" + return self.run(command, **kwargs) + + def pnum(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls entity numbering/coloring on plots. + + Mechanical APDL Command: `/PNUM `_ + + Parameters + ---------- + label : str + Type of numbering/coloring: + + * ``NODE`` - Node numbers on node and element plots. + + * ``ELEM`` - Element numbers and colors on element plots. + + * ``SEC`` - Section numbers and colors on element and solid model plots (see ). + + * ``MAT`` - Material set numbers and colors on element and solid model plots (see ). + + * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see ). + + * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see ). + + * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see ). + + * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. + + LOC and ELEM numbers will be the same unless the model has been reordered. + + * ``KP`` - Keypoint numbers on solid model plots. + + * ``LINE`` - Line numbers on solid model plots (both numbers and colors on line plots). + + * ``AREA`` - Area numbers on solid model plots (both numbers and colors on area plots). + + * ``VOLU`` - Volume numbers on solid model plots (both numbers and colors on volume plots). + + * ``SVAL`` - Stress (or any contour) values on postprocessing plots, and surface load values and colors on model + plots when surface load symbols are on ( :ref:`psf` ). For tabular boundary conditions, the table- + evaluated values will be displayed on node, element, or contour displays in POST1 when load symbols + ( :ref:`pbf`, :ref:`psf`, :ref:`pbc` ) are on and TABNAM is OFF. + + * ``TABNAM`` - Table names for tabular boundary conditions. If this label is turned on, the table name appears next + to the appropriate symbol, arrow, face outline, or contour as dictated by the :ref:`psf`, + :ref:`pbc`, and :ref:`pbf` commands. + + * ``STAT`` - Shows current settings for :ref:`pnum`. + + * ``DEFA`` - Resets all :ref:`pnum` specifications back to default. + + key : int or str + Switch: + + * ``0`` - Turns OFF numbers/colors for specified label. + + * ``1`` - Turns ON numbers/colors for specified label. + + Notes + ----- + + .. _s-PNUM_notes: + + This command specifies entity numbering and coloring for subsequent plots. + + The MAT, TYPE, REAL, and ESYS labels activate both the numbering and coloring of the corresponding + attributes for :ref:`eplot`, :ref:`kplot`, :ref:`lplot`, :ref:`aplot`, and :ref:`vplot`. The ELEM, + MAT, TYPE, REAL, ESYS, and LOC labels are mutually exclusive, that is, only one can be specified at + a time. Also, turning on a LINE, AREA, or VOLU label will turn off the MAT, TYPE, and REAL labels. + + PowerGraphics ( :ref:`graphics`,POWER) displays for :ref:`pnum` can be problematic. :ref:`pnum`,ELEM + will display erratically depending on other display command specifications, while :ref:`pnum`,LOC + and :ref:`pnum`,ESYS are not supported. + + Element and volume numbers are not visible for 3D elements and volumes when Z-buffering is turned on + ( :ref:`slashtype`,,[6,7, or 8]). + + Use :ref:`pstatus` or :ref:`pnum`,STAT to show settings. Use :ref:`pnum`,DEFA to reset all + specifications back to default. Use the :ref:`number` command to control whether numbers and colors + are displayed together. + + This command is valid in any processor + """ + command = f"/PNUM,{label},{key}" + return self.run(command, **kwargs) + + def triad(self, lab: str = "", **kwargs): + r"""Shows the global XYZ coordinate triad on displays. + + Mechanical APDL Command: `/TRIAD `_ + + Parameters + ---------- + lab : str + Display triad as follows: + + * ``ORIG`` - Display triad at global origin (default). + + * ``OFF`` - Turn off triad display. + + * ``LBOT`` - Display triad in lower left screen corner. + + * ``RBOT`` - Display triad in lower right screen corner. + + * ``LTOP`` - Display triad in upper left screen corner. + + * ``RTOP`` - Display triad in upper right screen corner. + + Notes + ----- + + .. _s-TRIAD_notes: + + For efficiency, Mechanical APDL maintains a single data structure (segment) which includes the triad + as a + 3D data object. + + If a 3D device is involved ( :ref:`show`,3D) and the graphics are not being displayed as multi- + plots, the triad location is determined by the view settings for window #1. + + A request for triad display anywhere except for the origin may yield an improper display in windows + 2 through 5. + + The program displays the same segment in all windows. The view settings of each window constitute + the only difference in the display in the active windows. + + This command is valid in any processor. + """ + command = f"/TRIAD,{lab}" + return self.run(command, **kwargs) + + def udoc(self, wind: str = "", class_: str = "", key: str = "", **kwargs): + r"""Determines position and content for the multi-legend options. + + Mechanical APDL Command: `/UDOC `_ + + Parameters + ---------- + wind : str + The window number to which the command applies. (defaults to 1) + + class_ : str + The type (and relative importance) of legend item being displayed: + + * ``CNTR`` - Contour legend. This legend item is controlled separately from the other legend items (see note + below). + + * ``DATE`` - The items in the DATE class include the date and time, or the Mechanical APDL graphical logo ( + :ref:`plopts`,LOGO,1). This item is shown by default in all plots. + + * ``GWIN`` - The items in the GWIN class include the entity acronyms that appear in the legend of a multiplot of + entities (Nodes, Elements, Keypoints, Lines, Areas, Volumes). GWIN items are shown by default for + all :ref:`gplot` displays. + + * ``TYPE`` - Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL SOLUTIONS, etc.). + TYPE items are shown by default in all plots. + + * ``TYP2`` - Items in the TYP2 class include supplementary type information, such as DMAX and SMAX for nodal + solutions. TYP2 items are shown by default in all plots. + + * ``INUM`` - Items in the INUM class include the number labels generated by the :ref:`pnum` command. This class + is displayed by default in all plots that contain :ref:`pnum` information. + + * ``BCDC`` - The items in the BCDC class include labels created by the :ref:`pbc` command. This class is shown by + default in all plots which contain :ref:`pbc` information. + + * ``VECT`` - Items in the VECT class include labels created by the :ref:`plvect` command. This class is shown by + default for all :ref:`plvect` plots. + + * ``SURF`` - The items in the SURF class include labels from the :ref:`psf` legend. This class is shown by + default on all plots of surface boundary conditions. + + * ``BODY`` - Items from the BODY class include labels from the :ref:`pbf` legend. This class is shown by default + in all plots of body forces. + + * ``PSTA`` - Items from the PSTA class include stress scaling statistics, such as the :ref:`sscale` setting. This + class is not shown as the default for any type of plot, and must be specifically referenced to + display the included data. + + * ``VIEW`` - The items in the VIEW class include view statistics. This class is not shown as the default for any + type of plot, and must be specifically referenced to display the included data. + + * ``MISC`` - The items in the MISC class include supplementary labels like /EXPANDED and Stress Section Cross + Section. This class is not shown as the default for any type of plot, and must be specifically + referenced to display the included data. + + key : str + Switch: + + InformalTables need to be added. + + Notes + ----- + + .. _s-UDOC_notes: + + The legend classes conform to the controls specified in the window options panel ( PlotCtrls> Window + Controls> Window Options ). In many instances, the legend controls specified with the :ref:`plopts` + command will take precedence and override :ref:`udoc` specifications. For instance: + + :ref:`plopts`,LEG1,OFF will disable the TYPE, TYP2, INUM, and MISC classes, regardless of the + :ref:`udoc` settings. + + :ref:`plopts`,LEG2,OFF will disable the VIEW class, regardless of the :ref:`udoc` settings. + + :ref:`plopts`,LEG3,OFF will disable the PSTA class, regardless of the :ref:`udoc` settings. + + All items in a class are listed with the same X coordinate (except for contours). The contents of + the text classes are dumped onto the display window from top to bottom, in order of class + importance. + + The font specification for text items that are included in the user-specified legends are controlled + with the :ref:`device` command ( PlotCtrls> Font Controls> Anno/Graph Font ). + + The floating point values for the data presented in the legend(s) are controlled by the + :ref:`gformat` command. + """ + command = f"/UDOC,{wind},{class_},{key}" + return self.run(command, **kwargs) + + def gformat(self, ftype: str = "", nwidth: str = "", dsignf: str = "", **kwargs): + r"""Specifies the format for the graphical display of numbers. + + Mechanical APDL Command: `/GFORMAT `_ + + Parameters + ---------- + ftype : str + FORTRAN format types (G is the default if this field is left blank.) + + * ``G`` - G ``xx``. ``yy``. ``xx`` and ``yy`` are described below. + + * ``F`` - F ``xx``. ``yy`` + + * ``E`` - E ``xx``. ``yy`` + + nwidth : str + Total width (12 maximum) of the field (the ``xx`` in ``Ftype`` ). Defaults to 12. + + dsignf : str + Number of digits after the decimal point ( ``yy`` in F or E format) or number of significant + digits in G format. Range is 1 to ``xx`` -6 for ``Ftype`` = G or E; and 0 to ``xx`` -3 for + ``Ftype`` = F. The default is a function of ``Ftype`` and ``NWIDTH``. + + Notes + ----- + + .. _s-GFORMAT_notes: + + Enables you to control the format of the graphical display of floating point numbers. + + To display the current settings, issue :ref:`gformat`,STAT.. + + To allow Mechanical APDL to select the format for the graphical display of floating numbers, issue + :ref:`gformat`,DEFA. + + This command is valid in any processor. + """ + command = f"/GFORMAT,{ftype},{nwidth},{dsignf}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/scaling.py b/src/ansys/mapdl/core/_commands/graphics/scaling.py new file mode 100644 index 00000000000..53b26e93bc5 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/scaling.py @@ -0,0 +1,239 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Scaling: + + def icscale(self, wn: str = "", factor: str = "", **kwargs): + r"""Scales the icon size for elements supported in the circuit builder. + + Mechanical APDL Command: `/ICSCALE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + factor : str + Factor applied to the default icon size (defaults to 1). + + Notes + ----- + + .. _s-ICSCALE_notes: + + Scaling the icon size can provide better visualization of the circuit components when using the + Circuit Builder (an interactive builder available in the Mechanical APDL GUI). + """ + command = f"/ICSCALE,{wn},{factor}" + return self.run(command, **kwargs) + + def iclwid(self, factor: str = "", **kwargs): + r"""Scales the line width of circuit builder icons. + + Mechanical APDL Command: `/ICLWID `_ + + Parameters + ---------- + factor : str + Multiplication factor applied to the default line width (defaults to 1). The minimum is 1 and + the maximum is 6. + """ + command = f"/ICLWID,{factor}" + return self.run(command, **kwargs) + + def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): + r"""Sets the displacement multiplier for displacement displays. + + Mechanical APDL Command: `/DSCALE `_ + + **Command default:** + + .. _s-DSCALE_default: + + The default value is AUTO or 0 except when: + + Large deflection effects are included ( :ref:`nlgeom`,ON) and it is not a modal analysis; then the + default is 1. It is a spectrum analysis ( :ref:`antype`,SPECTR); then the default is OFF. The + amplitude of a time-harmonic solution is computed using the :ref:`hrcplx` command (OMEGAT _font + FamName="Agency FB"? ≥ /_font? 360 _font FamName="Agency FB"? ° /_font? ); then the default is OFF. + The amplitude of a complex modal or harmonic solution is stored into the database using the + :ref:`set` command ( ``KIMG`` = AMPL); then the default is OFF. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + dmult : int or str + + * ``AUTO or 0`` - Scale displacements automatically so that maximum displacement (vector amplitude) displays as 5 + percent of the maximum model length, as measured in the global Cartesian X, Y, or Z directions. + + * ``1`` - Do not scale displacements (that is, scale displacements by 1.0, true to geometry). Often used with + large deflection results. + + * ``FACTOR`` - Scale displacements by numerical value input for FACTOR. + + * ``OFF`` - Remove displacement scaling (that is, scale displacements by 0.0, no distortion). + + * ``USER`` - Set ``DMULT`` to that used for last display (useful when last ``DMULT`` value was automatically + calculated). + + Notes + ----- + + .. _s-DSCALE_notes: + + If Multi-Plots are not being displayed, and the current device is a 3D device ( :ref:`show`,3D), + then the displacement scale in all active windows will be the same, even if separate + :ref:`slashdscale` commands are issued for each active window. For efficiency, the program maintains + a single data structure (segment) containing only one displacement scale. The program displays the + same segment (displacement scale) in all windows. Only the view settings will be different in each + of the active windows. + + This command is valid in any processor. + """ + command = f"/DSCALE,{wn},{dmult}" + return self.run(command, **kwargs) + + def ratio(self, wn: str = "", ratox: str = "", ratoy: str = "", **kwargs): + r"""Distorts the object geometry. + + Mechanical APDL Command: `/RATIO `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + ratox : str + Distort object in the window X direction by this factor (defaults to 1.0). + + ratoy : str + Distort object in the window Y direction by this factor (defaults to 1.0). + + Notes + ----- + + .. _s-RATIO_notes: + + Distorts the object geometry in a particular direction. An example of this command's use would be to + allow long narrow sections to be distorted to a more square area for better display visualization. + + This command is valid in any processor. + """ + command = f"/RATIO,{wn},{ratox},{ratoy}" + return self.run(command, **kwargs) + + def vscale(self, wn: str = "", vratio: str = "", key: int | str = "", **kwargs): + r"""Scales the length of displayed vectors. + + Mechanical APDL Command: `/VSCALE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + vratio : str + Ratio value applied to the automatically calculated scale factor (defaults to 1.0, that is, use + scale factor as automatically calculated). + + key : int or str + Relative scaling key: + + * ``0`` - Use relative length scaling among vectors based on magnitudes. + + * ``1`` - Use uniform length scaling for all vector lengths. + + Notes + ----- + + .. _s-VSCALE_notes: + + Allows scaling of the vector length displayed with the :ref:`plvect` command of POST1 and the + :ref:`pbc` and :ref:`psf` commands. Also allows the scaling of the element (that is, + :ref:`psymb`,ESYS) and the nodal (that is, :ref:`psymb`,NDIR) coordinate system symbols. + + This command is valid in any processor. + """ + command = f"/VSCALE,{wn},{vratio},{key}" + return self.run(command, **kwargs) + + def sscale(self, wn: str = "", smult: str = "", **kwargs): + r"""Sets the contour multiplier for topographic displays. + + Mechanical APDL Command: `/SSCALE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + smult : str + Contour multiplier that factors in results based on the product of the multiplier and the result + being plotted. Defaults to 0.0 (no topographic effects). + + Notes + ----- + + .. _s-SSCALE_notes: + + Use this command to scale values to the geometry when the contours are shown elevated. For section + displays ( :ref:`slashtype` ), the elevation is performed perpendicular to the section face. + + Nonzero contour multipliers factoring in large results (stresses or displacements) can produce very + large distortion, causing images to disappear. To bring a distorted image back into view, reduce the + contour multiplier value. + + Portions of this command are not supported by PowerGraphics ( :ref:`graphics`,POWER). + """ + command = f"/SSCALE,{wn},{smult}" + return self.run(command, **kwargs) + + def shrink(self, ratio: str = "", **kwargs): + r"""Shrinks elements, lines, areas, and volumes for display clarity. + + Mechanical APDL Command: `/SHRINK `_ + + Parameters + ---------- + ratio : str + Shrinkage ratio (input as a decimal (0.0 to 0.5)). Defaults to 0.0 (no shrinkage). Values + greater than 0.5 default to 0.1 (10% shrinkage). + + Notes + ----- + + .. _s-SHRINK_notes: + + Shrinks the elements, lines, areas, and volumes so that adjacent entities are separated for clarity. + Portions of this command are not supported by PowerGraphics ( :ref:`graphics`,POWER). + + If only the common lines of non-coplanar faces are drawn (as per the :ref:`edge` command), then this + command is ignored. + + This command is valid in any processor. + """ + command = f"/SHRINK,{ratio}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py new file mode 100644 index 00000000000..b6afd209489 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -0,0 +1,1530 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class SetUp: + + def immed(self, key: int | str = "", **kwargs): + r"""Allows immediate display of a model as it is generated. + + Mechanical APDL Command: `IMMED `_ + + Parameters + ---------- + key : int or str + Immediate mode key: + + * ``0`` - Display only upon request, that is, no immediate display (default with the GUI off ). + + * ``1`` - Display immediately as model is generated (default with the GUI on ). + + Notes + ----- + + .. _IMMED_notes: + + The command enables you to control whether or not the model is displayed immediately as it is + generated in an interactive session. Available only during an interactive session at a graphics + display terminal. A valid graphics device name must first be specified ( :ref:`show` ). + + By default in the GUI, your model is immediately displayed in the Graphics window as you create new + entities (such as areas, keypoints, nodes, elements, local coordinate systems, boundary conditions, + etc.), referred to as immediate mode graphics. + + Symbols (such as boundary conditions, local coordinate system triads, etc.) appear immediately and + are present on subsequent displays unless you disable the appropriate symbol (via the GUI plot + controls function or the appropriate graphics-specification command). + + An immediate image is also scaled automatically to fit within the Graphics window. The new scaling + is usually apparent on the automatic replot associated with immediate mode. To suppress automatic + replot, issue :ref:`uis`,REPLOT,0. (With automatic replot suppressed, the immediate image may not + always be scaled correctly.) + + An immediate display in progress should not be aborted with the usual system "break" feature (or + else the Mechanical APDL session itself terminates). When you run Mechanical APDL interactively + without using the + GUI, immediate mode is off by default. + + This command is valid only in PREP7. + """ + command = f"IMMED,{key}" + return self.run(command, **kwargs) + + def image(self, label: str = "", fname: str = "", ext: str = "", **kwargs): + r"""Allows graphics data to be captured and saved. + + Mechanical APDL Command: `/IMAGE `_ + + Parameters + ---------- + label : str + Label specifying the operation to be performed: + + * ``CAPTURE`` - Capture the image from the graphics window to a new window. + + * ``RESTORE`` - Restore the image from a file to a new window. + + * ``SAVE`` - Save the contents of the graphic window to a file. + + * ``DELETE`` - Delete the window that contains the file. + + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. + + ext : str + Filename extension (eight-character maximum). If no extension is specified, :file:`bmp` will be + used on Windows systems, and :file:`img` will be used on Linux systems. + """ + command = f"/IMAGE,{label},{fname},{ext}" + return self.run(command, **kwargs) + + def dv3d(self, lab: str = "", key: int | str = "", **kwargs): + r"""Sets 3D device option modes. + + Mechanical APDL Command: `/DV3D `_ + + Parameters + ---------- + lab : str + Mode label: + + * ``ACCU`` - Activating the accumulation buffer for OpenGL graphics, providing faster model rotation when shaded + backgrounds are in use. This feature is off by default. + + * ``ACTR`` - Label term to designate the cursor position as the center for automatic dynamic rotational center + capability. The subsequent ``Key`` value (see below) turns this capability on and off. This feature + is on by default. (Available for OpenGL displays only.) + + * ``ANIM`` - Animation mode. The ANIM option allows you to create animation frames in pixmap mode instead of + display list mode. This may improve large model performance, but it eliminates local manipulation + while animation is in progress. This feature is on by default. + + * ``ANTI`` - Label term to control Anti-aliasing, a smoothing technique for your graph plots. (see below) The + subsequent ``Key`` value turns this capability on and off. The default for this feature is off. + (Available for OpenGL displays only). + + * ``CNTR`` - Switches banded contours on (1) or off (0) for your 3D contour display. The default is 1 (ON). Other + contour parameters such as number of contours or the increment and range are defined using the + :ref:`contour` command. When either 9 or 128 contours are specified via :ref:`contour`, this command + is ignored and a smooth contour is always displayed. + + * ``DGEN`` - Local manipulation degenerate mode. You access the DGEN option to set wire-frame local manipulation + mode for 3D devices (device dependent). This feature is off by default. + + * ``DLIST`` - With DLIST, you can specify whether screen updates and redraws will be performed using the Mechanical APDL + display list (off), or the 3D device's display list (on). DLIST is on by default for Windows + systems, but off for Linux. + + * ``DELS`` - You use DELS to suppress contour display screen overwrites when :ref:`noerase` is active. This + prevents the bleed-through that occurs when you overlay contour plots. + + * ``TRIS`` - Triangle strip mode. Tri-stripping provides faster 3D display capabilities and is on by default. + Some display enhancements, such as texturing, are adversely affected by tri-stripping. You can turn + off tri-stripping in order to improve these display functions. Be sure to turn tri-stripping on + after the desired output is obtained. + + key : int or str + The following key options apply to ``Lab`` = ACCU: + + * ``0`` - (OFF) The accumulation buffer is not accessed. (default) + + * ``1`` - (ON) Access to the buffer is enabled. + + The following key options apply to ``Lab`` = ACTR: + + * ``0`` - (OFF) The cursor position has no effect on the existing rotational center for dynamic operations. + + * ``1`` - (ON) The rotational center for dynamic rotations in OpenGL is determined by the position of the + mouse cursor on (or within 15 pixels of) the model. Any rotations that are initiated with the cursor + more than 15 pixels from the model will occur about the midpoint of the Z-axis at that point in + space. If the Z-buffer has not been refreshed the Z-axis will have an infinite value, and rotations + will appear to occur about an extremely long Z-axis. This behavior stops when the graphics window is + refreshed or replotted. (default) + + Note that when using the GUI in 3D mode, when ACTR = 1, the ``Rotational Center`` option is grayed + out under Utility Menu> PlotCtrls> View Setting because the rotational center is determined strictly + by the position of the mouse cursor. + + The following key options apply to ``Lab`` = ANIM: + + * ``0`` - Display list animation. The object can be dynamically manipulated while animating. No legend, + countour or annotation items are displayed. (see Notes, below) + + * ``1`` - On Linux, device-dependent pixmap animation is used. On the PC, bitmap animation is provided + (default). When you animate in this mode, you cannot dynamically manipulate your model (see Notes, + below). + + * ``2`` - On the PC only, this option provides AVI animation which uses the AVI movie player. + + Although you can create animations of multiple Mechanical APDL window schemes, animations created with + OpenGL display lists ( :ref:`dv3d`, ANIM, 0) do not retain the windowing scheme information. You CAN + save multiple windows via the X11/WIN32 drivers, or via the OpenGL driver with :ref:`dv3d`, ANIM, + KEY in effect (where KEY is not zero). + + The following key options apply to ``Lab`` = ANTI + + * ``0`` - (OFF) Anti-aliasing is not active (default). + + * ``1`` - (ON) The anti-aliasing technique will be applied to smooth the lines in your displays (valid for + OpenGL only). + + The following key options apply to ``Lab`` = DGEN: + + * ``0`` - Normal manipulation. + + * ``1`` - Wireframe Manipulation. + + The following key options apply to ``Lab`` = DLIST: + + * ``0`` - (OFF) The Mechanical APDL display list is used for plotting and dynamic graphics manipulation (Linux + default). + + * ``1`` - (ON) The local (3D device) display list is used for plotting and dynamic rotation (Windows default). + + The following key options apply to ``Lab`` = TRIS: + + * ``0`` - (OFF) Tri-stripping is off. + + * ``1`` - (ON) Tri-stripping is on (default). + + Notes + ----- + Mechanical APDL uses display list animation for its 3D models. This memory resident array method + interfaces + with the OpenGL model information to allow the program to efficiently pan, zoom, rotate and + dynamically manipulate your model during animation. The logo, legend, contour and other annotation + items are produced in 2D and will not appear when :ref:`dv3d`, ANIM, 0 is in effect. To display + these items, use :ref:`dv3d`, ANIM, 1. All screen data will be displayed, but manipulation of the + model will not be possible. + """ + command = f"/DV3D,{lab},{key}" + return self.run(command, **kwargs) + + def device(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls graphics device options. + + Mechanical APDL Command: `/DEVICE `_ + + **Command default:** + + .. _s-DEVICE_default: + + Vector mode off (that is, raster mode); dithering on. + + Parameters + ---------- + label : str + Device function label: + + * ``BBOX`` - Bounding box mode. For PowerGraphics plots involving elements with :ref:`show`,x11 and + :ref:`show`,win32, Mechanical APDL generally displays dynamic rotations faster. If KEY = 1 (ON), then a + bounding box (not the elements) encompassing the model is displayed and rotated, rather than the + element outlines (ON is default in preprocessing). When KEY = 0 (OFF), then dynamic rotations may be + slower (Mechanical APDL redraws the element outlines) for plots involving elements with :ref:`show`,x11 and + :ref:`show`,win32. OFF is default in postprocessing. This command is ignored if :ref:`edge`,WN,1 is + set for any WN. This is ignored in POST1 and SOLUTION plots. + + For any PowerGraphics plots involving elements, regardless of :ref:`show` settings, plots will + generally be displayed faster. + + * ``VECTOR`` - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display geometries are + shown as outlines (wireframes). When vector mode is off (default), these entities are shown filled + with color. + + * ``DITHER`` - When dithering is turned on (default), color intensity transitions are smoothed. This selection a + + applies only to smooth-shaded images, that is, Z-buffered ( :ref:`slashtype` ), or raster plots with + Gouraud or Phong shading ( :ref:`shade` ). + + * ``ANIM`` - Select the animation type used on 2D devices on the PC platform. A ``KEY`` value of BMP (or 0) sets + animation mode to the Mechanical APDL animation controller (default). A ``KEY`` value of AVI (or 2) sets + animation mode to AVI movie player file. + + * ``FONT`` - Font selection for the Mechanical APDL graphics window. When ``Label`` = FONT, the command format is: + :ref:`device`,FONT, ``KEY``, ``Val1``, ``Val2``, ``Val3``, ``Val4``, ``Val5``, ``Val6`` where + ``KEY`` determines the type of font being controlled, and values 1 through 6 control various font + parameters. These values are device specific; using the same command input file ( :ref:`input` ) on + different machines may yield different results.. The following ``KEY`` values determine the font + information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, + JPEG....): + + * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. + + * ``KEY = 2`` - The command controls the ENTITY (node and keypoint number) font. + + * ``KEY = 3`` - The command controls the ANNOTATION/GRAPH font. + + Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 + are character strings; value 4 is a nonzero integer: + + * ``Val1`` - Family name (for example, Courier). If ``Val1`` = MENU, all other values are ignored and a font + selection menu appears (GUI must be active). + + * ``Val2`` - Weight (for example, medium) + + * ``Val3`` - Slant (for example, r) + + * ``Val4`` - Pixel size (for example, 14). Note that this value does no affect the annotation fonts ( ``KEY`` = + 3). Use the :ref:`tspec` command for annotation font size. + + * ``Val5`` - unused + + * ``Val6`` - unused + + PC: The values are encoded in a PC logical font structure. Value 1 is a character string, and the + remaining values are integers: + + * ``Val1`` - Family name (for example, Courier\2New) Substitute an asterisk (\2) for any blank character that + appears in a family name. If ``Val1`` = MENU, all other values are ignored and a font selection menu + appears (GUI must be active). When this value is blank, Mechanical APDL uses the first available resource + it finds. + + * ``Val2`` - Weight (0 - 1000) + + * ``Val3`` - Orientation (in tenths of a degree) + + * ``Val4`` - Height (in logical units) + + * ``Val5`` - Width (in logical units) + + * ``Val6`` - Italics (0 = OFF, 1 = ON) + + * ``TEXT`` - Text size specification for the Mechanical APDL graphics window. Using this label with the :ref:`device` + command requires the following form: :ref:`device`,TEXT, ``KEY``, ``PERCENT``. ``KEY`` = 1 for + LEGEND fonts; ``KEY`` = 2 for ENTITY fonts. ``PERCENT`` specifies the new text size as a percent of + the default text size. If ``PERCENT`` = 100, the new text size is precisely the default size. If + ``PERCENT`` = 200, the new text size is twice the default text size. + + key : int or str + Control key: + + * ``OFF or 0`` - Turns specified function off. + + * ``ON or 1`` - Turns specified function on or designates the LEGEND font. + + * ``2`` - Designates the ENTITY font. + + * ``3`` - Designates the ANNOTATION/GRAPH font. + + Notes + ----- + + .. _s-DEVICE_notes: + + This command is valid in any processor. + + The :ref:`device`,BBOX command is ignored in POST1 and SOLUTION plots. Also, the elements are + displayed and rotated if you use :ref:`device`,BBOX,ON and :ref:`edge`,WN,1,ANGLE (effectively + ignoring the BBOX option). + """ + command = f"/DEVICE,{label},{key}" + return self.run(command, **kwargs) + + def dsys(self, kcn: str = "", **kwargs): + r"""Activates a display coordinate system for geometry listings and plots. + + Mechanical APDL Command: `DSYS `_ + + **Command default:** + + .. _DSYS_default: + + Global Cartesian ( ``KCN`` = 0) display coordinate system. + + Parameters + ---------- + kcn : str + Coordinate system reference number. ``KCN`` may be 0,1,2 or any previously defined local + coordinate system number. If a cylinder is displayed in its cylindrical coordinate system (with + a 1,0,0 view), it will be unrolled (developed) into a flat plane (with theta along the Y + direction). + + Notes + ----- + + .. _DSYS_notes: + + Boundary condition symbols, vector arrows, and element coordinate system triads are not transformed + to the display coordinate system. The display system orientation (for the default view) is X + horizontal to the right, Y vertical upward, and Z out of the screen (normal). + + Line directions and area directions ( :ref:`psymb`,LDIR and :ref:`psymb`,ADIR) are not plotted for + ``KCN`` >0. + + When you create 3D annotation, the coordinates are stored to the database in the display coordinate + system that was active at the time of creation. Changing the display coordinate system does not + change the annotation coordinate data in the database. + + This command is valid in any processor. + """ + command = f"DSYS,{kcn}" + return self.run(command, **kwargs) + + def color( + self, + lab: str = "", + clab: str = "", + n1: str = "", + n2: str = "", + ninc: str = "", + **kwargs, + ): + r"""Specifies the color mapping for various items. + + Mechanical APDL Command: `/COLOR `_ + + **Command default:** + + .. _s-COLOR_default: + + Use the default color mapping. + + Parameters + ---------- + lab : str + Apply color to the items specified by the following labels: + + * ``AXES`` - Determines the color (specified in next argument, ``Clab`` ) that the axes of a graph will be + plotted in. + + * ``AXNUM`` - Determines the color (specified in next argument, ``Clab`` ) that the numbering on the axes of a + graph will be plotted in. + + * ``NUM`` - Discretely numbered items (such as element types, element materials, etc., as shown on the + :ref:`pnum` command). Also specify number (1 to 11) in the ``N1`` field. For example, + :ref:`color`,NUM,RED,3 will assign the color red to all items having the discrete number 3 (material + displays would show elements having material 3 as red). + + * ``OUTL`` - Outline of elements, areas, and volumes. Ex: :ref:`color`,OUTL,BLUE. + + * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. + + * ``LINE`` - Solid model lines. Use ``N1``, ``N2``, ``NINC`` fields for line numbers. + + * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. + + * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. + + * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc.). This option is particularly useful when capturing + frames for animating a single isosurface value. + + * ``WBAK`` - Window background. Use ``N1``, ``N2``, ``NINC`` fields for window numbers. The options that you + select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. + + * ``b.c.label`` - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, CURR, F, M, HEAT, FLOW, + VF, AMPS, FLUX, CSG, CURT, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See the :ref:`pbc` command + for boundary condition label definitions. + + * ``GRBAK`` - Graph background. + + * ``GRID`` - Graph grid lines. + + * ``AXLAB`` - Graph X and Y axis labels. + + * ``CURVE`` - Graph curves (identify curve numbers (1-10) in ``N1``, ``N2``, ``NINC`` fields). + + * ``CM`` - Component group. Use ``N1`` field for component name, ignore ``N2`` and ``NINC``. + + * ``CNTR`` - Mechanical APDL contour stress colors. The maximum number of contours available is 128. The number of + colors that can be specified interactively (GUI) is 9. ( :ref:`contour`, 9). Any other setting will + yield inconsistent results. + + * ``SMAX`` - Specifies that all stress values above the maximum value entered in :ref:`contour` will be displayed + in the color designated in the ``Clab`` field. Defaults to dark grey. + + * ``SMIN`` - Specifies that all stress values below the minimum value entered in :ref:`contour` will be displayed + in the color designated in the ``Clab`` field. Defaults to dark grey. + + * ``PBAK`` - Activates background shading options (see command syntax at end of argument descriptions below). The + options that you select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. + + clab : str + Valid color labels are: + + * ``BLAC (0)`` - Black + + * ``MRED (1)`` - Magenta-Red + + * ``MAGE (2)`` - Magenta + + * ``BMAG (3)`` - Blue-Magenta + + * ``BLUE (4)`` - Blue + + * ``CBLU (5)`` - Cyan-Blue + + * ``CYAN (6)`` - Cyan + + * ``GCYA ((7)`` - Green-Cyan + + * ``GREE (8)`` - Green + + * ``YGRE (9)`` - Yellow-Green + + * ``YELL (10)`` - Yellow + + * ``ORAN (11)`` - Orange + + * ``RED (12)`` - Red + + * ``DGRA (13)`` - Dark Gray + + * ``LGRA (14)`` - Light Gray + + * ``WHIT (15)`` - White + + n1 : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + + n2 : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + + ninc : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + + Notes + ----- + + .. _s-COLOR_notes: + + Issue :ref:`color`,STAT to display the current color mapping. Issue :ref:`color`,DEFA to reset the + default color mapping. Color labels may also be reassigned any "color" with the :ref:`cmap` command. + + This command is valid anywhere. + """ + command = f"/COLOR,{lab},{clab},{n1},{n2},{ninc}" + return self.run(command, **kwargs) + + def cmap( + self, fname: str = "", ext: str = "", kywrd: str = "", ncntr: str = "", **kwargs + ): + r"""Changes an existing or creates a new color mapping table. + + Mechanical APDL Command: `/CMAP `_ + + **Command default:** + + .. _s-CMAP_default: + + Use predefined Mechanical APDL color map table. + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. If blank, restore color map. + + ext : str + Filename extension (eight-character maximum). + + kywrd : str + Keyword indicating the disposition of the color map file. + + * ``(blank)`` - Loads existing color map file. + + * ``CREATE`` - Starts the CMAP utility and modifies or creates the specified file. + + * ``SAVE`` - Writes the active color map to the specified file, which can be imported into future sessions. + + ncntr : str + Number of contours to be defined. Default = 9 (even if an existing file is being modified). + Maximum = 128. + + Notes + ----- + + .. _s-CMAP_notes: + + Reads the color map file (RGB index specifications) to change from current specifications. Only one + color map may be active at a time. + + For 2D drivers (especially Win32c), modifying the color map can produce anomalies, including + legend/contour disagreement. + + When ``Kywrd`` equals CREATE, the 2D drivers (X11c and Win32c) display the CMAP utility with an + additional contour color picker called CONTOURS. Colors selected via the CONTOURS picker affect + result contour displays (such as stresses). No other drivers offer the CONTOURS picker in the CMAP + utility. + + Changing the color map using the :ref:`cmap` command changes the meaning of the color labels on the + :ref:`color` command. See :ref:`color` for other color controls. + + This command is valid anywhere. + """ + command = f"/CMAP,{fname},{ext},,{kywrd},{ncntr}" + return self.run(command, **kwargs) + + def window( + self, + wn: str = "", + xmin: str = "", + xmax: str = "", + ymin: str = "", + ymax: str = "", + ncopy: str = "", + **kwargs, + ): + r"""Defines the window size on the screen. + + Mechanical APDL Command: `/WINDOW `_ + + Parameters + ---------- + wn : str + Window reference number (1 to 5). Defaults to 1. This number, or ALL (for all active windows), + may be used on other commands. + + xmin : str + Screen coordinates defining window size. Screen coordinates are measured as -1.0 to 1.67 with + the origin at the screen center. For example, (-1,1.67,-1,1) is full screen, (-1,0,-1,0) is the + left bottom quadrant. If ``XMIN`` = OFF, deactivate this previously defined window; if ON, + reactivate this previously defined window. If FULL, LEFT, RIGH, TOP, BOT, LTOP, LBOT, RTOP, + RBOT, form full, half, or quarter window. If SQUA, form largest square window within the current + graphics area. If DELE, delete this window (cannot be reactivated with ON). + + xmax : str + Screen coordinates defining window size. Screen coordinates are measured as -1.0 to 1.67 with + the origin at the screen center. For example, (-1,1.67,-1,1) is full screen, (-1,0,-1,0) is the + left bottom quadrant. If ``XMIN`` = OFF, deactivate this previously defined window; if ON, + reactivate this previously defined window. If FULL, LEFT, RIGH, TOP, BOT, LTOP, LBOT, RTOP, + RBOT, form full, half, or quarter window. If SQUA, form largest square window within the current + graphics area. If DELE, delete this window (cannot be reactivated with ON). + + ymin : str + Screen coordinates defining window size. Screen coordinates are measured as -1.0 to 1.67 with + the origin at the screen center. For example, (-1,1.67,-1,1) is full screen, (-1,0,-1,0) is the + left bottom quadrant. If ``XMIN`` = OFF, deactivate this previously defined window; if ON, + reactivate this previously defined window. If FULL, LEFT, RIGH, TOP, BOT, LTOP, LBOT, RTOP, + RBOT, form full, half, or quarter window. If SQUA, form largest square window within the current + graphics area. If DELE, delete this window (cannot be reactivated with ON). + + ymax : str + Screen coordinates defining window size. Screen coordinates are measured as -1.0 to 1.67 with + the origin at the screen center. For example, (-1,1.67,-1,1) is full screen, (-1,0,-1,0) is the + left bottom quadrant. If ``XMIN`` = OFF, deactivate this previously defined window; if ON, + reactivate this previously defined window. If FULL, LEFT, RIGH, TOP, BOT, LTOP, LBOT, RTOP, + RBOT, form full, half, or quarter window. If SQUA, form largest square window within the current + graphics area. If DELE, delete this window (cannot be reactivated with ON). + + ncopy : str + Copies the current specifications from window ``NCOPY`` (1 to 5) to this window. If ``NCOPY`` = + 0 (or blank), no specifications are copied. + + Notes + ----- + + .. _s-WINDOW_notes: + + Defines the window size on the screen. Windows may occupy a separate section of the screen or they + may overlap. Requested displays are formed in all windows according to the selected window + specifications. + + This command is valid in any processor. + """ + command = f"/WINDOW,{wn},{xmin},{xmax},{ymin},{ymax},{ncopy}" + return self.run(command, **kwargs) + + def replot(self, label: str = "", **kwargs): + r"""Reissues the last display command. + + Mechanical APDL Command: `/REPLOT `_ + + Parameters + ---------- + label : str + Controls the type of replot. + + * ``RESIZE`` - Issued internally when a graphics window resize occurs (Default). + + * ``FAST`` - Only applicable for 3D devices that allow a fast redisplay for changes in the view characteristics + only. + + Notes + ----- + + .. _s-REPLOT_notes: + + Reissues the last display command ( :ref:`nplot`, :ref:`eplot`, :ref:`kplot`, :ref:`plnsol`, + :ref:`plvar`, etc.), along with its parameters, for convenience. The current display specifications + are used. + + When the last display command is invalid in a given processor, :ref:`replot` is also invalid in that + processor. However, if you attempt a :ref:`replot` and the last display command is invalid in the + current processor, Mechanical APDL generates an element display ( :ref:`eplot` ) instead, as long as + the + last display command was :ref:`plnsol`, :ref:`plesol`, or :ref:`pldisp`. + + Example: :ref:`replot` Replaced by :ref:`eplot` Automatically + + :ref:`plnsol`, used to display solution results as continuous contours, is a valid command in the + POST1 general postprocessor. + + If you issue :ref:`plnsol` followed by :ref:`replot` while in POST1, :ref:`replot` effectively + reissues your earlier :ref:`plnsol` command, along with its parameters. + + If you then exit POST1, enter the PREP7 preprocessor, and again issue :ref:`replot`, the program + uses :ref:`eplot` internally instead. + + The command substitution occurs because :ref:`plnsol` is not a valid command in PREP7. + + When you click one of the buttons on the `Pan, Zoom, Rotate + `_ + dialog box to manipulate the view of a model, :ref:`replot` is issued internally. Thus, the + substitution of :ref:`replot` with :ref:`eplot` as described above may also occur for operations + that you perform via with the `Pan, Zoom, Rotate + `_ + dialog box. + + :ref:`replot` does not show boundary conditions if they are applied only to a solid model and the + last display command (such as :ref:`eplot` ) displays the finite element model. To show boundary + conditions, the following options are available: + + Issue :ref:`replot` after you issue :ref:`sbctran` to transfer solid model boundary conditions to + the finite element model. Issue :ref:`replot` after you issue a solid model display command (such as + :ref:`vplot` ). + + This command is valid in any processor (except as noted above). + """ + command = f"/REPLOT,{label}" + return self.run(command, **kwargs) + + def slashreset(self, **kwargs): + r"""Resets display specifications to their initial defaults. + + Mechanical APDL Command: `/RESET `_ + + Notes + ----- + + .. _s-RESET_notes: + + Resets slash display specifications ( :ref:`window`, :ref:`slashtype`, :ref:`view`, etc.) back to + their initial default settings (for convenience). Also resets the focus location to the geometric + center of the object. + + This command is valid in any processor. + """ + command = "/RESET" + return self.run(command, **kwargs) + + def noerase(self, **kwargs): + r"""Prevents the screen erase between displays. + + Mechanical APDL Command: `/NOERASE `_ + + Notes + ----- + + .. _s-NOERASE_notes: + + Preventing the normal screen erase between requested displays allows you to overlay multiple views. + + Clearing the screen with the ``ERASE`` command ( Utility Menu> PlotCtrls> Erase Options> Erase + screen ) active simply clears the display area. Subsequent replots will provide the cumulative plots + previously generated by the :ref:`noerase` command. + + For 3D devices, you can issue :ref:`dv3d`,DELS to suppress repeated screen overlays and generate + clear contour plots. + + Use the ``/ERASE`` command to reactivate automatic screen erase. + + For 3D devices ( :ref:`show`,3D), the model in all active windows will be the same, even if you + issue a different display command ( :ref:`nplot`, :ref:`eplot`, etc.) for each active window. Use + the Multi-Plot command ( :ref:`gplot` ) to display different entities, in different windows, on 3D + devices. + + This command is valid in any processor. + """ + command = "/NOERASE" + return self.run(command, **kwargs) + + def pstatus(self, wn: str = "", **kwargs): + r"""Displays the global or window display specifications. + + Mechanical APDL Command: `/PSTATUS `_ + + Parameters + ---------- + wn : str + Window number for status (defaults to global specifications). + + Notes + ----- + + .. _s-PSTATUS_notes: + + Displays the current global or window display specifications. Global display specifications are + common to all windows (e.g. :ref:`show`, etc.). Window display specifications are specific to one + window (e.g. :ref:`view`, :ref:`slashtype`, etc.). + + This command is valid in any processor. + """ + command = f"/PSTATUS,{wn}" + return self.run(command, **kwargs) + + def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): + r"""Provides PNG file export for Mechanical APDL displays. + + Mechanical APDL Command: `PNGR `_ + + Parameters + ---------- + kywrd : str + Specifies various PNG file export options. + + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` is either ON or OFF (blank is interpreted as OFF). This option + allows you to turn PNG file compression ON or OFF. If OPT = ON, then The VAL field is read to + determine the degree of compression. See the VALUE argument for acceptable compression values. + + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can + be either Horizontal (default) or Vertical. + + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. ``OPT`` can be + 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. + + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, + corresponding to bitmap text (default) or line stroke text, respectively. + + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed + above, are active. + + * ``STAT`` - Shows the current status of PNG file export. + + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + + * ``ON, OFF`` - If ``Kywrd`` = COMP, the values On and Off control the use of compression. The degree of compression + is determined by VAL + + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. + + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, + respectively. + + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will + be used + + val : int or str + ``VAL`` is active only when ``Kywrd`` = COMP, and determines the degree of compression applied to + the exported file (see above). + + * ``-1`` - Apply the default, optimum value for compression. This value represents the best combination of + speed and compression. It varies according to the release level of the ZLIB compression package. + + * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression level (fastest) + and 9 is the highest compression level (slowest). + + """ + command = f"PNGR,{kywrd},{opt},{val}" + return self.run(command, **kwargs) + + def tiff(self, kywrd: str = "", opt: str = "", **kwargs): + r"""Provides TIFF file export for Mechanical APDL displays. + + Mechanical APDL Command: `TIFF `_ + + Parameters + ---------- + kywrd : str + Specifies various TIFF file export options. + + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` controls data compression for the output file. If COMP = 0, then + compression is off. If COMP = 1 (default), then compression is on. + + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can + be either Horizontal (default) or Vertical. + + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color attribute of the saved file. ``OPT`` can + be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. + + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, + corresponding to bitmap text (default) or line stroke text, respectively. + + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed + above, are active. + + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + + * ``1 or 0`` - If ``Kywrd`` = COMP, a value or 1 (on) or 0 (off) will control compression for the TIFF file. + + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. + + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, + respectively. + + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will + be used + + """ + command = f"TIFF,{kywrd},{opt}" + return self.run(command, **kwargs) + + def mrep( + self, + name: str = "", + arg1: str = "", + arg2: str = "", + arg3: str = "", + arg4: str = "", + arg5: str = "", + arg6: str = "", + arg7: str = "", + arg8: str = "", + arg9: str = "", + arg10: str = "", + arg11: str = "", + arg12: str = "", + arg13: str = "", + arg14: str = "", + arg15: str = "", + arg16: str = "", + arg17: str = "", + arg18: str = "", + **kwargs, + ): + r"""Enables you to reissue the graphics command macro "name" during a replot or zoom operation. + + Mechanical APDL Command: `/MREP `_ + + Parameters + ---------- + name : str + The name identifying the macro file or macro block on a macro library file. The name can contain + up to eight characters maximum and must begin with a letter. + + arg1 : str + Values to be passed into the file or block. + + arg2 : str + Values to be passed into the file or block. + + arg3 : str + Values to be passed into the file or block. + + arg4 : str + Values to be passed into the file or block. + + arg5 : str + Values to be passed into the file or block. + + arg6 : str + Values to be passed into the file or block. + + arg7 : str + Values to be passed into the file or block. + + arg8 : str + Values to be passed into the file or block. + + arg9 : str + Values to be passed into the file or block. + + arg10 : str + Values to be passed into the file or block. + + arg11 : str + Values to be passed into the file or block. + + arg12 : str + Values to be passed into the file or block. + + arg13 : str + Values to be passed into the file or block. + + arg14 : str + Values to be passed into the file or block. + + arg15 : str + Values to be passed into the file or block. + + arg16 : str + Values to be passed into the file or block. + + arg17 : str + Values to be passed into the file or block. + + arg18 : str + Values to be passed into the file or block. + + Notes + ----- + + .. _s-MREP_notes: + + This command reissues the graphics command macro "name" during a replot operation ( :ref:`replot` ) + or a zoom ( :ref:`zoom` ) operation. The program passes the command macro arguments to the replot + and zoom feature for use by the graphics macro. You should place the ``s-MREP`` command at the end + of the graphics command macro, following the last graphics command within the macro, to enable the + replot or zoom feature. + """ + command = f"/MREP,{name},{arg1},{arg2},{arg3},,{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" + return self.run(command, **kwargs) + + def gresume(self, fname: str = "", ext: str = "", **kwargs): + r"""Sets graphics settings to the settings on a file. + + Mechanical APDL Command: `/GRESUME `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is + blank. + + Notes + ----- + + .. _s-GRESUME_notes: + + Causes a file to be read to reset the graphics slash (/) commands as they were at the last + :ref:`gsave` command. + + This command is valid in any processor. + """ + command = f"/GRESUME,{fname},{ext}" + return self.run(command, **kwargs) + + def gfile(self, size: str = "", **kwargs): + r"""Specifies the pixel resolution on Z-buffered graphics files. + + Mechanical APDL Command: `/GFILE `_ + + Parameters + ---------- + size : str + Pixel resolution. Defaults to a pixel resolution of 800. Valid values are from 256 to 2400. + + Notes + ----- + + .. _s-GFILE_notes: + + Defines the pixel resolution on subsequently written graphics files (for example, JPEG, PNG, TIFF) + for software Z-buffered displays ( :ref:`slashtype` ). Lowering the pixel resolution produces a + fuzzier image; increasing the resolution produces a sharper image but takes a little longer. + + This command is valid in any processor. + """ + command = f"/GFILE,{size}" + return self.run(command, **kwargs) + + def graphics(self, key: str = "", **kwargs): + r"""Defines the type of graphics display. + + Mechanical APDL Command: `/GRAPHICS `_ + + Parameters + ---------- + key : str + Graphics key: + + * ``FULL`` - Display all model geometry and results. + + * ``POWER`` - Activate PowerGraphics (default when GUI is on). + + Notes + ----- + + .. _s-GRAPHICS_notes: + + The :ref:`graphics` command specifies the type of graphics display. ``Key`` = POWER activates the + PowerGraphics capability. PowerGraphics offers faster plotting than the _nolinebreak? ``Key`` = FULL + option, /_nolinebreak? and speeds up element, results, area, line, and volume displays. + + The default PowerGraphics mode is enabled automatically when accessing the GUI. This action + supersedes all prior macros or start-up routines ( :file:`start.ans`, :file:`config.ans`, etc.). + Full graphics mode is accessed only by issuing :ref:`graphics`,FULL after the GUI is active. + + Results values (both printed and plotted) may differ between the _nolinebreak? ``Key`` = FULL + /_nolinebreak? and ``Key`` = POWER options because each option specifies a different set of data for + averaging and display. For _nolinebreak? ``Key`` = FULL /_nolinebreak?, all element and results + values (interior and surface) are included. For _nolinebreak? ``Key`` = POWER /_nolinebreak?, only + element and results values along the model exterior surface are processed. + + When ``Key`` = FULL, it is possible to deselect an individual node, select all elements (including + the element that contains that node), and then perform postprocessing calculations on those elements + and have that unselected node not be considered in those calculations. If PowerGraphics is active, + however, postprocessing always displays based on selected elements. + + If you have specified one facet per element edge for PowerGraphics displays (via the :ref:`efacet` + command or options from the General Postproc or Utility menu), PowerGraphics does not plot midside + nodes. ( :ref:`efacet` applies to element type displays only.) + + Maximum values shown in plots can differ from printed maximum values. This is due to different + averaging schemes used for plotted and printed maximum values. + + When using solution coordinate systems for results output ( :ref:`rsys`,SOLU) with PowerGraphics, + the deformed or displaced shape in a POST1 contour display can be unexpected (although the contours + are displayed in the expected colors). The program does not rotate displacement values (Ux,Uy,Uz) to + global; instead, the displacements (stored locally) are added directly to the global coordinates + (X,Y,Z). For example, if in PREP7 the nodes are rotated 90 degrees about the z axis and the global + Uy displacements are relatively large, the Ux values will be large, causing the model to display a + large deformation in the global X direction. + + PowerGraphics displays do not average at geometric discontinuities. The printouts in PowerGraphics + will, however, provide averaging information at geometric discontinuities if the models do not + contain shell elements. Carefully inspect the data you obtain at geometric discontinuities. + + PowerGraphics does not support the following diffusion analysis results: CONC, CG, DF, EPDI. + + ``Key`` = FULL is not available for `XFEM-based crack-growth analysis + `_. + + Excepting a few options, PowerGraphics supports these commands: + + InformalTables need to be added. + The following commands are executed via the _nolinebreak? ``Key`` = FULL /_nolinebreak? option, + regardless of whether PowerGraphics is activated: + + InformalTables need to be added. + """ + command = f"/GRAPHICS,{key}" + return self.run(command, **kwargs) + + def gcolumn(self, curve: str = "", string: str = "", **kwargs): + r"""Allows the user to apply a label to a specified curve. + + Mechanical APDL Command: `/GCOLUMN `_ + + Parameters + ---------- + curve : str + Curve number on which label will be applied (integer value between 1 and 10). + + string : str + Name or designation that will be applied to the curve (8 characters max). + + Notes + ----- + + .. _s-GCOLUMN_notes: + + This command is used for an array parameter plot (a plot created by the :ref:`starvplot` command). + Normally the label for curve 1 is COL 1, the label for curve 2 is COL 2 and so on; the column number + is the field containing the dependent variables for that particular curve. Issuing :ref:`gcolumn`, + ``CURVE``, with no string value specified resets the label to the original value. + """ + command = f"/GCOLUMN,{curve},{string}" + return self.run(command, **kwargs) + + def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): + r"""Controls the entities that the :ref:`gplot` command displays. + + Mechanical APDL Command: `/GTYPE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which this command applies (defaults to 1) + + label : str + This represents the type of entity to display: + + * ``NODE`` - Nodes + + * ``ELEM`` - Elements + + * ``KEYP`` - Keypoints + + * ``LINE`` - Lines + + * ``AREA`` - Areas + + * ``VOLU`` - Volumes + + * ``GRPH`` - Graph displays + + key : int or str + Switch: + + * ``0`` - Turns the entity type off. + + * ``1`` - Turns the entity type on. + + Notes + ----- + + .. _s-GTYPE_notes: + + The :ref:`gtype` command controls which entities the :ref:`gplot` command displays. NODE, ELEM, + KEYP, LINE, AREA, and VOLU are on by default. When ELEM is activated, you can control the type of + element displayed via the :ref:`gcmd` command (which also controls the type of graph display). When + the GRPH entity type is activated, all other entity types are deactivated. Conversely, when any of + the NODE, ELEM, KEYP, LINE, AREA, and VOLU entity types are active, the GRPH entity type is + deactivated. + + The :ref:`gtype` command gives you several options for multi-window layout: + + One window Two windows (left and right or top and bottom of the screen) Three windows (two at the + top and one at the bottom of the screen, or one top and two bottom windows Four windows (two at the + top and two at the bottom) + + Once you choose a window layout, you can choose one of the following: multiple plots, replotting, or + no redisplay. + + This command is valid in any processor. + """ + command = f"/GTYPE,{wn},{label},{key}" + return self.run(command, **kwargs) + + def gsave(self, fname: str = "", ext: str = "", **kwargs): + r"""Saves graphics settings to a file for later use. + + Mechanical APDL Command: `/GSAVE `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is + blank. + + Notes + ----- + + .. _s-GSAVE_notes: + + This command does not save all graphics settings, but only those that may be reset by the + :ref:`slashreset` command. The database remains untouched. Use the :ref:`gresume` command to read + the file. Repeated use of the :ref:`gsave` command overwrites the previous data on the file. The + following commands are saved by :ref:`gsave` : + + InformalTables need to be added. + + This command is valid in any processor. + """ + command = f"/GSAVE,{fname},{ext}" + return self.run(command, **kwargs) + + def gcmd( + self, + wn: str = "", + lab1: str = "", + lab2: str = "", + lab3: str = "", + lab4: str = "", + lab5: str = "", + lab6: str = "", + lab7: str = "", + lab8: str = "", + lab9: str = "", + lab10: str = "", + lab11: str = "", + lab12: str = "", + **kwargs, + ): + r"""Controls the type of element or graph display used for the :ref:`gplot` command. + + Mechanical APDL Command: `/GCMD `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which this command applies (defaults to 1) + + lab1 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab2 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab3 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab4 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab5 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab6 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab7 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab8 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab9 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab10 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab11 : str + Command labels (for example, :ref:`plnsol`,S,X) + + lab12 : str + Command labels (for example, :ref:`plnsol`,S,X) + + Notes + ----- + + .. _s-GCMD_notes: + + This command controls the type of element or graph display that appears when you issue the + :ref:`gplot` command when the :ref:`gtype`,,(ELEM or GRPH) entity type is active. If you have + multiple plotting windows enabled, you can also use :ref:`gcmd` to select one window when you wish + to edit its contents. + + For related information, see the descriptions of the :ref:`gplot` and :ref:`gtype` commands in this + manual. + + This command is valid in any processor. + """ + command = f"/GCMD,{wn},{lab1},{lab2},{lab3},{lab4},{lab5},{lab6},{lab7},{lab8},{lab9},{lab10},{lab11},{lab12}" + return self.run(command, **kwargs) + + def gplot(self, **kwargs): + r"""Controls general plotting. + + Mechanical APDL Command: `GPLOT `_ + + Notes + ----- + + .. _GPLOT_notes: + + This command displays all entity types as specified via the :ref:`gtype` command. Only selected + entities ( :ref:`nsel`, :ref:`esel`, :ref:`ksel`, :ref:`lsel`, :ref:`asel`, :ref:`vsel` ) will be + displayed. See the descriptions of the :ref:`gtype` and :ref:`gcmd` commands for methods of setting + the entity types displayed. + + This command is valid in any processor. + """ + command = "GPLOT" + return self.run(command, **kwargs) + + def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): + r"""Provides JPEG file export for Mechanical APDL displays. + + Mechanical APDL Command: `JPEG `_ + + Parameters + ---------- + kywrd : str + Specifies various JPEG file export options. + + * ``QUAL`` - If ``Kywrd`` = QUAL, then ``OPT`` is an integer value defining the JPEG quality index on an + arbitrary scale ranging from 1 to 100. The default value is 75. + + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can + be either Horizontal (default) or Vertical. + + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. ``OPT`` can be + 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. + + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, + corresponding to bitmap text (default) or line stroke text, respectively. + + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed + above, are active. + + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + + * ``1 to 100`` - If ``Kywrd`` = QUAL, a value between 1 and 100 will determine the quality index of the JPEG file. + + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. + + * ``0,1,2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, + respectively. + + * ``1,0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will + be used + + """ + command = f"JPEG,{kywrd},{opt}" + return self.run(command, **kwargs) + + def show( + self, + fname: str = "", + option: str = "", + vect: int | str = "", + ncpl: str = "", + **kwargs, + ): + r"""Specifies the device and other parameters for graphics displays. + + Mechanical APDL Command: `/SHOW `_ + + Parameters + ---------- + fname : str + Device name, file name, or keyword, as listed below: + + * ``<, device name >`` - Any valid graphics display device name (for example, X11, 3D etc.). Defaults to X11 for most + systems. See `Getting Started with Graphics + `_ in the `Basic Analysis Guide `_ + for details. A device name must be defined before activating the Graphical User Interface (GUI). + Once the GUI is activated, the device name cannot be changed for that session, except for switching + between X11 and X11C. + + * ``TERM`` - Graphics displays are switched back to the last-specified device name. + + * ``CLOSE`` - This option purges the graphics file buffer. The CLOSE option should be issued any time you are + changing graphics devices or file output types during a session. Graphics displays are switched back + to the last-specified device name, and any open graphics files are closed. The CLOSE option is + similar to the TERM option, however, with the CLOSE option, another process can access the data in + the graphics file. The CLOSE option causes graphics file buffers to be flushed to the graphics file. + + * ``OFF`` - Graphics display requests are ignored. + + * ``(blank)`` - If blank in interactive mode, graphics will be displayed on screen as requested by display commands + (no file written). + + * ``JPEG`` - Creates JPEG files that are named :file:`Jobname` nnn.jpg, where ``nnn`` is a numeric value that is + incremented by one as each additional file is created; that is, :file:`Jobname000.jpg`, + :file:`Jobname001.jpg`, :file:`Jobname002.jpg`, and so on. Ignores the ``Ext`` field. + + * ``TIFF`` - Creates tagged image format files that are named :file:`Jobname` nnn.tif, where ``nnn`` is a numeric + value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.tif`, :file:`Jobname001.tif`, :file:`Jobname002.tif`, and so on. This value for + the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`tiff` command for options.) + + * ``PNG`` - Creates PNG (Portable Network Graphics) files that are named :file:`Jobname` nnn.png, where ``nnn`` + is a numeric value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.png`, :file:`Jobname001.png`, :file:`Jobname002.png`, and so on. This value for + the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`pngr` command for options.) + + * ``VRML`` - Creates Virtual Reality Meta Language files named :file:`Jobname000.wrl` that can be displayed on 3D + Internet web browsers. Ignores the ``Ext`` and ``NCPL`` fields. + + option : str + Assign a file name extension or specify reverse video output: + + * ``Ext`` - File name extension (eight-character maximum). + + * ``REV`` - Reverse background/image (black/white) colors. Valid with ``Fname`` = PNG (recommended), JPEG, and + TIFF. This option is ignored if a previously specified color map table ( :ref:`cmap` or :ref:`rgb` ) + is in effect. + + vect : int or str + Specifies raster or vector display mode. This affects area, volume, and element displays, as well as + geometric results displays such as contour plots. See the :ref:`device` command for an alternate way to toggle between raster and vector mode. Changing ``VECT`` also resets the :ref:`slashtype` command to its default. + + * ``0`` - Raster display (color filled entities; default) + + * ``1`` - Vector display (outlined entities; that is, "wireframe") + + ncpl : str + Sets the number of color planes (4 to 8). Default is device-dependent. ``NCPL`` is not supported + by all graphics devices. + + Notes + ----- + + .. _s-SHOW_notes: + + Specifies the device to be used for graphics displays, and specifies other graphics display + parameters. Display may be shown at the time of generation (for interactive runs at a graphics + display terminal) or diverted to a file. Issue :ref:`pstatus` for display status. + + Batch runs do not have access to the fonts available on your system. The Courier and Helvetica font + files used for JPEG, PNG and TIFF batch output are copyrighted by Adobe Systems Inc. and Digital + Equipment Corp. Permission to use these trademarks is hereby granted only in association with the + images described above. Batch run JPEG output is produced at the default quality index value of 75, + unless specified otherwise. + + Interactive displays default to eight color planes ( ``NCPL`` = 8) for most monitors, while graph + file output defaults to eight color planes for VRML output, and four color planes for JPEG, PNG, and + TIFF. + + This command is valid in any processor. + """ + command = f"/SHOW,{fname},{option},{vect},{ncpl}" + return self.run(command, **kwargs) + + def seg(self, label: str = "", aviname: str = "", delay: str = "", **kwargs): + r"""Allows graphics data to be stored in the local terminal memory. + + Mechanical APDL Command: `/SEG `_ + + Parameters + ---------- + label : str + Storage key: + + * ``SINGL`` - Store subsequent display in a single segment (overwrites last storage). + + * ``MULTI`` - Store subsequent displays in unique segments ( :ref:`anim` ). + + * ``DELET`` - Delete all currently stored segments. + + * ``OFF`` - Stop storing display data in segments. + + * ``STAT`` - Display segment status. + + * ``PC`` - This option only applies to PC versions of Mechanical APDL and only when animating via the AVI movie player + ( :ref:`device`,ANIM,2). The command appends frames to the :file:`File.AVI`, so that the animation + goes in both directions (that is, forward--backward--forward). You must have a current animation + file to use this option. + + aviname : str + Name of the animation file that will be created when each frame is saved. The :file:`.AVI` + extension is applied automatically. Defaults to :file:`Jobname.AVI` if no filename is specified. + + delay : str + Delay factor between each frame, in seconds. Defaults to 0.015 seconds if no value is specified. + + Notes + ----- + + .. _s-SEG_notes: + + Allows graphics data to be stored in the terminal local memory (device-dependent). Storage occurs + concurrently with the display. + + Although the information from your graphics window is stored as an individual segment, you cannot + plot directly ( :ref:`gplot` ) from the segment memory. + + This command is valid in any processor. + """ + command = f"/SEG,{label},{aviname},{delay}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/style.py b/src/ansys/mapdl/core/_commands/graphics/style.py new file mode 100644 index 00000000000..856da2a92b5 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/style.py @@ -0,0 +1,923 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Style: + + def ctype( + self, + key: int | str = "", + dotd: str = "", + dots: str = "", + dshp: int | str = "", + tlen: str = "", + **kwargs, + ): + r"""Specifies the type of contour display. + + Mechanical APDL Command: `/CTYPE `_ + + **Command default:** + + .. _s-CTYPE_default: + + Standard contour display. + + Parameters + ---------- + key : int or str + Type of display: + + * ``0`` - Standard contour display. + + * ``1`` - Isosurface display. + + * ``2`` - Particle gradient display. + + * ``3`` - Gradient triad display. + + dotd : str + Maximum dot density for particle gradient display ( ``KEY`` = 2). Density is expressed as dots + per screen width (defaults to 30). + + dots : str + Dot size for particle gradient display ( ``KEY`` = 2). Size is expressed as a fraction of the + screen width (defaults to 0.0 (single dot width)). + + dshp : int or str + Spherical dot shape precision for particle gradient display ( ``KEY`` = 2). (3D options are supported only on 3D devices): + + * ``0`` - Flat 2D circular dot. + + * ``1`` - Flat-sided 3D polyhedron. + + * ``n`` - 3D sphere with ``n`` (>1) polygon divisions per 90° of radius. + + tlen : str + Maximum length of triads for gradient triad display ( ``KEY`` = 3). Value is expressed as a + fraction of the screen width (defaults to 0.067). + + Notes + ----- + + .. _s-CTYPE_notes: + + Use :ref:`ctype`,STAT to display the current settings. Only the standard contour display ( + :ref:`ctype`,0) and the isosurface contour display ( :ref:`ctype`,1) are supported by PowerGraphics + ( :ref:`graphics`,POWER). + + This command is valid in any processor. + """ + command = f"/CTYPE,{key},{dotd},{dots},{dshp},{tlen}" + return self.run(command, **kwargs) + + def cplane(self, key: int | str = "", **kwargs): + r"""Specifies the cutting plane for section and capped displays. + + Mechanical APDL Command: `/CPLANE `_ + + **Command default:** + + .. _s-CPLANE_default: + + The cutting plane is normal to the viewing vector at the focus point. + + Parameters + ---------- + key : int or str + Specifies the cutting plane: + + * ``0`` - Cutting plane is normal to the viewing vector ( :ref:`view` ) and passes through the focus point ( + :ref:`focus` ) (default). + + * ``1`` - The working plane ( :ref:`wplane` ) is the cutting plane. + + Notes + ----- + + .. _s-CPLANE_notes: + + Defines the cutting plane to be used for section and capped displays ( :ref:`slashtype`,,(1, 5, or + 7)). + + This command is valid in any processor. + """ + command = f"/CPLANE,{key}" + return self.run(command, **kwargs) + + def light( + self, + wn: str = "", + num: int | str = "", + int: str = "", + xv: str = "", + yv: str = "", + zv: str = "", + refl: str = "", + **kwargs, + ): + r"""Specifies the light direction for the display window. + + Mechanical APDL Command: `/LIGHT `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + num : int or str + Ambient or directional light key: + + * ``0`` - Ambient light (default). + + * ``1`` - Directional light. + + int : str + Light intensity factor (defaults to 0.3 for ambient, 1.0 for directional). This option is valid + only for 3D devices). + + xv : str + Light direction (valid only for ``NUM`` = 1). The directional light source is parallel to the + line from point ``XV``, ``YV``, ``ZV`` to the origin, in the global Cartesian system origin. + Defaults to the viewing direction ( :ref:`view` ). + + yv : str + Light direction (valid only for ``NUM`` = 1). The directional light source is parallel to the + line from point ``XV``, ``YV``, ``ZV`` to the origin, in the global Cartesian system origin. + Defaults to the viewing direction ( :ref:`view` ). + + zv : str + Light direction (valid only for ``NUM`` = 1). The directional light source is parallel to the + line from point ``XV``, ``YV``, ``ZV`` to the origin, in the global Cartesian system origin. + Defaults to the viewing direction ( :ref:`view` ). + + refl : str + Light reflectance factor (valid only for ``NUM`` = 1 and 3D devices). + + Notes + ----- + + .. _s-LIGHT_notes: + + Defines the light direction for the window. Use this command only with 3D graphics devices or 2D + devices when Z-buffering is used ( :ref:`slashtype`,,(6 or 7)). The ambient light has no direction, + only an intensity. You can position the directional light source by defining a point (in the global + Cartesian coordinate system) representing a point along the light directional line. This point, and + the global Cartesian coordinate system origin, define the line along which the light is positioned + looking toward the origin. You can use any point along the light line; for example, both (1.,1.,1.) + and (2.,2.,2.) give the same light effect. For 3D graphics devices only, the directional light + source also has intensity and reflectance factors. + + By choosing the highest intensity ambient light for 3D graphics devices (via :ref:`light`,WN,0,1), + you can nullify color shading and other effects of directional lighting. + + This command is valid in any processor. + """ + command = f"/LIGHT,{wn},{num},{int},{xv},{yv},{zv},{refl}" + return self.run(command, **kwargs) + + def eshape(self, scale: str = "", key: str = "", **kwargs): + r"""Displays elements with shapes determined from the real constants, section definition, or other + inputs. + + Mechanical APDL Command: `/ESHAPE `_ + + **Command default:** + + .. _s-ESHAPE_default: + + Use simple display of line and area elements ( ``SCALE`` = 0). + + Parameters + ---------- + scale : int or str + Scaling factor: + + * ``0`` - Use simple display of line and area elements. This value is the default. + + * ``1`` - Use real constants, section definition, or other information to form a solid shape display of the + applicable elements. + + * ``FAC`` - Multiply certain real constants, such as thickness, by ``FAC`` (where ``FAC`` > 0.01) and use them + to form a solid shape display of elements. + + key : int or str + Current shell thickness key: + + * ``0`` - Use current thickness in the displaced solid shape display of shell elements (valid for SHELL181, + SHELL208, SHELL209, and SHELL281 ). This value is the default. + + * ``1`` - Use initial thickness in the displaced solid shape display of shell elements. + + Notes + ----- + The /ESHAPE command allows beams, shells, current sources, and + certain special-purpose elements to be displayed as solids + with the shape determined from the real constants or section + types. Elements are displayed via the EPLOT command. No checks + for valid or complete input are made for the display. + + Following are details about using this command with various + element types: + + SOLID65 elements are displayed with internal lines that + represent rebar sizes and orientations (requires vector mode + [/DEVICE] with a basic type of display [/TYPE,,BASIC]). The + rebar with the largest volume ratio in each element plots as a + red line, the next largest as green, and the smallest as blue. + + COMBIN14, COMBIN39, and MASS21 are displayed with a graphics + icon, with the offset determined by the real constants and + KEYOPT settings. + + BEAM188, BEAM189, PIPE288, PIPE289 and ELBOW290 are displayed + as solids with the shape determined via the section-definition + commands (SECTYPE and SECDATA). The arbitrary section option + (Subtype = ASEC) has no definite shape and appears as a thin + rectangle to show orientation. The elements are displayed with + internal lines representing the cross- section mesh. + + SOLID272 and SOLID273 are displayed as solids with the shape + determined via the section-definition commands (SECTYPE and + SECDATA). The 2-D master plane is revolved around the + prescribed axis of symmetry. + + Contour plots are available for these elements in + postprocessing for PowerGraphics only (/GRAPHICS,POWER). To + view 3-D deformed shapes for the elements, issue OUTRES,MISC + or OUTRES,ALL for static or transient analyses. To view 3-D + mode shapes for a modal or eigenvalue buckling analysis, + expand the modes with element results calculation ON (Elcalc = + YES for MXPAND). + + SOURC36, CIRCU124, and TRANS126 elements always plot using + /ESHAPE when PowerGraphics is activated (/GRAPHICS,POWER). + + In most cases, /ESHAPE renders a thickness representation of + your shell, plane and layered elements more readily in + PowerGraphics (/GRAPHICS,POWER). This type of representation + employs PowerGraphics to generate the enhanced representation, + and will often provide no enhancement in Full Graphics + (/GRAPHICS,FULL). This is especially true for POST1 results + displays, where /ESHAPE is not supported for most element + types with FULL graphics. + + When PowerGraphics is active, /ESHAPE may degrade the image if + adjacent elements have overlapping material, such as shell + elements which are not co-planar. Additionally, if adjacent + elements have different thicknesses, the polygons depicting + the connectivity between the "thicker" and "thinner" elements + along the shared element edges may not always be displayed. + + For POST1 results displays (such as PLNSOL), the following + limitations apply: + + Rotational displacements for beam elements are used to create + a more realistic displacement display. When /ESHAPE is active, + displacement plots (via PLNSOL,U,X and PLDISP, for example) + may disagree with your PRNSOL listings. This discrepancy will + become more noticeable when the SCALE value is not equal to + one. + + When shell elements are not co-planar, the resulting PLNSOL + display with /ESHAPE will actually be a PLESOL display as the + non-coincident pseudo-nodes are not averaged. Additionally, + /ESHAPE should not be used with coincident elements because + the plot may incorrectly average the displacements of the + coincident elements. + + When nodes are initially coincident and PowerGraphics is + active, duplicate polygons are eliminated to conserve display + time and disk space. The command may degrade the image if + initially coincident nodes have different displacements. The + tolerance for determining coincidence is 1E-9 times the + model``s bounding box diagonal. + + If you want to view solution results (PLNSOL, etc.) on layered + elements (such as SHELL181, SOLSH190, SOLID185 Layered Solid, + SOLID186 Layered Solid, SHELL208, SHELL209, SHELL281, and + ELBOW290), set KEYOPT(8) = 1 for the layer elements so that + the data for all layers is stored in the results file. + + You can plot the through-thickness temperatures of elements + SHELL131 and SHELL132 regardless of the thermal DOFs in use by + issuing the PLNSOL,TEMP command (with PowerGraphics and + /ESHAPE active). + + The /ESHAPE,1 and /ESHAPE,FAC commands are incompatible with + the /CYCEXPAND command used in cyclic symmetry analyses. + + This command is valid in any processor. + """ + warnings.warn( + "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(vtk=False)`` " + ) + command = f"/ESHAPE,{scale},{key}" + return self.run(command, **kwargs) + + def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): + r"""Displays only the common lines (“edges”) of an object. + + Mechanical APDL Command: `/EDGE `_ + + **Command default:** + + .. _s-EDGE_default: + + For element plots, display common lines between all adjacent element faces. For contour plots, + display only the common lines between non-coplanar faces. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies. The default window is 1. + + key : int or str + Edge key: + + **Elements Plots** + + * ``0`` - Display common lines between all adjacent element faces. + + * ``1`` - Display only the common lines between non-coplanar faces (that is, show only the edges). + + **Contour Plots** + + * ``0`` - Display only the common lines between non-coplanar faces. + + * ``1`` - Display common lines between all element faces. + + angle : str + Largest angle between two faces for which the faces are considered to be coplanar (0° to 180°). + Defaults to 45°. A smaller angle produces more edges, a larger angle produces fewer edges. + + Notes + ----- + + .. _s-EDGE_notes: + + The ``ANGLE`` field is used in PowerGraphics to determine geometric discontinuities. It is a + tolerance measure for the differences between the normals of the surfaces being considered. Values + within the tolerance are accepted as coplanar (geometrically continuous). In postprocessing + displays, results are not averaged across discontinuous surfaces. + + A surface can be displayed as an edge outline without interior detail. This is useful for both + geometry and postprocessing displays. Element outlines are normally shown as solid lines for + geometry and displacement displays. Lines common to adjacent "coplanar" element faces are removed + from the display. Midside nodes of elements are ignored. + + The :ref:`shrink` option is ignored with the edge option. + + :ref:`edge` is not supported for :ref:`plesol` and :ref:`eshape` displays when in PowerGraphics mode + ( :ref:`graphics`,POWER). + + The :ref:`edge` command is valid in any processor. + """ + command = f"/EDGE,{wn},{key},{angle}" + return self.run(command, **kwargs) + + def facet(self, lab: str = "", **kwargs): + r"""Specifies the facet representation used to form solid model displays. + + Mechanical APDL Command: `/FACET `_ + + Parameters + ---------- + lab : str + Valid labels: + + * ``FINE`` - Use finer tessellation to increase the number of facets for the display. Provides the best + representation (but decreases speed of operation). + + * ``NORML`` - Use the basic number of facets for the display (default). + + * ``COAR`` - Use a limited number of facets for the display. This option will increase the speed of the + operations, but may produce poor representations for some imported models. + + * ``WIRE`` - Display model with a wireframe representation (fast, but surfaces will not be shown). + + Notes + ----- + + .. _s-FACET_notes: + + Specifies the facet (or polygon) representation used to form solid model displays. Used only with + the :ref:`aplot`, :ref:`asum`, :ref:`vplot`, and :ref:`vsum` commands. + + This command is valid in any processor. + """ + command = f"/FACET,{lab}" + return self.run(command, **kwargs) + + def normal(self, wn: str = "", key: int | str = "", **kwargs): + r"""Allows displaying area elements by top or bottom faces. + + Mechanical APDL Command: `/NORMAL `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + key : int or str + Display key: + + * ``0`` - No face distinction. + + * ``1`` - Show only area elements having their positive normals directed toward the viewing point. + + * ``-1`` - Show only area elements having their positive normals directed away from the viewing point. + + Notes + ----- + + .. _s-NORMAL_notes: + + :ref:`normal` allows you to select area elements and area plots by the top or bottom faces. It is + useful for checking the normal directions on shell elements. The positive normal (element Z + direction) is defined by the right-hand rule following the node I, J, K, L input direction. This + command is available only with raster or hidden-line displays, for WIN32 or X11 2D displays only. + + This command is valid in any processor. + """ + command = f"/NORMAL,{wn},{key}" + return self.run(command, **kwargs) + + def txtre( + self, + lab: str = "", + num: int | str = "", + n1: str = "", + n2: str = "", + ninc: str = "", + **kwargs, + ): + r"""Controls application of texture to selected items. + + Mechanical APDL Command: `/TXTRE `_ + + Parameters + ---------- + lab : str + You can apply texture according to the following labels: + + * ``ELEM`` - Apply texture to elements ``N1`` through ``N2`` in steps of ``NINC``. + + * ``AREA`` - Apply texture to areas ``N1`` through ``N2`` in steps of ``NINC``. + + * ``VOLU`` - Apply texture to volumes ``N1`` through ``N2`` in steps of ``NINC``. + + * ``CM`` - Apply texture to the component named in ``N1``. ``N2`` and ``NINC`` are ignored. + + * ``ON, OFF`` - Sets the specified texture display on or off. All other fields are ignored. + + * ``File`` - If Lab = File, the command format is :ref:`txtre`, File, ``Key_Index``, ``Fname``, ``Fext``, ``--``, ``Format`` (This variant of the command is applicable to 2D drivers). + + * ``Key_Index`` - The texture index associated with the file. If the number fifty-one (51) is used, the imported + bitmap will be used as the window's logo. + + * ``Fname`` - File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, you + can use all 248 characters for the file name. + * ``Fext`` - Filename extension (eight-character maximum). + * ``Format`` - The file format. If ``Format`` = 0, the file is a pixmap (Linux) or Bitmap (PC). The file cannot + contain a compressed image, and the PC file must be 8 or 24 bit BI_RGB format. If ``Format`` = 1 or + JPEG, then the file is in JPEG (Joint Photographic Experts Group) format. If ``Format`` = 2 or PNG, + then the file is in PNG (Portable Network Graphics) format. + + num : int or str + Select the texture index number from the following list: + + * ``0`` - No Texturing + + * ``1`` - Aluminum + + * ``2`` - Aluminum, Brushed + + * ``3`` - Steel With Bumps + + * ``4`` - Steel, Embossed + + * ``5`` - Iron + + * ``6`` - Steel, Pattern + + * ``7`` - Steel, Riveted + + * ``8`` - Steel, Scratched + + * ``9`` - Tin + + * ``10`` - Metal + + * ``11`` - Steel, Etched + + * ``12`` - Metal, Hot + + * ``13`` - Iron, Grainy + + * ``14`` - Metal, Rusty + + * ``15`` - Brick + + * ``16`` - Block + + * ``17`` - Wood + + * ``18`` - Wood, Light + + * ``19`` - Wood, Walnut + + * ``20`` - Plastic, Hard Blue + + * ``21`` - Plastic, Light Blue + + * ``22`` - Plastic, Hard Red + + * ``31`` - Gold + + * ``32`` - Brass + + * ``33`` - Silver + + * ``34`` - Plastic, Black + + * ``35`` - Plastic, Ivory + + * ``36`` - Plastic, Blue + + * ``37`` - Plastic, Red + + * ``38`` - Plastic, Yellow + + * ``39`` - Plastic, Green + + * ``40`` - Plastic, Brown + + n1 : str + Apply texture to ``Lab`` items numbered ``N1`` through ``N2`` in steps of ``NINC`` (defaults to + 1). If ``Lab`` = CM, then N1 is used to for the component name and ``N2`` and ``NINC`` are + ignored. If ``Lab`` = ELEM, AREA, or VOLU and ``N1`` = blank or ALL, then the specified texture + will be applied to all entities of type ``Lab``. If ``N1`` = P, then graphical picking is + enabled. + + n2 : str + Apply texture to ``Lab`` items numbered ``N1`` through ``N2`` in steps of ``NINC`` (defaults to + 1). If ``Lab`` = CM, then N1 is used to for the component name and ``N2`` and ``NINC`` are + ignored. If ``Lab`` = ELEM, AREA, or VOLU and ``N1`` = blank or ALL, then the specified texture + will be applied to all entities of type ``Lab``. If ``N1`` = P, then graphical picking is + enabled. + + ninc : str + Apply texture to ``Lab`` items numbered ``N1`` through ``N2`` in steps of ``NINC`` (defaults to + 1). If ``Lab`` = CM, then N1 is used to for the component name and ``N2`` and ``NINC`` are + ignored. If ``Lab`` = ELEM, AREA, or VOLU and ``N1`` = blank or ALL, then the specified texture + will be applied to all entities of type ``Lab``. If ``N1`` = P, then graphical picking is + enabled. + + Notes + ----- + + .. _s-TXTRE_notes: + + This command is available for 3D Open GL devices. 2D devices are supported **only** for the ``Lab`` + = File variation of the command, allowing imported bitmaps to be used for texturing and annotation. + Textures can affect the speed of many of your display operations. You can increase the speed by + temporarily turning the textures off ( Utility Menu> PlotCtrls> Style> Texturing(3D)> Display + Texturing ). This menu selection toggles your textures on and off. When textures are toggled off, + all of the + texture information is retained and reapplied when texturing is toggled back on. + + For some displays, the texture will appear distorted because of a technique used to enhance 3D + displays ( :ref:`dv3d`,TRIS,1). Disabling this function ( :ref:`dv3d`,TRIS,0) will improve the + quality of some texture displays. Disabling the TRIS option of the :ref:`dv3d` command will slow + down 3D displays significantly. Be sure to reapply the TRIS option after you obtain a satisfactory + output. + + Specifying :ref:`txtre`,DEFA removes all texturing. + """ + command = f"/TXTRE,{lab},{num},{n1},{n2},{ninc}" + return self.run(command, **kwargs) + + def slashtype(self, wn: str = "", type_: str = "", **kwargs): + r"""Defines the type of display. + + Mechanical APDL Command: `/TYPE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + type_ : str + Display type. Defaults to ZBUF for raster mode displays or BASIC for vector mode displays: + + * ``BASIC or 0`` - Basic display (no hidden or section operations). + + * ``SECT or 1`` - Section display (plane view). Use the :ref:`cplane` command to define the cutting plane. + + * ``HIDC or 2`` - Centroid hidden display (based on item centroid sort). + + * ``HIDD or 3`` - Face hidden display (based on face centroid sort). + + * ``HIDP or 4`` - Precise hidden display (like HIDD but with more precise checking). Because all facets are sorted, + this mode can be extremely slow, especially for large models. + + * ``CAP or 5`` - Capped hidden display (same as combined SECT and HIDD with model in front of section plane removed). + + * ``ZBUF or 6`` - Z-buffered display (like HIDD but using software Z-buffering). + + * ``ZCAP or 7`` - Capped Z-buffered display (same as combined SECT and ZBUF with model in front of section plane + removed). + + * ``ZQSL or 8`` - QSLICE Z-buffered display (same as SECT but the edge lines of the remaining 3D model are shown). + + * ``HQSL or 9`` - QSLICE precise hidden display (like ZQSL but using precise hidden). + + Notes + ----- + + .. _s-TYPE_notes: + + Defines the type of display, such as section display or hidden-line display. Use the :ref:`device` + command to specify either raster or vector mode. + + The SECT, CAP, ZCAP, ZQSL, and HQSL options produce section displays. The section or "cutting" plane + is specified on the :ref:`cplane` command as either normal to the viewing vector at the focus point + (default), or as the working plane. + + When you use PowerGraphics, the section display options (Section, Slice, and Capped) use different + averaging techniques for the interior and exterior results. Because of the different averaging + schemes, anomalies may appear at the transition areas. In many cases, the automatically computed MIN + and MAX values will differ from the full range of interior values. You can lessen the effect of + these anomalies by issuing :ref:`avres`,,FULL ( Main Menu> General Post Proc> Options for Outp ). + This command sets your legend's automatic contour interval range according to the minimum and + maximum results found throughout the entire model. + + With PowerGraphics active ( :ref:`graphics`,POWER), the averaging scheme for surface data with + interior element data included ( :ref:`avres`,,FULL) and multiple facets per edge ( :ref:`efacet`,2 + or :ref:`efacet`,4) will yield differing minimum and maximum contour values depending on the + Z-Buffering options ( :ref:`slashtype`,,6 or :ref:`slashtype`,,7). When the Section data is not + included in the averaging schemes ( :ref:`slashtype`,,7), the resulting absolute value for the + midside node is significantly smaller. + + The HIDC, HIDD, HIDP, ZBUF, ZQSL, and HQSL options produce displays with "hidden" lines removed. + Hidden lines are lines obscured from view by another element, area, etc. The choice of non-Z- + buffered hidden-line procedure types is available only for raster mode ( :ref:`device` ) displays. + For vector mode displays, all non-Z-buffered "hidden-line" options use the same procedure (which is + slightly different from the raster procedures). Both geometry and postprocessing displays may be of + the hidden-line type. Interior stress contour lines within solid elements can also be removed as + hidden lines, leaving only the stress contour lines and element outlines on the visible surfaces. + Midside nodes of elements are ignored on postprocessing displays. Overlapping elements will not be + displayed. + + The ZBUF, ZCAP, and ZQSL options use a specific hidden-line technique called software Z-buffering. + This technique allows a more accurate display of overlapping surfaces (common when using Boolean + operations or :ref:`eshape` on element displays), and allows smooth shaded displays on all + interactive graphics displays. Z-buffered displays can be performed faster than HIDP and CAP type + displays for large models. See also the :ref:`light`, :ref:`shade`, and :ref:`gfile` commands for + additional options when Z-buffering is used. + + This command is valid in any processor. + """ + command = f"/TYPE,{wn},{type_}" + return self.run(command, **kwargs) + + def trlcy( + self, + lab: str = "", + tlevel: str = "", + n1: str = "", + n2: str = "", + ninc: str = "", + **kwargs, + ): + r"""Specifies the level of translucency. + + Mechanical APDL Command: `/TRLCY `_ + + Parameters + ---------- + lab : str + Apply translucency level to the items specified by the following labels: + + * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. + + * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. + + * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. + + * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc., value). Translucency varies with result value, to a + maximum of the specified translucency level. + + * ``CM`` - Component group. Use ``N1`` for component name, ignore ``N2`` and ``NINC``. + + * ``CURVE`` - Filled areas under curves of line graphs. Use ``N1``, ``N2``, ``NINC`` fields for curve numbers. + + * ``ZCAP`` - If :ref:`slashtype`, ``WN``,ZCAP is the current display type, then :ref:`trlcy`,ZCAP, ``TLEVEL`` + will display the model in window ``WN`` with the portion of the model in front of the section plane + displayed at the translucency level ``TLEVEL``. + + * ``ON, OFF`` - Sets the specified translucency display on or off. All other fields are ignored. + + tlevel : str + Translucency level: 0.0 (opaque) to 1.0 (transparent). + + n1 : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. + + n2 : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. + + ninc : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. + + Notes + ----- + + .. _s-TRLCY_notes: + + Specifies the level of translucency for various items. Issue :ref:`trlcy`,DEFA to reset the default + (0) translucency levels. This command is valid only on selected 2D and 3D graphics devices; see + filename="Hlp_G_BAS11_3.html"? in the `Basic Analysis Guide + `_ for more + information on applying translucency. + + For 2D devices, the program displays only the visible faces of the items being displayed. The + information behind the facing planes is not displayed. Issuing the :ref:`shrink` command will force + the hardware to display information behind the translucent items. + + This command is valid in any processor. + """ + command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" + return self.run(command, **kwargs) + + def gmface(self, lab: str = "", n: str = "", **kwargs): + r"""Specifies the facet representation used to form solid models. + + Mechanical APDL Command: `GMFACE `_ + + Parameters + ---------- + lab : str + Valid Labels: + + * ``FINE`` - Value that determines how coarse the facets will be. + + n : str + An integer value between one (small) and ten (large) that determines the tolerances that will be + applied to the creation of arcs and surfaces. Ten will create many facets, which may in turn + cause Mechanical APDL to run very slowly. One will create fewer facets, which may in turn cause + larger tolerance errors. + """ + command = f"GMFACE,{lab},{n}" + return self.run(command, **kwargs) + + def gmarker(self, curve: str = "", key: int | str = "", incr: str = "", **kwargs): + r"""Specifies the curve marking style. + + Mechanical APDL Command: `/GMARKER `_ + + Parameters + ---------- + curve : str + Curve number markers will be applied on (integer value between 1 and 10). + + key : int or str + Marker key: + + * ``0`` - No markers will be applied (default). + + * ``1`` - TRIANGLES will be applied. + + * ``2`` - SQUARES will be applied. + + * ``3`` - DIAMONDS will be applied. + + * ``4`` - CROSSES will be applied. + + incr : str + Determines the curve marking frequency. (a whole number value between 1 and 255). If ``INCR`` = + 1, markers are displayed at every data point on the curve. If ``INCR`` = 2 then markers are + displayed at every second data point. If ``INCR`` = 3 then they are displayed at every third + data point. + + Notes + ----- + + .. _s-GMARKER_notes: + + The user-specified markers will not be drawn when the area under the curve is color-filled ( + :ref:`gropt`, FILL). + """ + command = f"/GMARKER,{curve},{key},{incr}" + return self.run(command, **kwargs) + + def gline(self, wn: str = "", style: int | str = "", **kwargs): + r"""Specifies the element outline style. + + Mechanical APDL Command: `/GLINE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + style : int or str + Outline key: + + * ``0`` - Solid element outlines (default) + + * ``1`` - Dashed element outlines + + * ``-1`` - No element outlines + + Notes + ----- + + .. _s-GLINE_notes: + + Determines the element outline style. Often used when node numbers are displayed to prevent element + lin es from overwriting node numbers. + + Unless you are using an OpenGL or Starbase driver, the dashed element outline option ( :ref:`gline`, + ``WN``,1) is not available in the following situations: + + Z-buffered displays ( :ref:`slashtype`, ``WN``,6). + Capped Z-buffered displays ( :ref:`slashtype`, ``WN``,7). + Qslice Z-buffered displays ( :ref:`slashtype`, ``WN``,8). + + This command is valid in any processor. + """ + command = f"/GLINE,{wn},{style}" + return self.run(command, **kwargs) + + def shade(self, wn: str = "", type_: str = "", **kwargs): + r"""Defines the type of surface shading used with Z-buffering. + + Mechanical APDL Command: `/SHADE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + type_ : str + Shading type: + + * ``FACET or 0`` - Facet shading (one color per area face). + + * ``GOURAUD or 1`` - Gouraud smooth shading (smooth variation of color based on interpolated vertex colors) (default). + + * ``PHONG or 2`` - Phong smooth shading (smooth variation of color based on interpolated vertex normals). + + Notes + ----- + + .. _s-SHADE_notes: + + Defines the type of surface shading used on area, volume, and PowerGraphics ( :ref:`graphics`,POWER) + displays when software Z-buffering is enabled ( :ref:`slashtype` ). This command is only functional + for 2D display devices. + + This command is valid in any processor. + """ + command = f"/SHADE,{wn},{type_}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/views.py b/src/ansys/mapdl/core/_commands/graphics/views.py new file mode 100644 index 00000000000..f35ff87c0de --- /dev/null +++ b/src/ansys/mapdl/core/_commands/graphics/views.py @@ -0,0 +1,545 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Views: + + def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): + r"""Specifies the viewing distance for magnifications and perspective. + + Mechanical APDL Command: `/DIST `_ + + **Command default:** + + .. _s-DIST_default: + + Distance is automatically calculated to produce full window magnification. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + dval : str + Distance along the view line from the observer to the focus point (defaults to value producing + full- window display). Distances "too close" to the object will produce excessive + magnifications. If ``DVAL`` = AUTO, zero, or blank, the program will calculate the distance + automatically. If ``DVAL`` = USER, the distance of last display will be used (useful when last + display automatically calculated distance). + + kfact : int or str + ``DVAL`` interpretation key: + + * ``0`` - Interpret numerical ``DVAL`` values as described above. + + * ``1`` - Interpret ``DVAL`` as a multiplier on the current distance ( ``DVAL`` of 2 gives twice the current + distance; 0.5 gives half the current distance, etc.). + + Notes + ----- + + .. _s-DIST_notes: + + The scale factor is relative to the window shape. For example, for objects centered in a square + window and with parallel projection (no perspective), a distance of :math:`` /2 (+10%) producesa + full window magnification, where nbsp :math:`` isthe largest in-plane vertical or horizontal + dimension. See also :ref:`auto` and :ref:`user` commands. + + This command is valid in any processor. + """ + command = f"/DIST,{wn},{dval},{kfact}" + return self.run(command, **kwargs) + + def zoom( + self, + wn: str = "", + lab: str = "", + x1: str = "", + y1: str = "", + x2: str = "", + y2: str = "", + **kwargs, + ): + r"""Zooms a region of a display window. + + Mechanical APDL Command: `/ZOOM `_ + + Parameters + ---------- + wn : str + Window number to which command applies (defaults to 1). + + lab : str + Label to define the desired type of zoom: + + * ``OFF`` - Turns zoom off (refits image of entire model to the window). + + * ``BACK`` - Goes back to previous zoom setting (five successive back ups, maximum). + + * ``SCRN`` - Interprets X1,Y1 as the screen coordinates of the center of a square zoom region; X2,Y2 as the + screen coordinates of a point on one side of that square. + + * ``RECT`` - Interprets X1,Y1 and X2,Y2 as the screen coordinates of two opposite corners of a rectangular zoom + region. + + x1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + y1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + x2 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + y2 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + Notes + ----- + + .. _s-ZOOM_notes: + + Zooms (centers and magnifies) the specified region of a display window. :ref:`zoom` will operate on + a display that has been formed by an explicit graphics action command ( :ref:`aplot`, :ref:`eplot`, + etc.). :ref:`zoom` has no effect on an "immediate" graphics display. When :ref:`zoom` is executed, + the display is automatically replotted such that the specified zoom region is centered and sized to + fill the window. + + Auto resizing is disabled when you issue the :ref:`zoom` command. To restore auto resizing, issue + the :ref:`auto` command, or select FIT from the `Pan, Zoom, Rotate + `_ + box. + + This command is valid in any processor. + """ + command = f"/ZOOM,{wn},{lab},{x1},{y1},{x2},{y2}" + return self.run(command, **kwargs) + + def focus( + self, + wn: str = "", + xf: str = "", + yf: str = "", + zf: str = "", + ktrans: int | str = "", + **kwargs, + ): + r"""Specifies the focus point (center of the window). + + Mechanical APDL Command: `/FOCUS `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + xf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + yf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + zf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + ktrans : int or str + Translate key: + + * ``0`` - Interpret numerical ``XF``, ``YF``, ``ZF`` values as described above. + + * ``1`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the current + position in the screen coordinate system. Example: ``XF`` of 2.4 translates the display + approximately 2.4 half-screens to the left in the screen X (horizontal) direction. + + * ``2`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the current + position in the global Cartesian coordinate system. Example: ``XF`` of 1.5 translates the display + approximately 1.5 half-screens in the global Cartesian X direction of the model. + + Notes + ----- + + .. _s-FOCUS_notes: + + Specifies the location on (or off) the model which is to be located at the focus point (center of + the window). For section and capped displays, the cutting plane is also assumed to pass through this + location (unless the working plane is used via :ref:`cplane` ). See also :ref:`auto` and :ref:`user` + commands. + + This command is valid in any processor. + """ + command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" + return self.run(command, **kwargs) + + def xfrm( + self, + lab: str = "", + x1: str = "", + y1: str = "", + z1: str = "", + x2: str = "", + y2: str = "", + z2: str = "", + **kwargs, + ): + r"""Controls the centroid or the axis of dynamic rotation. + + Mechanical APDL Command: `/XFRM `_ + + **Command default:** + + .. _s-XFRM_default: + + Issuing :ref:`xfrm`, with no ``LAB`` defined sets the center of rotation at the focal point + specified by the :ref:`focus` command. + + Parameters + ---------- + lab : str + The location or entity (centroid) used to define the center or axis of rotation. + + * ``NODE`` - If NODE is chosen for the center of rotation, the node number will be ``X1``. If the rotation is to + be about an axis, then ``X1`` and ``Y1`` define the two nodes between which a line is drawn to + determine the axis. The remaining arguments are ignored. + + * ``ELEMENT`` - If ELEMENT is chosen for the center of rotation, the element number will be ``X1``. If the rotation + is to be about an axis, then ``X1`` and ``Y1`` define the two elements between which a line is drawn + to determine the axis. The remaining arguments are ignored. + + * ``KP`` - If KP is chosen for the center of rotation, the keypoint number will be ``X1``. If the rotation is + to be about an axis, then ``X1`` and ``Y1`` define the two keypoints between which a line is drawn + to determine the axis. The remaining arguments are ignored. + + * ``LINE`` - If LINE is chosen for the center of rotation, the line number will be ``X1``. If the rotation is to + be about an axis, then ``X1`` and ``Y1`` define the two lines between which a line is drawn to + determine the axis. The remaining arguments are ignored. + + * ``AREA`` - If AREA is chosen for the center of rotation, the area number will be ``X1``. If the rotation is to + be about an axis, then ``X1`` and ``Y1`` define the two areas between which a line is drawn to + determine the axis. The remaining arguments are ignored. + + * ``VOLUME`` - If VOLUME is chosen for the center of rotation, the volume number will be ``X1``. If the rotation is + to be about an axis, then ``X1`` and ``Y1`` define the two volumes between which a line is drawn to + determine the axis. The remaining arguments are ignored. + + * ``XYZ`` - If XYZ is chosen for the center of rotation, the location of that center is determined by the + coordinates ``X1``, ``Y1``, ``Z1``. If values are specified for ``X2``, ``Y2``, ``Z2``, then the + axis of rotation will be about the line between those two points. + + * ``OFF`` - If ``LAB`` = OFF, DEFAULT, FOCUS or if no value is specified, then the center of rotation is set at + the FOCUS point, as defined by the :ref:`focus` command. + + x1 : str + The entity number or X coordinate for the center of rotation. + + y1 : str + The entity number or Y coordinate for the center of rotation. + + z1 : str + The Z coordinate for the center of rotation. + + x2 : str + The X coordinate for the axis of rotation. + + y2 : str + The Y coordinate for the axis of rotation. + + z2 : str + The Z coordinate for the axis of rotation. + + Notes + ----- + + .. _s-XFRM_notes: + + The :ref:`xfrm` command is active only when the cumulative rotation key is specified ON for the + :ref:`angle` command ( ``KINCR`` = 1). This command affects dynamic manipulations only. + + For center rotation, the middle mouse button will rotate the model about the screen Z axis and the + right mouse button will rotate the model about the screen X and Y axis. + + For rotation about an axis, the middle mouse button will rotate the model about the defined axis of + rotation and the right mouse button will be deactivated. + + This command is valid in any processor. + """ + command = f"/XFRM,{lab},{x1},{y1},{z1},{x2},{y2},{z2}" + return self.run(command, **kwargs) + + def view(self, wn: str = "", xv: str = "", yv: str = "", zv: str = "", **kwargs): + r"""Defines the viewing direction for the display. + + Mechanical APDL Command: `/VIEW `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + xv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). + + yv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). + + zv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). + + Notes + ----- + + .. _s-VIEW_notes: + + The view line is always normal to the screen. The view is selected by defining a point (in the + global Cartesian coordinate system) representing a point along the viewing line. This point, and the + global Cartesian coordinate system origin, define the line along which the object is viewed while + looking toward the origin. Any point along the view line may be used, that is, (1,1,1) and (2,2,2) + give the same view. The display orientation may be changed as desired ( :ref:`angle` ). The display + coordinate system type may be changed (from Cartesian to cylindrical, spherical, toroidal, etc.) + with the :ref:`dsys` command. + + This command is valid in any processor. + """ + command = f"/VIEW,{wn},{xv},{yv},{zv}" + return self.run(command, **kwargs) + + def vcone(self, wn: str = "", phi: str = "", **kwargs): + r"""Defines the view cone angle for perspective displays. + + Mechanical APDL Command: `/VCONE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + phi : str + View cone angle (0.0 to 85.°) to define perspective. Use ``PHI`` = 45.0° for typical + perspective. Increase angle for more perspective, decrease angle for less. If the distance ( + :ref:`dist` ) is not specified, it will be automatically calculated to give full window + magnification. If the distance is also specified, ``PHI`` controls both the perspective and the + magnification. The larger the angle, the more the perspective and the less the magnification. + Defaults to 0.0 (no perspective). + + Notes + ----- + + .. _s-VCONE_notes: + + Perspective shows the true depth of the object in the display. A variable magnification results + since the back plane of the object is further from the observer than the front plane. The largest + magnification occurs at the front plane. With perspective, the magnification factor (MAGF) is not + only a function of the distance from the object, but also the window shape and the perspective (or + view cone) angle Φ as follows: + + M A G F = ℓ / 2 ( d ) T A N ϕ + where :math:``, for square windows, is thelargest in-plane vertical or horizontal dimension, d is + the distance fromthe observer to the plane ofnbsp :math:`` (usuallythe front plane of the + object), andnbsp:math:`\Phi` is the view cone angle (definedwith the :ref:`vcone` command). The + bigger + the cone angle, the more the perspective. The magnification factor proportionally decreases with + increasing Φ. The distance can be defined with the :ref:`dist` or the :ref:`focus` command. Note, + the distance input on the :ref:`dist` command is equal to d only if the focus point is located on + the plane of :math:``. It is recommended that if a general perspective is desired(that is, not any + specific cone angle), use :math:`\Phi` = 45.0 (since TAN(45.0) = 1.0)and let the d value be + automatically + calculated for full window magnification. + + Note that any number of :ref:`dist`, :ref:`focus`, and :ref:`vcone` combinations can be used to + produce the same magnification. Distances less than the object depth will produce views from within + the object. + + A magnification factor of 1.0 just fills the window. If the automatic scaling option is used ( + :ref:`auto` ), the magnification factor is fixed at 0.91 (to allow a 10% margin around the object) + and d is automatically calculated for the given :ref:`vcone` and :ref:`focus` values. Any value of Φ + between 0.0 and 85.0 (usually 45.0) may be used to activate the perspective. Views from inside the + object are not possible when d is automatically calculated (use manual scaling ( :ref:`user` ) along + with :ref:`dist` specification). + + This command is valid in any processor. + """ + command = f"/VCONE,{wn},{phi}" + return self.run(command, **kwargs) + + def vup(self, wn: str = "", label: str = "", **kwargs): + r"""Specifies the global Cartesian coordinate system reference orientation. + + Mechanical APDL Command: `/VUP `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + label : str + Orientation: + + * ``Y`` - Y vertical upward, X horizontal to the right, Z out from the screen (default). + + * ``-Y`` - Y vertical downward, X horizontal to the left, Z out from the screen. + + * ``X`` - X vertical upward, Y horizontal to the left, Z out from the screen. + + * ``-X`` - X vertical downward, Y horizontal to the right, Z out from the screen. + + * ``Z`` - Z vertical upward, Y horizontal to the right, X out from the screen. With this choice, you should + use a view other than the :ref:`view` default of (0,0,1). + + * ``-Z`` - Z vertical downward, Y horizontal to the left, X out from the screen. With this choice, you should + use a view other than the :ref:`view` default of (0,0,1). + + Notes + ----- + + .. _s-VUP_notes: + + Specifies the global Cartesian coordinate system reference orientation. The :ref:`view` and + :ref:`angle` commands may be used to reorient the view and are relative to this reference + orientation. All coordinate systems are right-handed. + + This command is valid in any processor. + """ + command = f"/VUP,{wn},{label}" + return self.run(command, **kwargs) + + def auto(self, wn: str = "", **kwargs): + r"""Resets the focus and distance specifications to "automatically calculated." + + Mechanical APDL Command: `/AUTO `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + Notes + ----- + + .. _s-AUTO_notes: + + Focus point and distance will be automatically calculated during next display. Settings may still be + changed with the :ref:`focus` and :ref:`dist` commands after this command has been issued. See also + the :ref:`user` command. + + This command is valid in any processor. + """ + command = f"/AUTO,{wn}" + return self.run(command, **kwargs) + + def angle( + self, + wn: str = "", + theta: str = "", + axis: str = "", + kincr: int | str = "", + **kwargs, + ): + r"""Rotates the display about an axis. + + Mechanical APDL Command: `/ANGLE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + theta : str + Angle (degrees) for changing display orientation (positive, counterclockwise about specified + axis). + + axis : str + Rotation axis: XS, YS, or ZS (default) for the screen axes; XM, YM, or ZM for the global + Cartesian model axes. ZS is normal to the screen; all axes pass through the focus point. + + kincr : int or str + Cumulative rotation key: + + * ``0`` - Do not use cumulative successive rotations. + + * ``1`` - Use cumulative rotations. Rotations are relative to the previous rotation. View settings ( + :ref:`view` ) are recalculated. + + Notes + ----- + + .. _s-ANGLE_notes: + + Default orientation is YS vertical. When the :ref:`xfrm` command is set for rotation about two + points, or for entities, the :ref:`angle` command is functional only for ``Axis`` = ZS or ZM and + ``KINCR`` = 1. + + This command is valid in any processor. + """ + command = f"/ANGLE,{wn},{theta},{axis},{kincr}" + return self.run(command, **kwargs) + + def user(self, wn: str = "", **kwargs): + r"""Conveniently resets :ref:`focus` and :ref:`dist` to USER. + + Mechanical APDL Command: `/USER `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + Notes + ----- + + .. _s-USER_notes: + + Conveniently resets scale parameters to USER on the :ref:`focus` and :ref:`dist` commands. Scale + parameters will be internally respecified to those used for the last display. Convenient when the + last scale parameters were automatically calculated. User specified parameters hold until changed or + removed ( :ref:`auto` ). Parameters may be reset on the individual commands after this command has + been issued. + + This command is valid in any processor. + """ + command = f"/USER,{wn}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/annotation.py b/src/ansys/mapdl/core/_commands/graphics_/annotation.py deleted file mode 100644 index 830a5a9b952..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/annotation.py +++ /dev/null @@ -1,871 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Annotation: - def an3d(self, kywrd="", key="", **kwargs): - """Specifies 3-D annotation functions - - APDL Command: /AN3D - - Parameters - ---------- - num - Unique number assigned as each annotation is applied to a model. - These numbers are applied sequentially, although when an annotation - entity is deleted, its number is reassigned. - - type - Annotation internal type number (101 = text, 102 = line, 103 = - point, 104 = area, 105 = arrow, 106 = symbol, 108 = bitmap). - - xhot, yhot, zhot - X, Y, Z coordinates for hot spot location. - - Notes - ----- - Because 3-D annotation is applied in relation to the XYZ coordinates of - the anchor, you can transform your model, and the annotation will - maintain the spatial relationship with the model. This works within - reason, and there are instances where changing the perspective or the - size of the model will change the apparent relationship between the - annotation and the model. - - The overall 3-D dimensions of your model are defined by a bounding - box. If portions of your model's bounding box lie outside of the - visible area of your graphics window (if you are zoomed in on a - specific area of your model), it can affect the placement of your 3-D - annotations. Zooming out will usually overcome this problem. - - 3-D annotation is valid for the Cartesian (CSYS,0) coordinate system - only. If you want to annotate a model you created in another coordinate - system, use 2-D annotation (note that 2-D annotations do not remain - anchored for dynamic rotations or transformations). - - When you apply user defined bitmaps, the size of the annotation can - vary. Use the options menu of the 3-D annotation widget to adjust the - size and placement of your bitmaps. - - You cannot use the "!" and "$" characters in ANSYS text annotation. - - The GUI generates this command during 3-D annotation operations and - inserts the command into the log file (Jobname.LOG). You should NOT - type this command directly during an ANSYS session (although the - command can be included in an input file for batch input or for use - with the /INPUT command). - """ - command = f"/AN3D,{kywrd},{key}" - return self.run(command, **kwargs) - - def annot(self, lab="", val1="", val2="", **kwargs): - """Activates graphics for annotating displays (GUI). - - APDL Command: /ANNOT - - Parameters - ---------- - lab - Annotation control key: - - OFF - Turns off annotation for each subsequent display (default). - - ON - Turns on annotation for each subsequent display. - - DELE - Deletes all annotation. - - SAVE - Saves annotation on a file. Use VAL1 for file name (defaults to Jobname) and - VAL2 for the extension (defaults to ANO). - - SCALE - Sets annotation scale factor (direct input only). Use VAL1 for value (0.1 to - 10.0) (defaults to 1.0). - - XORIG - Sets the annotation x origin (direct input only). Use VAL1 for value (-3.0 to - 3.0). - - YORIG - Sets annotation y origin (direct input only). Use VAL1 for value (-3.0 to - 3.0). - - SNAP - Sets annotation snap (menu button input only). Use VAL1 for value (0.002 to - 0.2) (defaults to 0.002). - - STAT - Displays current annotation status. - - DEFA - Sets annotation specifications to the default values. - - REFR - Redisplays annotation graphics. - - TMOD - Sets the annotation text mode. If VAL1 = 1, annotation text will be drawn in - scalable bitmap fonts (default). If VAL1 = 0, annotation - text will be drawn with stroke text. - - val1 - Value (or file name) as noted with label above. - - val2 - Value (or file name extension) as noted with label above. - - Notes - ----- - This is a command generated by the GUI and will appear in the log file - (Jobname.LOG) if annotation is used. This command is not intended to - be typed in directly in an ANSYS session (although it can be included - in an input file for batch input or for use with the /INPUT command). - - You cannot use the "!" and "$" characters in ANSYS text annotation. - - /ANNOT activates annotation graphics for adding annotation to displays. - Commands representing the annotation instructions are automatically - created by the annotation functions in the GUI and written to - Jobname.LOG. The annotation commands are /ANNOT, /ANUM, /TLABEL, - /LINE, /LARC, /LSYMBOL, /POLYGON, /PMORE, /PCIRCLE, /PWEDGE, /TSPEC, - /LSPEC, and /PSPEC. Annotation graphics are relative to the full - Graphics Window and are not affected by ANSYS window-specific commands - (/WINDOW, /VIEW, etc.). - - This command is valid in any processor. - """ - command = f"/ANNOT,{lab},{val1},{val2}" - return self.run(command, **kwargs) - - def anum(self, num="", type_="", xhot="", yhot="", **kwargs): - """Specifies the annotation number, type, and hot spot (GUI). - - APDL Command: /ANUM - - Parameters - ---------- - num - Annotation number. ANSYS automatically assigns the lowest - available number. You cannot assign a higher number if a lower - number is available; ANSYS will substitute the lowest available - number in place of any user-specified higher number. - - type\\_ - Annotation internal type number. If TYPE = DELE, delete annotation - NUM. - - 1 - Text - - 2 - Block text (not available in GUI) - - 3 - Dimensions - - 4 - Lines - - 5 - Rectangles - - 6 - Circles - - 7 - Polygons - - 8 - Arcs - - 9 - Wedges, pies - - 11 - Symbols - - 12 - Arrows - - 13 - Bitmap - - xhot - X hot spot (-1.0 < X < 2.0). Used for menu button item delete. - - yhot - Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. - - Notes - ----- - This is a command generated by the GUI and will appear in the log file - (Jobname.LOG) if annotation is used. This command is not intended to - be typed in directly in an ANSYS session (although it can be included - in an input file for batch input or for use with the /INPUT command). - - Type 13 (bitmap) annotation applies user defined bitmaps defined using - the FILE option of the /TXTRE command. - - This command is valid in any processor. - """ - command = f"/ANUM,{num},{type_},{xhot},{yhot}" - return self.run(command, **kwargs) - - def slashlarc(self, xcentr="", ycentr="", xlrad="", angle1="", angle2="", **kwargs): - """Creates annotation arcs (GUI). - - APDL Command: /LARC - - Parameters - ---------- - xcentr - Arc X center location (-1.0 < X < 1.0). - - ycentr - Arc Y center location (-1.0 < Y < 1.0). - - xlrad - Arc radius length. - - angle1 - Starting angle of arc. - - angle2 - Ending angle of arc. The arc is drawn counterclockwise from the - starting angle, `angle1`, to the ending angle, `angle2`. - - Notes - ----- - This command defines annotation arcs to be written directly onto the - display at a specified location. The command is generated by the Graphical - User Interface (GUI) and will appear in the log file (`Jobname.LOG`) if - annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file - for batch input or for use with the `/INPUT` command). - All arcs are shown on subsequent displays unless the annotation is - turned off or deleted. Issueu `/LSPEC` to set the attributes - of the arc. - - This command is valid in any processor. - """ - command = f"/LARC, {xcentr}, {ycentr}, {xlrad}, {angle1}, {angle2}" - return self.run(command, **kwargs) - - def slashline(self, x1="", y1="", x2="", y2="", **kwargs): - """Creates annotation lines (GUI). - - APDL Command: /LINE - - Parameters - ---------- - X1 - Line X starting location (-1.0 < X < 2.0). - Y1 - Line Y starting location (-1.0 < Y < 1.0). - X2 - Line X ending location (-1.0 < X < 2.0). - Y2 - Line Y ending location (-1.0 < Y < 1.0). - - Notes - ----- - This command defines annotation lines to be written directly onto the - display at a specified location. The command is generated by the Graphical - User Interface (GUI) and appears in the log file (`Job-name.LOG`) if - annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file - for batch input or for use with the `/INPUT` command). All lines are - shown on subsequent displays unless the annotation is turned off or - deleted. Issue `/LSPEC` to set the attributes of the line. - - This command is valid in any processor. - """ - command = f"/LINE, {x1}, {y1}, {x2}, {y2}" - return self.run(command, **kwargs) - - def lspec(self, lcolor="", linstl="", xlnwid="", **kwargs): - """Specifies annotation line attributes (GUI). - - APDL Command: /LSPEC - - Parameters - ---------- - lcolor - Line color: - - 0 - Black - - 1 - Red-Magenta - - 2 - Magenta - - 3 - Blue-Magenta - - 4 - Blue - - 5 - Cyan-Blue - - 6 - Cyan - - 7 - Green-Cyan - - 8 - Green - - 9 - Yellow-Green - - 10 - Yellow - - 11 - Orange - - 12 - Red - - 13 - Dark Gray - - 14 - Light Gray - - 15 - White - - linstl - Line style: - - 0 - Solid line. - - 1 - Dashed line. - - xlnwid - Line width multiplier (1.0 to 20.0). Defaults to 1.0. - - Notes - ----- - Specifies annotation line attributes to control certain characteristics - of the lines created via the /LINE, /LARC, /LSYMBOL, /POLYGON, /PMORE, - /PCIRCLE, and /PWEDGE commands. This is a command generated by the - Graphical User Interface (GUI) and will appear in the log file - (Jobname.LOG) if annotation is used. This command is not intended to - be typed in directly in an ANSYS session (although it can be included - in an input file for batch input or for use with the /INPUT command). - - This command is valid in any processor. - """ - command = f"/LSPEC,{lcolor},{linstl},{xlnwid}" - return self.run(command, **kwargs) - - def lsymbol(self, x="", y="", symang="", symtyp="", symsiz="", keybmp="", **kwargs): - """Creates annotation symbols (GUI). - - APDL Command: /LSYMBOL - - Parameters - ---------- - x - X location for symbol (-1.0 < X < 2.0). - - y - Y location for symbol (-1.0 < Y < 1.0). - - symang - Symbol orientation angle. - - symtyp - Symbol type: - - 1 - Arrow. - - 2 - Tee. - - 3 - Circle. - - 4 - Triangle. - - 5 - Star. - - symsiz - Symbol size multiplier (0.1 to 20.0). Defaults to 1.0. - - keybmp - If KEYBMP = 1, the annotation is a bitmap. SYMTYP will then be a - number from 1-99, indicating the bitmap type (see notes), and X and - Y will define the lower left corner of the bitmap. The SYMANG, - SYMSIZarguments are ignored. If KEYBMP = 0, or blank, then the - argument definitions above apply. - - Notes - ----- - Defines annotation symbols to be written directly onto the display at a - specified location. This is a command generated by the GUI and will - appear in the log file (Jobname.LOG) if annotation is used. This - command is not intended to be typed in directly in an ANSYS session - (although it can be included in an input file for batch input or for - use with the /INPUT command). - - All symbols are shown on subsequent displays unless the annotation is - turned off or deleted. Use the /LSPEC command to set the attributes of - the symbol. - - The KEYBMP argument reads the symtype argument to determine which - bitmap to insert. This bitmap is defined by an integer between 1 and - 99. Numbers 1 through 40 correspond to the standard texture values - found in the /TXTRE command, while numbers 51 through 99 correspond to - user supplied bitmaps, as defined using the Filename option of the - /TXTRE command. Numbers 51 through 57 are predefined (the logos, clamps - and arrows available from the GUI) but can be overridden. Numbers 41 - through 50 are reserved. - - This command is valid in any processor. - """ - command = f"/LSYMBOL,{x},{y},{symang},{symtyp},{symsiz},{keybmp}" - return self.run(command, **kwargs) - - def slash_pcircle(self, xcentr="", ycentr="", xlrad="", **kwargs): - """Creates an annotation circle (GUI). - - APDL Command: /PCIRCLE - - Parameters - ---------- - xcentr - Circle X center location (-1.0 < X < 2.0). - - ycentr - Circle Y center location (-1.0 < Y < 1.0). - - xlrad - Circle radius length. - - Notes - ----- - Creates an annotation circle to be written directly onto the display at - a specified location. This is a command generated by the Graphical - User Interface (GUI) and will appear in the log file (Jobname.LOG) if - annotation is used. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - - All circles are shown on subsequent displays unless the annotation is - turned off or deleted. Use the /LSPEC and the /PSPEC command to set - the attributes of the circle. - - This command is valid in any processor. - """ - command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" - return self.run(command, **kwargs) - - def pmore(self, x5="", y5="", x6="", y6="", x7="", y7="", x8="", y8="", **kwargs): - """Creates an annotation polygon (GUI). - - APDL Command: /PMORE - - Parameters - ---------- - x5 - X location for vertex 5 of polygon (-1.0 < X < 2.0). - - y5 - Y location for vertex 5 of polygon (-1.0 < Y < 1.0). - - x6 - X location for vertex 6 of polygon (-1.0 < X < 2.0). - - y6 - Y location for vertex 6 of polygon (-1.0 < Y < 1.0). - - x7 - X location for vertex 7 of polygon (-1.0 < X < 2.0). - - y7 - Y location for vertex 7 of polygon (-1.0 < Y < 1.0). - - x8 - X location for vertex 8 of polygon (-1.0 < X < 2.0). - - y8 - Y location for vertex 8 of polygon (-1.0 < Y < 1.0). - - Notes - ----- - Defines the 5th through 8th vertices of an annotation polygon - [/POLYGON]. This is a command generated by the Graphical User - Interface (GUI) and will appear in the log file (Jobname.LOG) if - annotation is used. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - - This command is valid in any processor. - """ - command = f"/PMORE,,{x5},{y5},{x6},{y6},{x7},{y7},{x8},{y8}" - return self.run(command, **kwargs) - - def polygon( - self, - nvert="", - x1="", - y1="", - x2="", - y2="", - x3="", - y3="", - x4="", - y4="", - **kwargs, - ): - """Creates annotation polygons (GUI). - - APDL Command: /POLYGON - - Parameters - ---------- - nvert - Number of vertices of polygon (3 NVERT 8). Use /PMORE for - polygons with more than 4 vertices. - - x1 - X location for vertex 1 of polygon (-1.0 < X < 2.0). - - y1 - Y location for vertex 1 of polygon (-1.0 < Y < 1.0). - - x2 - X location for vertex 2 of polygon (-1.0 < X < 2.0). - - y2 - Y location for vertex 2 of polygon (-1.0 < Y < 1.0). - - x3 - X location for vertex 3 of polygon (-1.0 < X < 2.0). - - y3 - Y location for vertex 3 of polygon (-1.0 < Y < 1.0). - - x4 - X location for vertex 4 of polygon (-1.0 < X < 2.0). - - y4 - Y location for vertex 4 of polygon (-1.0 < Y < 1.0). - - Notes - ----- - Creates annotation polygons to be written directly onto the display at - a specified location. This is a command generated by the Graphical - User Interface (GUI) and will appear in the log file (Jobname.LOG) if - annotation is used. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - - All polygons are shown on subsequent displays unless the annotation is - turned off or deleted. Use the /LSPEC and the /PSPEC command to set - the attributes of the polygon. Use the /PMORE command to define the - 5th through 8th vertices of the polygon. - - This command is valid in any processor. - """ - command = f"/POLYGON,{nvert},{x1},{y1},{x2},{y2},{x3},{y3},{x4},{y4}" - return self.run(command, **kwargs) - - def pspec(self, pcolor="", kfill="", kbordr="", **kwargs): - """Creates annotation polygon attributes (GUI). - - APDL Command: /PSPEC - - Parameters - ---------- - pcolor - Polygon color (0 PCOLOR 15): - - 0 - Black. - - 1 - Red-Magenta. - - 2 - Magenta. - - 3 - Blue-Magenta. - - 4 - Blue. - - 5 - Cyan-Blue. - - 6 - Cyan. - - 7 - Green-Cyan. - - 8 - Green. - - 9 - Yellow-Green. - - 10 - Yellow. - - 11 - Orange. - - 12 - Red. - - 13 - Dark Gray. - - 14 - Light Gray. - - 15 - White. - - kfill - Polygon fill key: - - 0 - Hollow polygon. - - 1 - Filled polygon. - - kbordr - Polygon border key: - - 0 - No border. - - 1 - Border. - - Notes - ----- - Creates annotation polygon attributes to control certain - characteristics of the polygons created via the /POLYGON, /PMORE, - /PCIRCLE and /PWEDGE commands. This is a command generated by the - Graphical User Interface (GUI) and will appear in the log file - (Jobname.LOG) if annotation is used. This command is not intended to - be typed in directly in an ANSYS session (although it can be included - in an input file for batch input or for use with the /INPUT command). - - This command is valid in any processor. - """ - command = f"/PSPEC,{pcolor},{kfill},{kbordr}" - return self.run(command, **kwargs) - - def pwedge(self, xcentr="", ycentr="", xlrad="", angle1="", angle2="", **kwargs): - """Creates an annotation wedge (GUI). - - APDL Command: /PWEDGE - - Parameters - ---------- - xcentr - Wedge X center location (-1.0 < X < 2.0). - - ycentr - Wedge Y center location (-1.0 < Y < 1.0). - - xlrad - Wedge radius length. - - angle1 - Starting angle of wedge. - - angle2 - Ending angle of wedge. The wedge is drawn counterclockwise from - the starting angle, ANGLE1, to the ending angle, ANGLE2. - - Notes - ----- - Creates an annotation wedge to be written directly onto the display at - a specified location. This is a command generated by the Graphical - User Interface (GUI) and will appear in the log file (Jobname.LOG) if - annotation is used. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - - All wedges are shown on subsequent displays unless the annotation is - turned off or deleted. Use the /LSPEC and the /PSPEC command to set - the attributes of the wedge. - - This command is valid in any processor. - """ - command = f"/PWEDGE,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" - return self.run(command, **kwargs) - - def tlabel(self, xloc="", yloc="", text="", **kwargs): - """Creates annotation text (GUI). - - APDL Command: /TLABEL - - Parameters - ---------- - xloc - Text X starting location (-1.0 < X < 1.6). - - yloc - Text Y starting location (-1.0 < Y < 1.0). - - text - Text string (60 characters maximum). Parameter substitution may be - forced within the text by enclosing the parameter name or - parametric expression within percent (%) signs. - - Notes - ----- - Defines annotation text to be written directly onto the display at a - specified location. This is a command generated by the Graphical User - Interface (GUI) and will appear in the log file (Jobname.LOG) if - annotation is used. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - - All text is shown on subsequent displays unless the annotation is - turned off or deleted. Use the /TSPEC command to set the attributes of - the text. - - This command is valid in any processor. - """ - command = f"/TLABEL,{xloc},{yloc},{text}" - return self.run(command, **kwargs) - - def tspec(self, tcolor="", tsize="", txthic="", pangle="", iangle="", **kwargs): - """Creates annotation text attributes (GUI). - - APDL Command: /TSPEC - - Parameters - ---------- - tcolor - Text color (0 TCOLOR 15): - - 0 - Black. - - 1 - Red-Magenta. - - 2 - Magenta. - - 3 - Blue-Magenta. - - 4 - Blue. - - 5 - Cyan-Blue. - - 6 - Cyan. - - 7 - Green-Cyan. - - 8 - Green. - - 9 - Yellow-Green. - - 10 - Yellow. - - 11 - Orange. - - 12 - Red. - - 13 - Dark Gray. - - 14 - Light Gray. - - 15 - White. - - tsize - Text size factor. - - txthic - Text thickness key: - - 1 - normal. - - 2 - twice as thick. - - 3 - three times as thick. - - 4 - four times as thick. - - pangle - Text path angle (0.0 < angle < 360.0). - - iangle - Text italic angle (0.0 < angle < 45.0). - - Notes - ----- - Defines annotation text attributes to control certain characteristics - of the text created via the /TLABEL command. This is a command - generated by the Graphical User Interface (GUI) and will appear in the - log file (Jobname.LOG) if annotation is used. This command is not - intended to be typed in directly in an ANSYS session (although it can - be included in an input file for batch input or for use with the /INPUT - command). - - This command is valid in any processor. - """ - command = f"/TSPEC,{tcolor},{tsize},{txthic},{pangle},{iangle}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/graphs.py b/src/ansys/mapdl/core/_commands/graphics_/graphs.py deleted file mode 100644 index d8bdc591741..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/graphs.py +++ /dev/null @@ -1,374 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Graphs: - def axlab(self, axis="", lab="", **kwargs): - """Labels the X and Y axes on graph displays. - - APDL Command: /AXLAB - - Parameters - ---------- - axis - Axis specifier: - - X - Apply label to X axis. - - Y - Apply label to Y axis. - - lab - Axis label (user defined text up to 30 characters long). Leave - blank to reestablish the default for Axis axis. - - Notes - ----- - This command is valid in any processor. - """ - command = f"/AXLAB,{axis},{lab}" - return self.run(command, **kwargs) - - def grid(self, key="", **kwargs): - """Selects the type of grid on graph displays. - - APDL Command: /GRID - - Parameters - ---------- - key - Grid key: - - 0 (OFF) - No grid. - - 1 (ON) - Full grid (X and Y grid lines). - - 2 (X) - Partial grid (X grid lines only). - - 3 (Y) - Partial grid (Y grid lines only) - - Notes - ----- - Selects the type of grid on graph displays. Graphs with multiple - Y-axes can have multiple grids [/GRTYP]. The grid of the first curve - is also used as the background grid (above and behind the curve). - Grids for other curves are limited to be under the curves. See also - /GTHK and /GROPT for other grid options. - - This command is valid in any processor. - """ - command = f"/GRID,{key}" - return self.run(command, **kwargs) - - def gropt(self, lab="", key="", **kwargs): - """Sets various line graph display options. - - APDL Command: /GROPT - - Parameters - ---------- - lab - Apply display style as selected from the following labels: - - AXDV - Axis division (tick) marks (defaults to KEY = ON). - - AXNM - Axis scale numbers (defaults to KEY = ON, which puts numbers at the back plane - of the graph). If KEY = FRONT, numbers are on the front - plane of the graph. - - AXNSC - Axis number size scale factor. Input the scale value for KEY (defaults to - 1.0). - - ASCAL - Automatic scaling of additional Y-axes for multi-curve [/GRTYP, 2 or 3] graphs - (defaults to KEY = ON). If KEY = OFF, use base Y-axis - scaling (see the /YRANGE command). - - LOGX - Log X scale (defaults to KEY = OFF (linear)). - - LOGY - Log Y scale (applies only to the base Y axis) (defaults to KEY = OFF (linear)). - - FILL - Color fill areas under curves (defaults to KEY = OFF). - - CGRID - Superimpose background grid [/GRID] over areas under filled curves (defaults to - KEY = OFF). - - DIG1 - Number of significant digits before decimal point for axis values. Input the - value for KEY (defaults to 4). - - DIG2 - Number of significant digits after decimal point for axis values. Input the - value for KEY (defaults to 3). - - VIEW - View key for graph displays (defaults to KEY = OFF, in which case the view is - (0,0,1) for 2-D graph displays or (1,2,3) for 3-D graph - displays). If KEY = ON, the view settings for graph - displays are the same as the view settings for the model. - - REVX - Plots the values on the X-axis in reverse order. - - REVY - Plots the values on the Y-axis in reverse order. - - DIVX - Determines the number of divisions (grid markers) that will be plotted on the X - axis. - - DIVY - Determines the number of divisions (grid markers) that will be plotted on the Y - axis. - - LTYP - Determines whether ANSYS generated (KEY = 1) or system derived (KEY = 0) fonts - will be used for the axis labels. - - CURL - Determines the position of the curve labels. If (KEY = 1), the curve label will - be plotted in the legend column, and the label will be - displayed in the same color as the curve. If (KEY = 0) the - curve labels will be plotted near the curve. (default). - - XAXO - When you use this label, the subsequent KEY value will determine an offset - amount from the default (along the bottom) location for the - X axis. If KEY = 1.0, a full offset occurs (the X axis is - moved to the top of the graph). If KEY = 0.5, the axis is - offset to the midpoint of the graph, and if KEY = 0 the axis - remains in the original position, along the bottom of the - graph. For any offset, a grey copy of the original axis - (containing the axis numbering) remains at the original - location. - - YAXO - When you use this label, the subsequent KEY value will determine an offset - amount from the default (along the left side of the graph) - location for the Y axis. If KEY = 1.0, a full offset occurs - (the Y axis is moved to the right side of the graph). If KEY - = 0.5, the axis is offset to the midpoint of the graph, and - if KEY = 0 the axis remains in the original position, along - the left side of the graph. For any offset, a gray copy of - the original axis (containing the axis numbering) remains at - the original location. - - key - Option values: - - OFF (0) - Do not apply selected style. - - ON (1) - Apply selected style. - - nnnn - If Lab is DIG1 or DIG2, input the number of digits. - - nn - If Lab is AXNSC, input the scale factor. - - FRONT - If Lab is AXNM, FRONT may also be input. - - Ndiv - If Lab is DIVX or DIVY, determines the number of divisions (1-99) that will be - applied to the axis. - - Kfont - If Lab is LTYP, Kfont is ON (1) or OFF(0). ON will use ANSYS generated fonts - for the axis labels, while OFF will use SYSTEM (Windows, - X-system, etc.) fonts. The default value is ON (ANSYS - fonts). - - Notes - ----- - Sets various line graph display options. Issue /GROPT,STAT to display - the current settings. Issue /GROPT,DEFA to reset the default - specifications. ANSYS informs you that graph view manipulation is - inactive unless you have issued the /GROPT,VIEW,ON command. See the - /AXLAB, /GRTYP, /GRID, and /GTHK commands for other graph control - options. - - Automatic scaling using the /XRANGE and /YRANGE commands will often - yield inappropriate range values for logarithmic scales (/GROPT, LOGX - or /GROPT, LOGY). - - This command is valid in any processor. - """ - command = f"/GROPT,{lab},{key}" - return self.run(command, **kwargs) - - def grtyp(self, kaxis="", **kwargs): - """Selects single or multiple Y-axes graph displays. - - APDL Command: /GRTYP - - Parameters - ---------- - kaxis - Axis selection key: - - 0 or 1 - Single Y-axis. Up to 10 curves scaled to a single Y-axis. - - 2 - Additional Y-axes (one for each curve) (3 curves maximum). Allows better - scaling of curves with widely differing numbering ranges. - - 3 - Same as 2 but with additional Y-axis and curves projected out of the plane (6 - curves maximum). Allows clearer display with an isometric - view. The default view when KAXIS = 3 is View,1,1,2,3. - - Notes - ----- - The basic line graph has one or more curves plotted against the same Y - and X axes. Multiple curve graphs can also be plotted with individual - Y axes and the same X axis. The Y axis of the first curve is referred - to as the base Y-axis and the Y axes of the other curves as additional - Y axes. Curves are numbered sequentially from 1 (the base curve) in - the order in which they are displayed. See the /AXLAB, /GROPT, /GRID, - and /GTHK commands for other display options. - - This command is valid in any processor. - """ - command = f"/GRTYP,{kaxis}" - return self.run(command, **kwargs) - - def gthk(self, label="", thick="", **kwargs): - """Sets line thicknesses for graph lines. - - APDL Command: /GTHK - - Parameters - ---------- - label - Apply thicknesses as selected from the following labels: - - AXIS - Modify thickness of ordinate and abscissa axes on graph displays. - - GRID - Modify thickness of grid lines on graph displays. - - CURVE - Modify thickness of curve lines (when no area fill [/GROPT]). - - thick - Thickness ratio (whole numbers only, from -1 to 10): - - -1 - Do not draw the curve, but show only the markers specified by /GMARKER. - - 0 or 1 - Thin lines. - - 2 - The default thickness. - - 3 - 1.5 times the default thickness. - - etc. - (up to 10) - - Notes - ----- - Sets line thicknesses for graph lines (in raster mode only). Use - /GTHK,STAT to show settings. - - This command is valid in any processor. - """ - command = f"/GTHK,{label},{thick}" - return self.run(command, **kwargs) - - def xrange(self, xmin="", xmax="", **kwargs): - """Specifies a linear abscissa (X) scale range. - - APDL Command: /XRANGE - - Parameters - ---------- - xmin - Minimum abscissa scale value. - - xmax - Maximum abscissa scale value. - - Notes - ----- - Specifies a linear abscissa (X) scale range for the line graph display. - Use /XRANGE,DEFAULT to return to automatic scaling. - - Automatic scaling will often yield inappropriate range values for - logarithmic scales (/GROPT, LOGX). - - This command is valid in any processor. - """ - command = f"/XRANGE,{xmin},{xmax}" - return self.run(command, **kwargs) - - def yrange(self, ymin="", ymax="", num="", **kwargs): - """Specifies a linear ordinate (Y) scale range. - - APDL Command: /YRANGE - - Parameters - ---------- - ymin - Minimum ordinate scale value. - - ymax - Maximum ordinate scale value. - - num - Y-axis number to which range applies (defaults to 1). Valid - numbers are 1 to 3 for /GRTYP,2 and 1 to 6 for /GRTYP,3. If ALL, - apply to all Y-axes. - - Notes - ----- - Specifies a linear ordinate (Y) scale range for the line graph display. - Use /YRANGE,DEFAULT to return to automatic scaling. For multiple - Y-axes graphs [/GRTYP], see /GROPT, ASCAL to automatically scale the - additional Y-axes. - - Automatic scaling will often yield inappropriate range values for - logarithmic scales (/GROPT, LOGY). - - This command is valid in any processor. - """ - command = f"/YRANGE,{ymin},{ymax},{num}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/labeling.py b/src/ansys/mapdl/core/_commands/graphics_/labeling.py deleted file mode 100644 index 5d773cf5243..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/labeling.py +++ /dev/null @@ -1,1224 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Labelling: - def cformat(self, nfirst="", nlast="", **kwargs): - """Controls the graphical display of alphanumeric character strings for - - APDL Command: /CFORMAT - parameters, components, assemblies, and tables. - - Parameters - ---------- - nfirst - Display the first n characters of the parameter, component, - assembly, or table name, up to 32. Defaults to 32. - - nlast - Display the last n characters of the parameter, component, - assembly, or table name, up to 32. Defaults to 0. - - Notes - ----- - Use this command to control the length of the character string that is - shown in the graphics window for a parameter, component, assembly, or - table name. - - The total number of characters (NFIRST + NLAST +3) cannot exceed 32. - - If NFIRST is greater than zero and NLAST = 0, only the NFIRST - characters are displayed, followed by an ellipsis. - - If NFIRST = 0 and NLAST is greater than zero, only the NLAST characters - are displayed, preceded by an ellipsis (...). - - If both NFIRST and NLAST are greater than zero, the name will be shown - as NFIRST, followed by an ellipsis (...), followed by NLAST, up to a - maximum of 32 characters. - - For example, if NFIRST = 6 and NLAST = 3, and the character string is - LENGTHOFSIDEONE, then it will appear in the graphics window as - LENGTH...ONE. - - If the actual length of the character string is less than the specified - combination of NFIRST + NLAST +3, then the actual string will be used. - - This command is valid in any processor. - """ - command = f"/CFORMAT,{nfirst},{nlast}" - return self.run(command, **kwargs) - - def clabel(self, wn="", key="", **kwargs): - """Specifies contour labeling. - - APDL Command: /CLABEL - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - key - Labeling key: - - 0 or 1 - Label contours with legend or color (default). - - -1 - No contour labeling. - - N - Same as 1 except show alphabetic legend only on every Nth element. - - Notes - ----- - Labels contours for identification with alphabetic legend for vector - displays and color for raster displays. Number of contours is - automatically reduced to 9 (or fewer) for clarity. Use /CONTOUR - command to increase (24 maximum for alphabetic labeling; no limit for - color labeling). - - This command is valid in any processor. - """ - command = f"/CLABEL,{wn},{key}" - return self.run(command, **kwargs) - - def contour(self, wn="", ncont="", vmin="", vinc="", vmax="", **kwargs): - """Specifies the uniform contour values on stress displays. - - APDL Command: /CONTOUR - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - ncont - Number of contour values. NCONT defaults to 9 for X11 or WIN32 and - to 128 for X11c or WIN32C. The default graphics window display for - 3-D devices is a smooth continuous shading effect that spans the - maximum of 128 contours available. Use the /DV3D command to create - defined banding for your contour values (values of 9 and 128 are - displayed in smooth shading only). The legend, however, will - display only nine color boxes, which span the full range of colors - displayed in the graphics window. - - vmin - Minimum contour value. If VMIN = AUTO, automatically calculate - contour values based upon NCONT uniformly spaced values over the - min-max extreme range. Or, if VMIN = USER, set contour values to - those of the last display (useful when last display automatically - calculated contours). - - vinc - Value increment (positive) between contour values. Defaults to - (VMAX-VMIN)/NCONT. - - vmax - Maximum contour value. Ignored if both VMIN and VINC are - specified. - - Notes - ----- - See the /CVAL command for alternate specifications. Values represent - contour lines in vector mode, and the algebraic maximum of contour - bands in raster mode. - - Note:: : No matter how many contours (NCONT) are specified by /CONTOUR, - the actual number of contours that appear on your display depends also - on the device name, whether the display is directed to the screen or to - a file, the display mode (vector or raster), and the number of color - planes. (All these items are controlled by /SHOW settings.) In any - case, regardless of whether they are smoothed or banded, only 128 - contours can be displayed. See Creating Geometric Results Displays in - the Basic Analysis Guide for more information on changing the number of - contours. - - If the current ANSYS graphics are not displayed as Multi-Plots, then - the following is true: If the current device is a 3-D device - [/SHOW,3D], the model contours in all active windows will be the same, - even if separate /CONTOUR commands are issued for each active window. - For efficiency, ANSYS 3-D graphics logic maintains a single data - structure (segment), which contains precisely one set of contours. The - program displays the same segment in all windows. The view settings of - each window constitute the only differences in the contour plots in the - active windows. - - This command is valid in any processor. - """ - command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" - return self.run(command, **kwargs) - - def cval( - self, - wn="", - v1="", - v2="", - v3="", - v4="", - v5="", - v6="", - v7="", - v8="", - **kwargs, - ): - """Specifies nonuniform contour values on stress displays. - - APDL Command: /CVAL - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - v1, v2, v3, . . . , v8 - Up to 8 contour values may be specified (in ascending order). The - 0.0 value (if any) must not be the last value specified. If no - values are specified, all contour specifications are erased and - contours are automatically calculated. - - Notes - ----- - This command is similar to the /CONTOUR command. With /CVAL, however, - you define the upper level of each contour band instead of having the - contours uniformly distributed over the range. The minimum value - (including a zero value for the first band) for a contour band cannot - be specified. If you use both /CONTOUR and /CVAL, the last command - issued takes precedence. - - This command is valid in any processor. - """ - command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" - return self.run(command, **kwargs) - - def gformat(self, ftype="", nwidth="", dsignf="", **kwargs): - """Specifies the format for the graphical display of numbers. - - APDL Command: /GFORMAT - - Parameters - ---------- - ftype - FORTRAN format types (G is the default if this field is left - blank.) - - G - Gxx.yy. xx and yy are described below. - - F - Fxx.yy - - E - Exx.yy - - nwidth - Total width (12 maximum) of the field (the xx in Ftype). Defaults - to 12. - - dsignf - Number of digits after the decimal point (yy in F or E format) or - number of significant digits in G format. Range is 1 to xx-6 for - Ftype = G or E; and 0 to xx-3 for Ftype = F. The default is a - function of Ftype and NWIDTH. - - Notes - ----- - Lets you control the format of the graphical display of floating point - numbers. Issue /GFORMAT,STAT to display the current settings; issue - /GFORMAT,DEFA to let ANSYS choose the format for the graphical display - of floating numbers. - - This command is valid in any processor. - """ - command = f"/GFORMAT,{ftype},{nwidth},{dsignf}" - return self.run(command, **kwargs) - - def hbc(self, wn="", key="", **kwargs): - """Determines how boundary condition symbols are displayed in a display - - APDL Command: /HBC - window. - - Parameters - ---------- - wn - Window reference number. This number can be any window numbered 1 - to 5, or ALL (for all active windows). Defaults to 1 - - key - Key to enable/disable hidden surface boundary condition symbol - display for 2-D graphics devices and to request improved pressure - contour display for 2-D and 3-D devices: Key = ON, YES or 1 will - show your BC symbols on the hidden surfaces and use an improved - pressure contour display. Key = OFF, NO or 0 (default) will hide - the symbols . - """ - command = f"/HBC,{wn},{key}" - return self.run(command, **kwargs) - - def number(self, nkey="", **kwargs): - """Specifies whether numbers, colors, or both are used for displays. - - APDL Command: /NUMBER - - Parameters - ---------- - nkey - Numbering style: - - * ``0`` : Color (terminal dependent) the numbered items - and show numbers. - - * ``1`` : Color the numbered items. Do not show the - numbers. - - * ``2`` : Show the numbers. Do not color the items. - - * ``-1`` : Do not color the items or show the numbers. For - contour plots, the resulting display will vary (see below). - - Notes - ----- - Specifies whether numbers, colors, or both are used for numbering - displays [/PNUM] of nodes, elements, keypoints, lines, areas, and - volumes. - - Shading is also available for terminals configured with more than 4 - color planes [/SHOW]. Color automatically appears for certain items - and may be manually controlled (off or on) for other items. - - When you suppress color (NKEY = -1) your contour plots will produce - different results, depending on your graphics equipment. For non-3-D - devices (X11, Win32, etc.) your contour plot will be white (no color). - For 3-D devices, such as OpenGL, the resulting display will be in - color. - - The following items are automatically given discrete colors: Boundary - condition symbols [/PBC], curves on graph displays, and distorted - geometry on postprocessing displays. Contour lines in postprocessing - displays are automatically colored based upon a continuous, rather than - a discrete, spectrum so that red is associated with the highest contour - value. On terminals with raster capability [/SHOW], the area between - contour lines is filled with the color of the higher contour. - - Explicit entity colors or the discrete color mapping may be changed - with the /COLOR command. - - This command is valid in any processor. - """ - command = f"/NUMBER,{nkey}" - return self.run(command, **kwargs) - - def pbc(self, item="", key="", min_="", max_="", abs_="", **kwargs): - """Shows boundary condition (BC) symbols and values on displays. - - APDL Command: /PBC - - Parameters - ---------- - item - Label identifying the item: - - U - Applied translational constraints (UX, UY, UZ). - - ROT - Applied rotational constraints (ROTX, ROTY, ROTZ). - - TEMP - Applied temperatures (TEMP, TBOT, TE2, TE3, . . ., TTOP). - - PRES - Applied fluid pressures. - - V - Applied flow velocities (VX, VY, VZ). - - VOLT - Applied voltages. - - MAG - Applied scalar magnetic potentials. - - A - Applied vector magnetic potentials. - - CONC - Concentration. - - CHRG - Applied electric charge. - - F or FORC - Applied structural forces (FX, FY, FZ). - - M or MOME - Applied structural moments (MX, MY, MZ). - - HEAT - Applied heat flows (HEAT, HBOT, HE2, HE3, . . ., HTOP). - - FLOW - Applied fluid flow. - - AMPS - Applied current flow. - - FLUX - Applied magnetic flux. - - CSG - Applied magnetic current segments. - - RATE - Diffusion flow rate. - - MAST - Master degrees of freedom. - - CP - Coupled nodes. - - CE - Nodes in constraint equations. - - NFOR - POST1 nodal forces. - - NMOM - POST1 nodal moments - - RFOR - POST1 reaction forces. - - RMOM - POST1 reaction moments (MX, MY, MZ). - - PATH - Path geometry (undistorted) associated with the PATH command after a PDEF or - PVECT command has been issued. - - ACEL - Global acceleration (ACELX, ACELY, ACELZ vector). - - OMEG - Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, - DOMEGY, DOMEGZ vector). - - WELD - Applied spotwelds (ANSYS LS-DYNA). - - ALL - Represents all appropriate labels. - - key - Symbol key: - - 0 - Do not show symbol. - - 1 - Show symbol. - - 2 - Plot value next to symbol. - - min\\_ - Minimum value in a range of values plotted on screen. - - max\\_ - Maximum value in a range of values plotted on screen. - - abs\\_ - Absolute number. If KEY = 2 and ABS = 0, a number falling between - the MIN and MAX is displayed. If ABS is not specified, it defaults - to 0. If KEY = 2 and ABS = 1, an absolute value falling between - the MIN and MAX is displayed. ABS = 1 lets you eliminate the - display of numbers whose absolute values are less than a desired - tolerance. For example, if ABS = 1, MIN = 10 and MAX = 1e8, values - such as .83646 and -5.59737 are not displayed. - - Notes - ----- - The ``mapdl.pbc`` command adds degree of freedom constraint, force load, and - other symbols to displays. - - Symbols are applied to the selected nodes only. All arrow and - arrowhead symbols are oriented in the nodal coordinate system and lie - in two perpendicular planes. Force arrows are scaled proportional to - their magnitude. (If KEY = 1, use /VSCALE to change arrow length.) - For scalar quantities, the specific component direction (i.e., x, y, or - z) of the symbol has no meaning, but the positive or negative sense - (e.g., positive or negative x) represents a positive or negative scalar - value, respectively. - - The effects of the ``mapdl.pbc`` command are not cumulative (that is, the - command does not modify an existing setting from a previously issued - ``mapdl.pbc`` command). If you issue multiple ``mapdl.pbc`` commands - during an analysis, only the setting specified by the most recent - ``mapdl.pbc`` command applies. - - Use ``mapdl.pstatus()`` or ``mapdl.pbc('STAT')`` to display settings. - Use ``mapdl.pbc('DEFA')`` to reset all specifications back to default. - See the ``mapdl.psf`` and ``mapdl.pbf`` commands for other display symbols. - - In a cyclic symmetry analysis, the ``mapdl.pbc`` command is deactivated when - cyclic expansion is active (/CYCEXPAND,,ON). To view boundary - conditions on the basic sector, deactivate cyclic expansion - (/CYCEXPAND,,OFF) and issue this command: ``mapdl.pbc('ALL', 1)`` - - Issuing the command ``mapdl.pbc('PATH', 1)`` displays all defined paths. - - The ``mapdl.pbc`` command is valid in any processor. - - .. note: - In APDL the /PBC command has an unused 3rd argument. This has been - removed in PyMAPDL because of its redundancy, and should be - kept in mind when translating between the two. - - Examples - -------- - On all subsequent plots (after this command). Activate display of - translational boundary condition symbols. - - >>> mapdl.pbc('U', 1) - - Display enforced nodal temperatures - - >>> mapdl.pbc('TEMP', 1) - """ - command = f"/PBC,{item},,{key},{min_},{max_},{abs_}" - return self.run(command, **kwargs) - - def pbf(self, item="", key="", **kwargs): - """Shows magnitude of body force loads on displays. - - APDL Command: /PBF - - Parameters - ---------- - item - Label identifying the item: - - TEMP - Applied temperatures. - - FLUE - Applied fluences. - - HGEN - Applied heat generation rates. - - JS - Applied current density magnitude. - - JSX - X-component of current density. - - JSY - Y-component of current density. - - JSZ - Z-component of current density. - - PHASE - Phase angle of applied load. - - MVDI - Applied magnetic virtual displacements flag. - - CHRGD - Applied electric charge density. - - VLTG - Applied voltage drop. - - key - Symbol key: - - 0 - Do not show body force load contours. - - 1 - Show body force load contours. - - 2 - Show current density as a vector (not a contour). - - Notes - ----- - Shows body force loads as contours on displays for the selected - elements. - - The effects of the ``mapdl.pbf`` command are not cumulative (that is, the - command does not modify an existing setting from a previously issued - ``mapdl.pbf`` command). If you issue multiple ``mapdl.pbf`` commands - during an analysis, only the setting specified by the most recent - ``mapdl.pbf`` command applies. - - Use ``mapdl.pstatus()`` or ``mapdl.pbf('STAT')`` to display settings. - Use ``mapdl.pbf('DEFA')`` to reset all specifications back to default. - See also the ``mapdl.psf`` and ``mapdl.pbc`` command - for other display contours. - - Portions of this command are not supported by PowerGraphics - [``mapdl.graphics('POWER')``]. - - This command is valid in any processor. - - .. note: - In APDL the /PBF command has an unused 2nd argument. This has been - removed in PyMAPDL because of its redundancy, and should be - kept in mind when translating between the two. - - Examples - -------- - Activate display of body loads of structural temperature on subsequent plots - by showing body force and contours. - - >>> mapdl.pbf('TEMP', 1) - """ - return self.run(f"/PBF,{item},,{key}", **kwargs) - - def plopts(self, label="", key="", **kwargs): - """Controls graphics options on subsequent displays. - - APDL Command: /PLOPTS - - Parameters - ---------- - label - Apply display items as selected from the following labels: - - INFO - Controls the display of the legend (ON or OFF) and allows the choice of preset - or Multi-legend placement. Control is provided by the KEY - values. (Defaults to KEY=3 when the GUI is on. Defaults to - KEY= 2 otherwise.) - - LEG1 - Header portion of legend column (defaults to ON). - - LEG2 - View portion of legend column (defaults to ON (except off with contour - displays)). - - LEG3 - View the contour section of the legend column (defaults to ON). - - FRAME - Frame border lines around windows (defaults to ON). - - TITLE - Title (bottom left text) (defaults to ON). - - MINM - Min-Max symbols on contour displays (defaults to ON). - - LOGO - ANSYS logo (defaults to OFF (displayed as text at top of legend column)). If - KEY = ON, the text is removed from legend column but the - logo symbol is displayed in whichever active window is - either in the uppermost right corner and on top, or if there - is no window in that location, then in the window to the - furthest right of the screen. Version information remains - in the legend column. - - WINS - Controls whether graphics windows automatically stretch or shrink to adjust to - screen size as the legend column is turned off or on - [/PLOPTS,INFO] (defaults to ON). If WINS is on and the - legend column is changed from off to on, all windows are - shrunk regardless of what their correct size is. - - WP - Working plane (defaults to OFF). The working plane is drawn as part of the - display (not just an overlaid image as in WPSTYL). This - option is best used in combination with a hidden-line - technique [/TYPE]. - - DATE - Controls the display of the date and time in your legend. Subsequent KEY values - control the display as follows: - - FILE - Controls the display of the ANSYS jobname in your legend. Subsequent KEY values - control the display as follows: - - key - Switch: - - OFF or 0 - Do not apply this display item. For Label = DATE, no time or date are - displayed. - - ON or 1 - Apply this display item. For Label = DATE, show only the date. - - AUTO or 2 - For Label = INFO, initiate Auto-legend mode. If the display has contours, the - legend is ON; if the display has no contours, the - legend is OFF. For Label = DATE, display both the date - and time. - - 3 - For Label = INFO , switch to Multi-legend mode. See the /UDOC command for the - available legend configurations. - - Notes - ----- - Use /PLOPTS,STAT to display settings. Use /PLOPTS,DEFA to reset all - specifications back to their defaults. - - When you perform multiple results displays, contours on the legend - column may be truncated. To avoid this, specify /PLOPTS,LEG1,0. - - The Multi-legend mode provides a number of legend data item priority - and placement options. These options are accessed via the GUI at - Utility Menu> PlotCtrls> Window Controls> Window Options. The /UDOC - command provides command line options for this capability. - - This command is valid in any processor. - - This command is not available for Academic Research or Teaching level - products - """ - command = f"/PLOPTS,{label},{key}" - return self.run(command, **kwargs) - - def pnum(self, label="", key="", **kwargs): - """Controls entity numbering/coloring on plots. - - APDL Command: /PNUM - - Parameters - ---------- - label - Type of numbering/coloring: - - NODE - Node numbers on node and element plots. - - ELEM - Element numbers and colors on element plots. - - SEC - Section numbers and colors on element and solid model plots (see "Notes"). - - MAT - Material set numbers and colors on element and solid model plots (see - "Notes"). - - TYPE - Element type reference numbers and colors on element and solid model plots (see - "Notes"). - - REAL - Real constant set numbers and colors on element and solid model plots (see - "Notes"). - - ESYS - Element coordinate system numbers on element and solid model plots (see - "Notes"). - - PART - Element part numbers and colors on element plots (applicable to ANSYS LS-DYNA - only). - - LOC - Location numbers/colors of the element in matrix assembly order on element - plots. - - .. note:: ``LOC`` and ``ELEM`` numbers will be the same unless the model has been reordered. - - KP - Keypoint numbers on solid model plots. - - LINE - Line numbers on solid model plots (both numbers and colors on line plots). - - AREA - Area numbers on solid model plots (both numbers and colors on area plots). - - VOLU - Volume numbers on solid model plots (both numbers and colors on volume plots). - - SVAL - Stress (or any contour) values on postprocessing plots, and - surface load values and colors on model plots (when surface load - symbols are on [/PSF]). For tabular boundary conditions, the - table-evaluated values will be displayed on node, element, or - contour displays in POST1 when load symbols (/PBF, /PSF, /PBC) - are on and TABNAM is OFF. - - TABNAM - Table names for tabular boundary conditions. If this label is - turned on, the table name appears next to the appropriate - symbol, arrow, face outline, or contour as dictated by the /PSF, - /PBC, and /PBF commands. - - STAT - Shows current settings for /PNUM. - - DEFA - key - Switch: - - 0 - Turns OFF numbers/colors for specified label. - - 1 - Turns ON numbers/colors for specified label. - - Notes - ----- - This command specifies entity numbering and coloring for subsequent - plots. - - The MAT, TYPE, REAL, and ESYS labels activate both the numbering and - coloring of the corresponding attributes for EPLOT, KPLOT, LPLOT, - APLOT, and VPLOT. The ELEM, MAT, TYPE, REAL, ESYS, PART (ANSYS LS-DYNA - only), and LOC labels are mutually exclusive, i.e., only one can be - specified at a time. Also, turning on a LINE, AREA, or VOLU label will - turn off the MAT, TYPE, REAL, and PART labels. - - PowerGraphics [/GRAPHICS,POWER] displays for/PNUM can be problematic. - /PNUM,ELEM will display erratically depending on other display command - specifications, while /PNUM,LOC and /PNUM,ESYS are not supported. - - Element and volume numbers are not visible for 3-D elements and volumes - when Z-buffering is turned on (/TYPE,,[6,7, or 8]). - - Use /PSTATUS or /PNUM,STAT to show settings. Use /PNUM,DEFA to reset - all specifications back to default. Use the /NUMBER command to control - whether numbers and colors are displayed together. - - This command is valid in any processor - """ - command = f"/PNUM,{label},{key}" - return self.run(command, **kwargs) - - def psf(self, item="", comp="", key="", kshell="", color="", **kwargs): - """Shows surface load symbols on model displays. - - APDL Command: /PSF - - Parameters - ---------- - item, comp - Labels identifying the surface load to be shown; see - Table 227: /PSF Valid Item and Component Labels. - - key - Key to turn surface load symbols on or off: - - 0 - Off (default). - - 1 - On, shown as face outlines. Line surface loads (SFL) on solid model plots are - shown as arrows. - - 2 - On, shown as arrows. - - 3 - On, shown as color filled surfaces. Line and area surface loads (SFL and SFA) - on solid model plots are shown as arrows. - - kshell - Visibility key for shell elements. - - 0 - Off (default), surface load symbols are displayed only on visible load faces. - - 1 - On, surface load symbols are displayed even if load face is not visible. - - color - Visibility key for contour legend. - - ON - The symbols (arrows or face outlines) will show up in color with the legend - showing the corresponding color labels (default). - - OFF - The contour legend will not be displayed. The symbols (arrows or face outlines) - will show up in grey. The size of the arrows will be - proportional to the applied load. - - Notes - ----- - The ``mapdl.psf`` command determines whether and how to show surface loads on - subsequent model displays. - - If surface loads are applied to solid model entities, only solid model - plots show the load symbols; node and element plots do not show them - unless the loads are transferred (SFTRAN or SBCTRAN). Similarly, solid - model plots do not show the load symbols if surface loads are applied - to nodes and elements. For node and element plots of shell element - models, the surface load symbols are shown only if the load face is - visible from the current viewing direction. - - The effects of the ``mapdl.psf`` command are not cumulative (that is, the - command does not modify an existing setting from a previously issued - ``mapdl.psf`` command). Only the setting specified via the most recent - ``mapdl.psf`` command applies. - - If you issue a postprocessing (``mapdl.post1``) plot command that produces result - contours (such as PLNSOL), the ``mapdl.psf`` command has no effect. This - behavior prevents conflicting contours in the graphics window. - - When using the radiosity method (Item = RDSF and Comp = ENCL) with Key - = 2, the radiation arrows point outward from any element face. When - using SURF154 with KEYOPT(2) = 1, set the Item to PRES and leave the - Component Label blank. - - ``mapdl.psf('STAT')`` displays current ``mapdl.psf`` settings, and - ``mapdl.psf('DEFA')`` resets them back to default. - - Other useful commands are ``mapdl.pnum('SVAL', 1)`` to show the values of the - surface loads, ``mapdl.vscale()`` to change arrow lengths, and - ``mapdl.pbc`` and ``mapdl.pbf`` to activate other load symbols. - - For beam elements, only the colors representing shear (GREEN) and - normal (RED) pressures are displayed for the arrows. The color of these - arrows does not correspond to the magnitudes in the contour legend. The - length of these arrows does, however, correlate to the relative - magnitude of the pressures. - - For elements SURF159, SOLID272, SOLID273, PIPE288 and PIPE289, the /PSF - command is not available when displaying elements with shapes - determined from the real constants or section definition (``mapdl.eshape``). - For PIPE288 and PIPE289, only external loads applied via the - ``mapdl.sfbeam`` command are displayed. - - This command is valid in any processor. - - Table: 227:: : /PSF - Valid Item and Component Labels - - Pressure loads apply to the element coordinate system (KEYOPT(2) = 0). - Adjust appropriately for a local coordinate system (KEYOPT(2) = 1). See - Figure: 153.2:: Pressures in the Element Reference. - - Examples - -------- - On subsequent plots display the surface loads of pressure as arrows. - - >>> mapd.psf('PRES', '', 2) - - Activate display of convection on surfaces using the element outline option. - - >>> mapdl.psf('CONV', '', 1) - """ - command = f"/PSF,{item},{comp},{key},{kshell},{color}" - return self.run(command, **kwargs) - - def psymb(self, label="", key="", **kwargs): - """Shows various symbols on displays. - - APDL Command: /PSYMB - - Parameters - ---------- - label - Show symbols as selected from the following labels: - - CS - Local coordinate systems. - - NDIR - Nodal coordinate systems (on rotated nodes only). - - ESYS - Element coordinate systems (element displays only). - - LDIR - Line directions (line displays only). - - LDIV - Controls the display of element divisions on lines. - - ADIR - Area direction symbol (for keypoint, line, area and volume plots). - - LAYR - Layer orientations (relative to the projected element x-axis) or fiber - orientations in smeared reinforcing elements. Used only - within an element display. Use KEY to specify the layer - number. - - ECON - Element mesh symbols on keypoints and lines. - - DOT - Larger symbols displayed for node and keypoint locations. When Label = DOT, - KEY = 1 by default. - - XNOD - Extra node of surface or circuit elements. - - FBCS - Force boundary condition scaling. Subsequent KEY value determines whether or - not to scale the applied and derived forces/moments to the - same maximum value. - - DEFA - Resets the symbol keys so that ANSYS displays none of the symbols controlled by - the /PSYMB command. The value of the KEY field is ignored. - - STAT - Prints the status of the settings of the symbol - keys controlled by the /PSYMB command. The KEY - field is ignored. - - key - Symbol key: - - ``-1`` - Effective only if Label = LAYR and solid shape - element display (/ESHAPE) is active. Orientation of - all layers appears with the solid shape element - display. - - 0 - No symbol (default). If Label = LDIV, then KEY= 0 - indicates that the displayed element divisions will - correspond to the existing mesh (the word MESHED or - EXISTING can also be substituted). Also, for Label = - LDIV, if you execute any meshing command (such as - AMESH or VMESH), KEY is set to 0 (MESHED) - automatically. If Label = FBCS, then KEY= 0 indicates - that boundary condition scaling will not be - common. The applied and derived forces/moments will - be scaled to their respective maximum values. - - 1 - Include symbol. If Label = LDIV, then KEY = 1 - indicates that the displayed line divisions will - correspond to the value assigned by LESIZE (the word - LESIZE can also be substituted). Also, for Label = - LDIV, if you execute the LESIZE command, KEY is set - to 1 (LESIZE) automatically. If Label = FBCS, then - KEY= 1 indicates that boundary condition scaling will - be common. The applied and derived forces/moments - will be scaled to the same maximum value. - - N - If Label = LAYR, then N is equal to the layer - number. If Label = DOT, then N can be equal to - 0,1,.....15, indicating the dot size. If Label = - LDIV, then KEY = -1, indicates that no element - divisions will be displayed (the word OFF can also be - substituted). - - Notes - ----- - Includes various symbols on the display. Triads are right-handed with - x displayed as the longest leg. Where color is displayed, x is white, - y is green, and z is blue. For beams, x is always along the length of - the element. For lines, an arrow represents the direction of a line, - from the beginning keypoint to the end keypoint. See /PLOPTS command - for additional display options. Use /PSTATUS or /PSYMB,STAT to display - settings. Use /PSYMB,DEFA to reset all specifications back to their - defaults. The command /PSYMB,ECON,1 causes the symbol "M" to be - displayed on keypoints and lines associated with meshed entities. When - you issue the command /PSYMB,DOT,1, a larger symbol is displayed for - each node and keypoint location. - - PowerGraphics (/GRAPHICS,POWER) does not support /PSYMB,ESYS and - /PSYMB,LAYR. - - If KEY = N and PowerGraphics is off, the centroid of the surface - elements is connected to the extra node using a gray line. However, if - PowerGraphics is on, the color of the line connecting the centroid to - the extra node is the same as that for the elements themselves (as - determined by /PNUM). - - When Label = LAYR, the layer systems can be visualized with all - current-technology layered elements and the smeared reinforcing element - REINF265. To use /PSYMB,LAYR with REINF265, first set the vector-mode - graphics option (/DEVICE,VECTOR,1). - - This command is valid in any processor. - - """ - command = f"/PSYMB,{label},{key}" - return self.run(command, **kwargs) - - def triad(self, lab="", **kwargs): - """Shows the global XYZ coordinate triad on displays. - - APDL Command: /TRIAD - - Parameters - ---------- - lab - Display triad as follows: - - ORIG - Display triad at global origin (default). - - OFF - Turn off triad display. - - LBOT - Display triad in lower left screen corner. - - RBOT - Display triad in lower right screen corner. - - LTOP - Display triad in upper left screen corner. - - RTOP - Display triad in upper right screen corner. - - Notes - ----- - For efficiency, ANSYS 3-D graphics logic maintains a single data - structure (segment), which includes the triad as a 3-D data object. If - a 3-D device is involved (/SHOW,3D), and the ANSYS graphics are not - being displayed as multi-plots, then the triad location is determined - by the view settings for Window #1. A request for triad display - anywhere except for the origin could yield an improper display in - windows 2 through 5. The program displays the same segment in all - windows. The view settings of each window constitute the only - difference in the display in the active windows. - - This command is valid in any processor. - """ - command = f"/TRIAD,{lab}" - return self.run(command, **kwargs) - - def udoc(self, wind="", cl_ass="", key="", **kwargs): - """Determines position and content for the multi-legend options. - - APDL Command: /UDOC - - Parameters - ---------- - wind - The window number to which the command applies. (defaults to 1) - - class - The type (and relative importance) of legend item being displayed: - - CNTR - Contour legend. This legend item is controlled separately from the other legend - items (see note below). - - DATE - The items in the DATE class include the date and time, or the ANSYS graphical - logo (/PLOPTS,LOGO,1). This item is shown by default in all - plots. - - GWIN - The items in the GWIN class include the entity acronyms that appear in the - legend of a multiplot of entities (Nodes, Elements, - Keypoints, Lines, Areas, Volumes). GWIN items are shown by - default for all GPLOT displays. - - TYPE - Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL - SOLUTIONS, etc.). TYPE items are shown by default in all - plots. - - TYP2 - Items in the TYP2 class include supplementary type information, such as DMAX - and SMAX for nodal solutions. TYP2 items are shown by - default in all plots. - - INUM - Items in the INUM class include the number labels generated by the /PNUM - command. This class is displayed by default in all plots - that contain /PNUM information. - - BCDC - The items in the BCDC class include labels created by the /PBC command. This - class is shown by default in all plots which contain /PBC - information. - - VECT - Items in the VECT class include labels created by the PLVECT command. This - class is shown by default for all PLVECT plots. - - SURF - The items in the SURF class include labels from the /PSF legend. This class is - shown by default on all plots of surface boundary - conditions. - - BODY - Items from the BODY class include labels from the /PBF legend. This class is - shown by default in all plots of body forces. - - PSTA - Items from the PSTA class include stress scaling statistics, such as the - /SSCALE setting. This class is not shown as the default for - any type of plot, and must be specifically referenced to - display the included data. - - VIEW - The items in the VIEW class include view statistics. This class is not shown as - the default for any type of plot, and must be specifically - referenced to display the included data. - - MISC - The items in the MISC class include supplementary labels like /EXPANDED and - Stress Section Cross Section. This class is not shown as the - default for any type of plot, and must be specifically - referenced to display the included data. - - key - Switch: - - Notes - ----- - The legend classes conform to the controls specified in the window - options panel (PlotCtrls> Window Controls> Window Options). In many - instances, the legend controls specified with the /PLOPTS command will - take precedence and override /UDOC specifications. For instance: - - /PLOPTS,LEG1,OFF will disable the TYPE, TYP2, INUM, and MISC classes, - regardless of the /UDOC settings. - - /PLOPTS,LEG2,OFF will disable the VIEW class, regardless of the /UDOC - settings. - - /PLOPTS,LEG3,OFF will disable the PSTA class, regardless of the /UDOC - settings. - - All items in a class are listed with the same X coordinate (except for - contours). The contents of the text classes are dumped onto the display - window from top to bottom, in order of class importance. - - The font specification for text items that are included in the user- - specified legends are controlled with the /DEVICE command (PlotCtrls> - Font Controls> Anno/Graph Font). - - The floating point values for the data presented in the legend(s) are - controlled by the /GFORMAT command. - """ - command = f"/UDOC,{wind},{cl_ass},{key}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/scaling.py b/src/ansys/mapdl/core/_commands/graphics_/scaling.py deleted file mode 100644 index 3d1460d6cc1..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/scaling.py +++ /dev/null @@ -1,447 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Scaling: - def slashdscale(self, wn="", dmult="", **kwargs): - """Sets the displacement multiplier for displacement displays. - - APDL Command: /DSCALE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - dmult - AUTO or 0 - Scale displacements automatically so that maximum displacement - (vector amplitude) displays as 5 percent of the maximum model - length, as measured in the global Cartesian X, Y, or Z - directions. - - 1 - Do not scale displacements (that is, scale displacements by 1.0, - true to geometry). Often used with large deflection results. - - FACTOR - Scale displacements by numerical value input for `FACTOR`. - - OFF - Remove displacement scaling (that is, scale displacements by 0.0, - no distortion). - - USER - Set `dmult` to that used for last display (useful when last `dmult` - value was automatically calculated). - - Notes - ----- - - **Command Default** - - The default value is AUTO or 0 except when: - - * Large deflection effects are included (`NLGEOM,ON`) and it is not a - modal analysis; then the default is 1. - - * It is a spectrum analysis (`ANTYPE,SPECTR`); then the default is `OFF`. - - * The amplitude of a time-harmonic solution is computed using the `HRCPLX` - command (`OMEGAT ≥ 360°`); then the default is `OFF`. - - * The amplitude of a complex modal or harmonic solution is stored into - the database using the `SET` command (`KIMG = AMPL`); then the default - is `OFF`. - - If Multi-Plots are not being displayed, and the current device is a 3D - device (`/SHOW,3D`), then the displacement scale in all active windows - will be the same, even if separate `/DSCALE` commands are issued for - each active window. For efficiency, the program maintains a single data - structure (segment) containing only one displacement scale. The program - displays the same segment (displacement scale) in all windows. Only the - view settings will be different in each of the active windows. - - This command is valid in any processor. - - """ - command = f"/DSCALE, {wn}, {dmult}" - return self.run(command, **kwargs) - - def iclwid(self, factor="", **kwargs): - """Scales the line width of circuit builder icons. - - APDL Command: /ICLWID - - Parameters - ---------- - factor - Multiplication factor applied to the default line width (defaults - to 1). The minimum is 1 and the maximum is 6. - - Notes - ----- - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = f"/ICLWID,{factor}" - return self.run(command, **kwargs) - - def icscale(self, wn="", factor="", **kwargs): - """Scales the icon size for elements supported in the circuit builder. - - APDL Command: /ICSCALE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - factor - Factor applied to the default icon size (defaults to 1). - - Notes - ----- - Scaling the icon size can provide better visualization of the circuit - components when using the Circuit Builder (an interactive builder - available in the ANSYS GUI). - - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = f"/ICSCALE,{wn},{factor}" - return self.run(command, **kwargs) - - def ratio(self, wn="", ratox="", ratoy="", **kwargs): - """Distorts the object geometry. - - APDL Command: /RATIO - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - ratox - Distort object in the window X direction by this factor (defaults - to 1.0). - - ratoy - Distort object in the window Y direction by this factor (defaults - to 1.0). - - Notes - ----- - Distorts the object geometry in a particular direction. An example of - this command's use would be to allow long narrow sections to be - distorted to a more square area for better display visualization. - - This command is valid in any processor. - """ - command = f"/RATIO,{wn},{ratox},{ratoy}" - return self.run(command, **kwargs) - - def shrink(self, ratio="", **kwargs): - """Shrinks elements, lines, areas, and volumes for display clarity. - - APDL Command: /SHRINK - - Parameters - ---------- - ratio - Shrinkage ratio (input as a decimal (0.0 to 0.5)). Defaults to 0.0 - (no shrinkage). Values greater than 0.5 default to 0.1 (10% - shrinkage). - - Notes - ----- - Shrinks the elements, lines, areas, and volumes so that adjacent - entities are separated for clarity. Portions of this command are not - supported by PowerGraphics [/GRAPHICS,POWER]. - - If only the common lines of non-coplanar faces are drawn (as per the - /EDGE command), then this command is ignored. - - This command is valid in any processor. - """ - command = f"/SHRINK,{ratio}" - return self.run(command, **kwargs) - - def sscale(self, wn="", smult="", **kwargs): - """Sets the contour multiplier for topographic displays. - - APDL Command: /SSCALE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - smult - Contour multiplier that factors in results based on the product of - the multiplier and the result being plotted. Defaults to 0.0 (no - topographic effects). - - Notes - ----- - Use this command to scale values to the geometry when the contours are - shown elevated. For section displays [/TYPE], the elevation is - performed perpendicular to the section face. - - Nonzero contour multipliers factoring in large results (stresses or - displacements) can produce very large distortion, causing images to - disappear. To bring a distorted image back into view, reduce the - contour multiplier value. - - Portions of this command are not supported by PowerGraphics - [/GRAPHICS,POWER]. - """ - command = f"/SSCALE,{wn},{smult}" - return self.run(command, **kwargs) - - def txtre(self, lab="", num="", n1="", n2="", ninc="", **kwargs): - """Controls application of texture to selected items. - - APDL Command: /TXTRE - - Parameters - ---------- - lab - You can apply texture according to the following labels: - - ELEM - Apply texture to elements N1 through N2 in steps of NINC. - - AREA - Apply texture to areas N1 through N2 in steps of NINC. - - VOLU - Apply texture to volumes N1 through N2 in steps of NINC. - - CM - Apply texture to the component named in N1. N2 and - NINC are ignored. - - ON, OFF - Sets the specified texture display on or - off. All other fields are ignored. - - File - If Lab = File, the command format is /TXTRE, File, - Key_Index, Fname, Fext, --, Format (This variant of - the command is applicable to 2-D drivers). - - Key_Index - The texture index associated with the file. If - the number fifty-one (51) is used, the - imported bitmap will be used as the window's - logo. - - Fname - File name and directory path (248 characters - maximum, including the characters needed for the - directory path). An unspecified directory path - defaults to the working directory; in this case, - you can use all 248 characters for the file name. - - Fext - Filename extension (eight-character maximum). - - Format - The file format. If Format = 0, the file is a - pixmap (Linux) or Bitmap (PC). The file cannot - contain a compressed image, and the PC file must - be 8 or 24 bit BI_RGB format. If Format = 1 or - JPEG, then the file is in JPEG (Joint - Photographic Experts Group) format. If Format = 2 - or PNG, then the file is in PNG (Portable Network - Graphics) format. - - num - Select the texture index number from the following list: - - 0 - No Texturing - - 1 - Aluminum - - 2 - Aluminum, Brushed - - 3 - Steel With Bumps - - 4 - Steel, Embossed - - 5 - Iron - - 6 - Steel, Pattern - - 7 - Steel, Riveted - - 8 - Steel, Scratched - - 9 - Tin - - 10 - Metal - - 11 - Steel, Etched - - 12 - Metal, Hot - - 13 - Iron, Grainy - - 14 - Metal, Rusty - - 15 - Brick - - 16 - Block - - 17 - Wood - - 18 - Wood, Light - - 19 - Wood, Walnut - - 20 - Plastic, Hard Blue - - 21 - Plastic, Light Blue - - 22 - Plastic, Hard Red - - 31 - Gold - - 32 - Brass - - 33 - Silver - - 34 - Plastic, Black - - 35 - Plastic, Ivory - - 36 - Plastic, Blue - - 37 - Plastic, Red - - 38 - Plastic, Yellow - - 39 - Plastic, Green - - 40 - Plastic, Brown - - n1, n2, ninc - Apply texture to Lab items numbered N1 through N2 in steps of NINC - (defaults to 1). If Lab = CM, then N1 is used to for the component - name and N2 and NINC are ignored. If Lab = ELEM, AREA, or VOLU and - N1 = blank or ALL, then the specified texture will be applied to - all entities of type Lab. If N1 = P, then graphical picking is - enabled. - - Notes - ----- - This command is available for 3-D Open GL devices. 2-D devices are - supported only for the Lab = File variation of the command, allowing - imported bitmaps to be used for texturing and annotation. Textures can - affect the speed of many of your display operations. You can increase - the speed by temporarily turning the textures off (Utility Menu> - PlotCtrls> Style> Texturing(3D)> Display Texturing). This menu - selection toggles your textures on and off. When textures are toggled - off, all of the texture information is retained and reapplied when - texturing is toggled back on. - - For some displays, the texture will appear distorted because of a - technique used to enhance 3-D displays (/DV3D,TRIS,1). Disabling this - function (/DV3D,TRIS,0) will improve the quality of some texture - displays. Disabling the TRIS option of the /DV3D command will slow down - 3-D displays significantly. Be sure to reapply the TRIS option after - you obtain a satisfactory output. - - Specifying /TXTRE,DEFA removes all texturing. - """ - command = f"/TXTRE,{lab},{num},{n1},{n2},{ninc}" - return self.run(command, **kwargs) - - def vscale(self, wn="", vratio="", key="", **kwargs): - """Scales the length of displayed vectors. - - APDL Command: /VSCALE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - vratio - Ratio value applied to the automatically calculated scale factor - (defaults to 1.0, i.e., use scale factor as automatically - calculated). - - key - Relative scaling key: - - 0 - Use relative length scaling among vectors based on magnitudes. - - 1 - Use uniform length scaling for all vector lengths. - - Notes - ----- - Allows scaling of the vector length displayed with the PLVECT command - of POST1 and the /PBC and /PSF commands. Also allows the scaling of - the element (i.e., /PSYMB,ESYS) and the nodal (i.e., /PSYMB,NDIR) - coordinate system symbols. - - This command is valid in any processor. - """ - command = f"/VSCALE,{wn},{vratio},{key}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/setup.py b/src/ansys/mapdl/core/_commands/graphics_/setup.py deleted file mode 100644 index acc229a52f0..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/setup.py +++ /dev/null @@ -1,1313 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Setup: - def color(self, lab="", clab="", n1="", n2="", ninc="", **kwargs): - """Specifies the color mapping for various items. - - APDL Command: /COLOR - - Parameters - ---------- - lab - Apply color to the items specified by the following labels: - - AXES - Determines the color (specified in next argument, Clab) that the axes of a - graph will be plotted in. - - AXNUM - Determines the color (specified in next argument, Clab) that the numbering on - the axes of a graph will be plotted in. - - NUM - Discretely numbered items (such as element types, element materials, etc., as - shown on the /PNUM command). Also specify number (1 to 11) - in the N1 field. For example, /COLOR,NUM,RED,3 will assign - the color red to all items having the discrete number 3 - (material displays would show elements having material 3 as - red). - - OUTL - Outline of elements, areas, and volumes. Ex: /COLOR,OUTL,BLUE. - - ELEM - Elements. Use N1, N2, NINC fields for element numbers. - - LINE - Solid model lines. Use N1, N2, NINC fields for line numbers. - - AREA - Solid model areas. Use N1, N2, NINC fields for area numbers. - - VOLU - Solid model volumes. Use N1, N2, NINC fields for volume numbers. - - ISURF - Isosurfaces (surfaces of constant stress, etc.). This option is particularly - useful when capturing frames for animating a single - isosurface value. - - WBAK - Window background. Use N1, N2, NINC fields for window numbers. The options - that you select using Lab = PBAK will supersede those - applied using Lab = WBAK. - - b.c.label - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, - CURR, F, M, HEAT, FLOW, VF, AMPS, FLUX, CSG, CURT, - VLTG, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See - the /PBC command for boundary condition label - definitions. - - GRBAK - Graph background. - - GRID - Graph grid lines. - - AXLAB - Graph X and Y axis labels. - - CURVE - Graph curves (identify curve numbers (1-10) in N1, N2, NINC fields). - - CM - Component group. Use N1 field for component name, ignore N2 and NINC. - - CNTR - ANSYS contour stress colors. The maximum number of contours available is 128. - The number of colors that can be specified interactively - (GUI) is 9. (/CONTOUR, , 9). Any other setting will yield - inconsistent results. - - SMAX - Specifies that all stress values above the maximum value entered in /CONTOUR - will be displayed in the color designated in the Clab field. - Defaults to dark grey. - - SMIN - Specifies that all stress values below the minimum value entered in /CONTOUR - will be displayed in the color designated in the Clab field. - Defaults to dark grey. - - PBAK - Activates background shading options (see command syntax at end of argument - descriptions below). The options that you select using Lab = - PBAK will supersede those applied using Lab = WBAK. - - clab - Valid color labels are: - - BLAC (0) - Black - - MRED (1) - Magenta-Red - - MAGE (2) - Magenta - - BMAG (3) - Blue-Magenta - - BLUE (4) - Blue - - CBLU (5) - Cyan-Blue - - CYAN (6) - Cyan - - GCYA ((7) - Green-Cyan - - GREE (8) - Green - - YGRE (9) - Yellow-Green - - YELL (10) - Yellow - - ORAN (11) - Orange - - RED (12) - Red - - DGRA (13) - Dark Gray - - LGRA (14) - Light Gray - - WHIT (15) - White - - n1, n2, ninc - Apply color to Lab items numbered N1 to N2 (defaults to N1) in - steps of NINC (defaults to 1). If N1 is blank, apply color to - entire selected range. If Lab is CM, use component name for N1 and - ignore N2 and NINC. If N1 = P, graphical picking of elements, - lines, areas and volumes is enabled; your can assign colors to the - entities via the picker. When picking is enabled, the Lab and Clab - fields are ignored. - """ - command = f"/COLOR,{lab},{clab},{n1},{n2},{ninc}" - return self.run(command, **kwargs) - - def device(self, label="", key="", **kwargs): - """Controls graphics device options. - - APDL Command: /DEVICE - - Parameters - ---------- - label - Device function label: - - BBOX - Bounding box mode. For PowerGraphics plots involving elements with /SHOW,x11 - and /SHOW,win32, ANSYS generally displays dynamic rotations - faster. If KEY = 1 (ON), then a bounding box (not the - elements) encompassing the model is displayed and rotated, - rather than the element outlines (ON is default in - preprocessing). When KEY = 0 (OFF), then dynamic rotations - may be slower (ANSYS redraws the element outlines) for plots - involving elements with /SHOW,x11 and /SHOW,win32. OFF is - default in postprocessing. This command is ignored if - /EDGE,WN,1 is set for any WN. This is ignored in POST1 and - SOLUTION plots. - - For any PowerGraphics plots involving elements, regardless of /SHOW settings, plots will generally be displayed faster. - VECTOR - - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display geometries are shown as outlines (wireframes). When vector mode is off (default), these entities are shown filled with color. - DITHER - - When dithering is turned on (default), color intensity transitions are smoothed. This selection a - applies only to smooth-shaded images, i.e., Z-buffered [/TYPE], or raster plots - with Gouraud or Phong shading [/SHADE]. - - ANIM - Select the animation type used on 2-D devices on the PC platform. A KEY value - of BMP (or 0) sets animation mode to ANSYS Animation - Controller (default). A KEY value of AVI (or 2) sets - animation mode to AVI movie player file. - - FONT - Font selection for the ANSYS graphics window. When Label = FONT, the command - format is: /DEVICE,FONT,KEY,Val1,Val2,Val3,Val4,Val5,Val6 - where KEY determines the type of font being controlled, and - values 1 through 6 control various font parameters. Note - that these values are device specific; using the same - command input file [/INPUT] on different machines may yield - different results.. The following KEY values determine the - font information that will be supplied to the appropriate - driver (e.g., Postscript, X11, Win32, JPEG, ...): - - KEY = 1 - The command controls the LEGEND (documentation column) font. - - KEY = 2 - The command controls the ENTITY (node and keypoint number) font. - - KEY = 3 - The command controls the ANNOTATION/GRAPH font. - - Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 are character strings; value 4 is a nonzero integer: - Val1 - - Family name (e.g., Courier). If Val1 = MENU, all other values are ignored and a font selection menu appears (GUI must be active). - Val2 - - Weight (e.g., medium) - Val3 - - Slant (e.g., r) - Val4 - - Pixel size (e.g., 14). Note that this value does no affect the annotation fonts (KEY = 3). Use the /TSPEC command for annotation font size. - Val5 - - Val1 - Family name (e.g., ``Courier*New``) Substitute an - asterisk (``*``) for any blank character that - appears in a family name. If Val1 = MENU, all other - values are ignored and a font selection menu - appears (GUI must be active). When this value is - blank ANSYS uses the first available resource it - finds. - - Val2 - Weight (0 - 1000) - - Val3 - Orientation (in tenths of a degree) - - Val4 - Height (in logical units) - - Val5 - Width (in logical units) - - Val6 - Italics (0 = OFF, 1 = ON) - - TEXT - Text size specification for the ANSYS Graphics window. Using this label with - the /DEVICE command requires the following form: - /DEVICE,TEXT,KEY,PERCENT. KEY = 1 for LEGEND fonts; KEY = 2 - for ENTITY fonts. PERCENT specifies the new text size as a - percent of the default text size. If PERCENT = 100, the new - text size is precisely the default size. If PERCENT = 200, - the new text size is twice the default text size. - - key - Control key: - - OFF or 0 - Turns specified function off. - - ON or 1 - Turns specified function on or designates the LEGEND font. - - 2 - Designates the ENTITY font. - - 3 - Designates the ANNOTATION/GRAPH font. - - Notes - ----- - This command is valid in any processor. - - The /DEVICE,BBOX command is ignored in POST1 and SOLUTION plots. Also, - the elements are displayed and rotated if you use /DEVICE,BBOX,ON and - /EDGE,WN,1,ANGLE (effectively ignoring the BBOX option). - """ - command = f"/DEVICE,{label},{key}" - return self.run(command, **kwargs) - - def dsys(self, kcn="", **kwargs): - """Activates a display coordinate system for geometry listings and plots. - - APDL Command: DSYS - - Parameters - ---------- - kcn - Coordinate system reference number. KCN may be 0,1,2 or any - previously defined local coordinate system number. - - Notes - ----- - Boundary condition symbols, vector arrows, and element coordinate - system triads are not transformed to the display coordinate system. The - display system orientation (for the default view) is X horizontal to - the right, Y vertical upward, and Z out of the screen (normal). - - Line directions and area directions (/PSYMB,LDIR and /PSYMB,ADIR) are - not plotted for DSYS > 0. - - When you create ANSYS 3-D annotation, the coordinates are stored to the - database in the DSYS that was active at the time of creation. Changing - the DSYS does not change the annotation coordinate data in the - database. - - This command is valid in any processor. - """ - command = f"DSYS,{kcn}" - return self.run(command, **kwargs) - - def dv3d(self, lab="", key="", **kwargs): - """Sets 3-D device option modes. - - APDL Command: /DV3D - - Parameters - ---------- - lab - Mode label: - - ACCU - Allows ANSYS to use the accumulation buffer for OpenGL graphics. Activating - this feature will provide faster model rotation when shaded - backgrounds are in use. This feature is off by default. - - ACTR - Label term to designate the cursor position as the center for automatic dynamic - rotational center capability. The subsequent Key value (see - below) turns this capability on and off. This feature is on - by default. (Available for OpenGL displays only) - - ANIM - Animation mode. The ANIM option allows you to create animation frames in - pixmap mode instead of display list mode. This may improve - large model performance, but it eliminates local - manipulation while animation is in progress. This feature is - on by default. - - ANTI - Label term to control Anti-aliasing, a smoothing technique for your graph - plots. (see below) The subsequent Key value turns this - capability on and off. The default for this feature is off. - (Available for OpenGL displays only). - - CNTR - Switches banded contours on (1) or off (0) for your 3–D contour display. The - default is 1 (ON). Other contour parameters such as number - of contours or the increment and range are defined using the - /CONTOUR command. When either 9 or 128 contours are - specified via /CONTOUR, this command is ignored and a smooth - contour is always displayed. - - DGEN - Local manipulation degenerate mode. You access the DGEN option to set wire- - frame local manipulation mode for 3-D devices (device - dependent). This feature is off by default. - - DLIST - With DLIST, you can specify whether screen updates and redraws will be - performed using the ANSYS Display List (off), or the 3-D - device's Display List (on). DLIST is on by default for - Windows systems, but off for Linux. - - DELS - You use DELS to suppress contour display screen overwrites when /NOERASE is - active. This prevents the bleed-through that occurs when you - overlay contour plots. - - TRIS - Triangle strip mode. Tri-stripping provides faster 3-D display capabilities and - is on by default. Some display enhancements, such as - texturing, are adversely affected by tri-stripping. You can - turn off tri-stripping in order to improve these display - functions. Be sure to turn tri-stripping on after the - desired output is obtained. - - key - The following key options apply to Lab = ACCU: - - 0 - (OFF) The accumulation buffer is not accessed. (default) - - 1 - (ON) Access to the buffer is enabled. - - Notes - ----- - ANSYS uses display list animation for its 3-D models. This memory - resident array method interfaces with the OpenGL model information to - allow the program to efficiently pan, zoom, rotate and dynamically - manipulate your model during animation. The logo, legend, contour and - other annotation items are produced in 2-D and will not appear when - /DV3D, ANIM, 0 is in effect. To display these items, use /DV3D, ANIM, - 1. All screen data will be displayed, but manipulation of the model - will not be possible. - """ - command = f"/DV3D,{lab},{key}" - return self.run(command, **kwargs) - - def gcmd( - self, - wn="", - lab1="", - lab2="", - lab3="", - lab4="", - lab5="", - lab6="", - lab7="", - lab8="", - lab9="", - lab10="", - lab11="", - lab12="", - **kwargs, - ): - """Controls the type of element or graph display used for the GPLOT - - APDL Command: /GCMD - command. - - Parameters - ---------- - wn - Window number (or ALL) to which this command applies (defaults to - 1) - - lab1, lab2, lab3, . . . , lab12 - Command labels (for example, PLNSOL,S,X) - - Notes - ----- - This command controls the type of element or graph display that appears - when you issue the GPLOT command when the /GTYPE,,(ELEM or GRPH) entity - type is active. If you have multiple plotting windows enabled, you can - also use /GCMD to select one window when you wish to edit its contents. - - For related information, see the descriptions of the GPLOT and /GTYPE - commands in this manual. - - This command is valid in any processor. - """ - command = f"/GCMD,{wn},{lab1},{lab2},{lab3},{lab4},{lab5},{lab6},{lab7},{lab8},{lab9},{lab10},{lab11},{lab12}" - return self.run(command, **kwargs) - - def gcolumn(self, curve="", string="", **kwargs): - """Allows the user to apply a label to a specified curve. - - APDL Command: /GCOLUMN - - Parameters - ---------- - curve - Curve number on which label will be applied (integer value - between 1 and 10). - - string - Name or designation that will be applied to the curve (8 - characters max). - - Notes - ----- - This command is used for an array parameter plot (a plot created by the - ``*VPLOT`` command). Normally the label for curve 1 is "COL 1", the label - for curve 2 is "COL 2" and so on; the column number is the field - containing the dependent variables for that particular curve. Issuing - /GCOLUMN,CURVE, with no string value specified resets the label to the - original value. - """ - command = f"/GCOLUMN,{curve},{string}" - return self.run(command, **kwargs) - - def gfile(self, size="", **kwargs): - """Specifies the pixel resolution on Z-buffered graphics files. - - APDL Command: /GFILE - - Parameters - ---------- - size - Pixel resolution. Defaults to a pixel resolution of 800. Valid - values are from 256 to 2400. - - Notes - ----- - Defines the pixel resolution on subsequently written graphics files - (Jobname.GRPH) for software Z-buffered displays [/TYPE]. Lowering the - pixel resolution produces a "fuzzier" image; increasing the resolution - produces a "sharper" image but takes a little longer. - - This command is valid in any processor. - """ - command = f"/GFILE,{size}" - return self.run(command, **kwargs) - - def gplot(self, **kwargs): - """Controls general plotting. - - APDL Command: GPLOT - - Notes - ----- - This command displays all entity types as specified via the /GTYPE - command. Only selected entities (NSEL, ESEL, KSEL, LSEL, ASEL, VSEL) - will be displayed. See the descriptions of the /GTYPE and /GCMD - commands for methods of setting the entity types displayed. - - This command is valid in any processor. - """ - command = f"GPLOT," - return self.run(command, **kwargs) - - def graphics(self, key="", **kwargs): - """Defines the type of graphics display. - - APDL Command: /GRAPHICS - - Parameters - ---------- - key - Graphics key: - - FULL - Display all model geometry and results. - - POWER - Activate PowerGraphics (default when GUI is on). - - Notes - ----- - The /GRAPHICS command specifies the type of graphics display. Key = - POWER activates the PowerGraphics capability. PowerGraphics offers - faster plotting than the Key = FULL option, and speeds up element, - results, area, line, and volume displays. PowerGraphics mode (the - default) is automatically invoked when the GUI is accessed. This action - supersedes all prior macros or start up routines (start.ans, - config.ans, etc.). Full graphics mode can be accessed only by issuing - /GRAPHICS, FULL after the GUI is active. - - Results values (both printed and plotted) may differ between the Key = - FULL and Key = POWER options because each option specifies a different - set of data for averaging and display. For Key = FULL, all element and - results values (interior and surface) are included. For Key = POWER, - only element and results values along the model exterior surface are - processed. - - Caution:: : If you have specified one facet per element edge for - PowerGraphics displays (via the /EFACET command or via choices from the - General Postproc or Utility Menus), PowerGraphics does not plot midside - nodes. - - The /EFACET command is only applicable to element type displays. (See - the descriptions of these commands for more information.) - - Maximum values shown in plots can differ from printed maximum values. - This is due to different averaging schemes used for plotted and printed - maximum values. - - PowerGraphics displays do not average at geometric discontinuities. The - printouts in PowerGraphics will, however, provide averaging information - at geometric discontinuities if the models do not contain shell - elements. Carefully inspect the data you obtain at geometric - discontinuities. - - PowerGraphics does not support the following diffusion analysis - results: CONC, CG, DF, EPDI. - - Note:: : In Full Graphics mode, it is possible to deselect an - individual node, select all elements (including the element that - contains that node), and then perform postprocessing calculations on - those elements and have that unselected node not be considered in those - calculations. However, if PowerGraphics is active, postprocessing - always displays based on selected elements. - - PowerGraphics does not support membrane shell elements such as SHELL41, - and these elements using the membrane-stiffness-only option (KEYOPT1) = - 1): SHELL181, SHELL208, and SHELL209. - - Commands that are not supported by PowerGraphics are listed below. - These commands are executed using the Key = FULL option, regardless of - whether PowerGraphics is activated. Only certain options for /CTYPE, - /edge, /ESHAPE, ``*GET``, /PNUM, /PSYMB, SHELL, and ``*VGET`` are not supported - by PowerGraphics. (See the descriptions of these commands for more - information.) - """ - command = f"/GRAPHICS,{key}" - return self.run(command, **kwargs) - - def gresume(self, fname="", ext="", **kwargs): - """Sets graphics settings to the settings on a file. - - APDL Command: /GRESUME - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, - including the characters needed for the directory path). - An unspecified directory path defaults to the working - directory; in this case, you can use all 248 characters - for the file name. - - ext - Filename extension (eight-character maximum). - - Notes - ----- - Causes a file to be read to reset the graphics slash (/) commands as - they were at the last /GSAVE command. - - This command is valid in any processor. - """ - command = f"/GRESUME,{fname},{ext}" - return self.run(command, **kwargs) - - def gsave(self, fname="", ext="", **kwargs): - """Saves graphics settings to a file for later use. - - APDL Command: /GSAVE - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). An unspecified - directory path defaults to the working directory; in this case, you - can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). - - Notes - ----- - This command does not save all graphics settings, but only those that - may be reset by the /RESET command. The database remains untouched. - Use the /GRESUME command to read the file. Repeated use of the /GSAVE - command overwrites the previous data on the file. The following - commands are saved by /GSAVE: - - This command is valid in any processor. - """ - command = f"/GSAVE,{fname},{ext}" - return self.run(command, **kwargs) - - def gtype(self, wn="", label="", key="", **kwargs): - """Controls the entities that the GPLOT command displays. - - APDL Command: /GTYPE - - Parameters - ---------- - wn - Window number (or ALL) to which this command applies (defaults to - 1) - - label - This represents the type of entity to display: - - NODE - Nodes - - ELEM - Elements - - KEYP - Keypoints - - LINE - Lines - - AREA - Areas - - VOLU - Volumes - - GRPH - Graph displays - - key - Switch: - - 0 - Turns the entity type off. - - 1 - Turns the entity type on. - - Notes - ----- - The /GTYPE command controls which entities the GPLOT command displays. - NODE, ELEM, KEYP, LINE, AREA, and VOLU are on by default. When ELEM is - activated, you can control the type of element displayed via the /GCMD - command (which also controls the type of graph display). When the GRPH - entity type is activated, all other entity types are deactivated. - Conversely, when any of the NODE, ELEM, KEYP, LINE, AREA, and VOLU - entity types are active, the GRPH entity type is deactivated. - - The /GTYPE command gives you several options for multi-window layout: - - One window - - Two windows (left and right or top and bottom of the screen) - - Three windows (two at the top and one at the bottom of the screen, or - one top and two bottom windows - - Four windows (two at the top and two at the bottom) - - - - Once you choose a window layout, you can choose one of the following: - multiple plots, replotting, or no redisplay. - - This command is valid in any processor. - """ - command = f"/GTYPE,{wn},{label},{key}" - return self.run(command, **kwargs) - - def image(self, label="", fname="", ext="", **kwargs): - """Allows graphics data to be captured and saved. - - APDL Command: /IMAGE - - Parameters - ---------- - label - Label specifying the operation to be performed: - - CAPTURE - Capture the image from the graphics window to a new window. - - RESTORE - Restore the image from a file to a new window. - - SAVE - Save the contents of the graphic window to a file. - - DELETE - Delete the window that contains the file. - - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). An unspecified - directory path defaults to the working directory; in this case, you - can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). - """ - command = f"/IMAGE,{label},{fname},{ext}" - return self.run(command, **kwargs) - - def jpeg(self, kywrd="", opt="", **kwargs): - """Provides JPEG file export for ANSYS displays. - - APDL Command: JPEG - - Parameters - ---------- - kywrd - Specifies various JPEG file export options. - - QUAL - If Kywrd = QUAL, then OPT is an integer value defining the JPEG quality index - on an arbitrary scale ranging from 1 to 100. The default - value is 75. - - ORIENT - If Kywrd = ORIENT, then OPT will determine the orientation of the entire plot. - OPT can be either Horizontal (default) or Vertical. - - COLOR - If Kywrd = COLOR, then OPT will determine the color depth of the saved file. - OPT can be 0, 1, or 2, corresponding to Black and White, - Grayscale, and Color (default), respectively. - - TMOD - If Kywrd = TMOD, then OPT will determine the text method. OPT can be either 1 - or 0, corresponding to bitmap text (default) or line stroke - text, respectively. - - DEFAULT - If Kywrd = DEFAULT, then all of the default values, for all of the Kywrd - parameters listed above, are active. - - opt - OPT can have the following names or values, depending on the value - for Kywrd (see above). - - 1 to 100 - If Kywrd = QUAL, a value between 1 and 100 will determine the quality index of - the JPEG file. - - Horizontal, Vertical - If Kywrd = ORIENT, the terms Horizontal or Vertical determine the orientation - of the plot. - - 0,1,2 - If Kywrd = COLOR, the numbers 0, 1, and 2 correspond to Black and White, - Grayscale and Color, respectively. - - 1,0 - If Kywrd = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text - (0) fonts will be used - """ - command = f"JPEG,{kywrd},{opt}" - return self.run(command, **kwargs) - - def mrep( - self, - name="", - arg1="", - arg2="", - arg3="", - arg4="", - arg5="", - arg6="", - arg7="", - arg8="", - arg9="", - arg10="", - arg11="", - arg12="", - arg13="", - arg14="", - arg15="", - arg16="", - arg17="", - arg18="", - **kwargs, - ): - """Enables you to reissue the graphics command macro "name" during a - - APDL Command: /MREP - replot or zoom operation. - - Parameters - ---------- - name - The name identifying the macro file or macro block on a macro - library file. The name can contain up to eight characters maximum - and must begin with a letter. - - arg1, arg2, arg3, . . . , arg18 - Values to be passed into the file or block. - - Notes - ----- - This command reissues the graphics command macro "name" during a replot - operation [/REPLOT] or a zoom [/ZOOM] operation. The ANSYS program - passes the command macro arguments to the replot and zoom feature for - use by the graphics macro. You should place the s-MREP command at the - end of the graphics command macro, following the last graphics command - within the macro, to enable the replot or zoom feature. - """ - command = f"/MREP,{name},{arg1},{arg2},{arg3},{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" - return self.run(command, **kwargs) - - def pcopy(self, key="", **kwargs): - """Automatically generates hard copies for HP UNIX work stations. - - APDL Command: /PCOPY - - Parameters - ---------- - key - Copy key: - - 0 - No specification setting for automatic hard copy of display. - - 1 - Set specification for automatic hard copy after each display. - - NOW - (Action) Produce hard copy of current display (KEY is not reset to 1). - - Notes - ----- - Sets automatic hard copy specification. This command is available only - on HP work stations, and only during interactive runs with the /SHOW - specification active (for terminals with hard copy capability). - - This command is valid in any processor. - """ - command = f"/PCOPY,{key}" - return self.run(command, **kwargs) - - def pngr(self, kywrd="", opt="", val="", **kwargs): - """Provides PNG file export for ANSYS displays. - - APDL Command: PNGR - - Parameters - ---------- - kywrd - Specifies various PNG file export options. - - COMP - If Kywrd = COMP, then OPT is either ON or OFF (blank is interpreted as OFF). - This option allows you to turn PNG file compression ON or - OFF. If OPT = ON, then The VAL field is read to determine - the degree of compression. See the VALUE argument for - acceptable compression values. - - ORIENT - If Kywrd = ORIENT, then OPT will determine the orientation of the entire plot. - OPT can be either Horizontal (default) or Vertical. - - COLOR - If Kywrd = COLOR, then OPT will determine the color depth of the saved file. - OPT can be 0, 1, or 2, corresponding to Black and White, - Grayscale, and Color (default), respectively. - - TMOD - If Kywrd = TMOD, then OPT will determine the text method. OPT can be either 1 - or 0, corresponding to bitmap text (default) or line stroke - text, respectively. - - DEFAULT - If Kywrd = DEFAULT, then all of the default values, for all of the Kywrd - parameters listed above, are active. - - STAT - Shows the current status of PNG file export. - - opt - OPT can have the following names or values, depending on the value - for Kywrd (see above). - - ON, OFF - If Kywrd = COMP, the values On and Off control the use of compression. The - degree of compression is determined by VAL - - Horizontal, Vertical - If Kywrd = ORIENT, the terms Horizontal or Vertical determine the orientation - of the plot. - - 0, 1, 2 - If Kywrd = COLOR, the numbers 0, 1, and 2 correspond to Black and White, - Grayscale and Color, respectively. - - 1, 0 - If Kywrd = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text - (0) fonts will be used - - val - VAL is active only when Kywrd = COMP, and determines the degree of - compression applied to the exported file (see above). - - 1 - Apply the default, optimum value for compression. This value represents the - best combination of speed and compression. It varies according - to the release level of the ZLIB compression package. - - 1-9 - Use this value to specify a specific compression level. 1 is the lowest - compression level (fastest) and 9 is the highest compression - level (slowest). - """ - command = f"PNGR,{kywrd},{opt},{val}" - return self.run(command, **kwargs) - - def pscr(self, kywrd="", key="", **kwargs): - """Specifies various PostScript options. - - APDL Command: PSCR - - Parameters - ---------- - index - Color map index (0 to 15, 128 to 255). - - ired - Red intensity (0 to 100). - - igrn - Green intensity (0 to 100). - - iblu - Blue intensity (0 to 100). - - Notes - ----- - This command is available in both the ANSYS and DISPLAY programs. It - is valid for postscript format files chosen in ANSYS with the - /SHOW,PSCR command, or in DISPLAY with /SHOWDISP,POSTSCRIPT. - - An output file is generated for each plot. The ANSYS file is named - JobnameNN.pscr. In the DISPLAY program, this file is named PSCRnn. - This file remains open for a subsequent /NOERASE plot, and will be - incomplete until the program is closed (/EXIT), or until the next file - is opened by the next /ERASE plot request. - - Issuing PSCR,STAT will list paper size, orientation and resolution - modes. - """ - command = f"PSCR,{kywrd},{key}" - return self.run(command, **kwargs) - - def pstatus(self, wn="", **kwargs): - """Displays the global or window display specifications. - - APDL Command: /PSTATUS - - Parameters - ---------- - wn - Window number for status (defaults to global specifications). - - Notes - ----- - Displays the current global or window display specifications. Global - display specifications are common to all windows (e.g. /SHOW, etc.). - Window display specifications are specific to one window (e.g. /VIEW, - /TYPE, etc.). - - This command is valid in any processor. - """ - command = f"/PSTATUS,{wn}" - return self.run(command, **kwargs) - - def replot(self, label="", **kwargs): - """Automatically reissues the last display command for convenience. - - APDL Command: /REPLOT - - Parameters - ---------- - label - Controls the type of replot. - - RESIZE - Issued internally when a graphics window resize occurs (Default). - - FAST - Only applicable for 3-D devices that allow a fast redisplay for changes in the - view characteristics only. - - Notes - ----- - Reissues the last display command (NPLOT, EPLOT, KPLOT, PLNSOL, PLVAR, - etc.), along with its parameters, for convenience. The current display - specifications are used. - - When the last display command is invalid in a particular processor, the - use of the /REPLOT command is also invalid in that processor. However, - if you attempt a /REPLOT and the last display command is invalid in the - current processor, ANSYS produces an element display [EPLOT] instead, - as long as the last display command was PLNSOL, PLESOL, or PLDISP. - ANSYS performs this substitution of /REPLOT with EPLOT for your - convenience. - - For example, the PLNSOL command, which is used to display solution - results as continuous contours, is a valid command in the general - postprocessor [/POST1]. If you issue PLNSOL followed by /REPLOT while - in the general postprocessor, the /REPLOT command effectively reissues - your earlier PLNSOL command, along with its parameters. But if you - then exit the general postprocessor, enter the preprocessor [/PREP7], - and issue the /REPLOT command again, ANSYS internally issues EPLOT - instead. This occurs because PLNSOL is not a valid command in the - preprocessor. - - When you click on one of the buttons on the Pan, Zoom, Rotate dialog - box to manipulate the view of a model, the /REPLOT command is issued - internally. Thus, the substitution of /REPLOT with EPLOT as described - above may occur not only for the PLNSOL, PLESOL, and PLDISP results - display commands, but also for operations that you perform with the - Pan, Zoom, Rotate dialog box. - - /REPLOT will not show boundary conditions if they are only applied to a - solid model and the last display command (for example, EPLOT) displays - the finite element model. To show boundary conditions, the following - options are available: - - Issue /REPLOT after you issue the SBCTRAN command to transfer solid - model boundary conditions to the finite element model. - - Issue /REPLOT after you issue a solid model display command (for - example, VPLOT). - - This command is valid in any processor (except as noted above). - """ - command = f"/REPLOT,{label}" - return self.run(command, **kwargs) - - def slashreset(self, **kwargs): - """Resets display specifications to their initial defaults. - - APDL Command: /RESET - - Notes - ----- - Resets slash display specifications (/WINDOW, /TYPE, /VIEW, etc.) back - to their initial default settings (for convenience). Also resets the - focus location to the geometric center of the object. - - This command is valid in any processor. - """ - command = "/RESET," - return self.run(command, **kwargs) - - def seg(self, label="", aviname="", delay="", **kwargs): - """Allows graphics data to be stored in the local terminal memory. - - APDL Command: /SEG - - Parameters - ---------- - label - Storage key: - - SINGL - Store subsequent display in a single segment (overwrites last storage). - - MULTI - Store subsequent displays in unique segments [ANIM]. - - DELET - Delete all currently stored segments. - - OFF - Stop storing display data in segments. - - STAT - Display segment status. - - PC - This option only applies to PC versions of ANSYS and only when animating via - the AVI movie player (i.e., /DEVICE,ANIM,2). This command - appends frames to the File.AVI, so that the animation goes in - both directions (i.e., forward--backward--forward). You must - have a current animation file to use this option. - - aviname - Name of the animation file that will be created when each frame is - saved. The .AVI extension is applied automatically. Defaults to - Jobname.AVI if no filename is specified. - - delay - Delay factor between each frame, in seconds. Defaults to 0.015 - seconds if no value is specified. - - Notes - ----- - Allows graphics data to be stored in the terminal local memory (device- - dependent). Storage occurs concurrently with the display. - - Although the information from your graphics window is stored as an - individual segment, you cannot plot directly (GPLOT) from the segment - memory. - - For the DISPLAY program, the Aviname and DELAY fields are ignored. - - This command is valid in any processor. - """ - command = f"/SEG,{label},{aviname},{delay}" - return self.run(command, **kwargs) - - def show(self, fname="", option="", vect="", ncpl="", **kwargs): - """Specifies the device and other parameters for graphics displays. - - APDL Command: /SHOW - - Parameters - ---------- - fname - Device name, file name, or keyword, as listed below: - - - Any valid graphics display device name (e.g., X11, 3-D etc.). Defaults to X11 - for most systems. See Getting Started with - Graphics in the Basic Analysis Guide for details. - A device name must be defined before activating the - Graphical User Interface (GUI). Once the GUI is - activated, the device name cannot be changed for - that session, except for switching between X11 and - X11C. - - - Name of graphics file to which graphics displays are to be diverted (248 - characters maximum). Should not be the same as a - valid device name or any other Fname option. Plots are - written to the file Filename.Ext (or just Filename.Ext - if Ext is left blank) in the working directory. This - file can be appended only during the same session; - reissuing the same file name in a new session will - overwrite existing file names from previous sessions. - Although multiple file names can be used within one - session, only the last file created or accessed will - be appended. Issuing /SHOW, CLOSE, or starting a new - session will prevent access to any previously created - files. - - TERM - Graphics displays are switched back to the last-specified device name. - - CLOSE - This option purges the graphics file buffer. The CLOSE option should be issued - any time you are changing graphics devices or file output - types during a session. Graphics displays are switched back - to the last-specified device name, and any open graphics - files are closed. The CLOSE option is similar to the TERM - option, however, with the CLOSE option, another process, - such as the DISPLAY program, can access the data in the - graphics file. The CLOSE option causes graphics file - buffers to be flushed to the graphics file. - - FILE - Graphics displays are switched back to the last-specified file name. - - OFF - Graphics display requests are ignored. - - (blank) - If blank in interactive mode, graphics will be displayed on screen as requested - by display commands (no file written); If blank in batch - mode, graphics data will be written to Jobname.GRPH. - - PSCR - Creates PostScript graphic files that are named Jobnamennn.eps, where nnn is a - numeric value that is incremented by one as each additional - file is created; that is, Jobname000.eps, Jobname001.eps, - Jobname002.eps, and so on . (See the PSCR command for - options.) Ignores the Ext and NCPL fields. - - HPGL - Creates Hewlett-Packard Graphics Language files that are named Jobnamennn.hpgl, - where nnn is a numeric value that is incremented by one as - each additional file is created; that is, Jobname000.hpgl, - Jobname001.hpgl, Jobname002.hpgl, and so on. (See the HPGL - command for options.) Ignores the Ext and NCPL fields. - - HPGL2 - Creates Hewlett-Packard Graphics Language files that are named Jobnamennn.hpgl, - where nn is a numeric value that is incremented by one as - each additional file is created; that is, Jobname000.hpgl, - Jobname001.hpgl, Jobname02.hpgl, and so on. The HPGL2 - files have enhanced color. (See the HPGL command for - options.) Ignores the Ext field. - - JPEG - Creates JPEG files that are named Jobnamennn.jpg, where nnn is a numeric value - that is incremented by one as each additional file is - created; that is, Jobname000.jpg, Jobname001.jpg, - Jobname002.jpg, and so on. Ignores the Ext field. - - TIFF - Creates tagged image format files that are named Jobnamennn.tif, where nnn is a - numeric value that is incremented by one as each additional - file is created; that is, Jobname000.tif, Jobname001.tif, - Jobname002.tif, and so on. This value for the Fname argument - ignores the Ext field. (See the TIFF command for options.) - - PNG - Creates PNG (Portable Network Graphics) files that are named Jobnamennn.png, - where nnn is a numeric value that is incremented by one as - each additional file is created; that is, Jobname000.png, - Jobname001.png, Jobname002.png, and so on. This value for the - Fname argument ignores the Ext field. (See the PNGR command - for options.) - - VRML - Creates Virtual Reality Meta Language files named Jobname000.wrl that can be - displayed on 3-D Internet web browsers. Ignores the Ext and - NCPL fields. - - option - Assign a file name extension or specify reverse video output: - - Ext - File name extension (eight-character maximum). - - REV - Reverse background/image (black/white) colors. Valid with Fname = PNG - (recommended), JPEG, PSCR, TIFF, and HPGL. This option is - ignored if a previously specified color map table (/CMAP or - /RGB) is in effect. - - vect - Specifies raster or vector display mode. This affects area, - volume, and element displays, as well as geometric results displays - such as contour plots. See the /DEVICE command for an alternate - way to toggle between raster and vector mode. Changing VECT also - resets the /TYPE command to its default. - - 0 - Raster display (color filled entities; default) - - 1 - Vector display (outlined entities; i.e., "wireframe") - - ncpl - Sets the number of color planes (4 to 8). Default is device- - dependent. NCPL is not supported by all graphics devices. - - Notes - ----- - Specifies the device to be used for graphics displays, and specifies - other graphics display parameters. Display may be shown at the time of - generation (for interactive runs at a graphics display terminal) or - diverted to a file for later processing with the DISPLAY program. - Issue /PSTATUS for display status. - - Batch runs do not have access to the fonts available on your system. - The Courier and Helvetica font files used for JPEG, PNG and TIFF batch - output are copyrighted by Adobe Systems Inc. and Digital Equipment - Corp. Permission to use these trademarks is hereby granted only in - association with the images described above. Batch run JPEG output is - produced at the default quality index value of 75, unless specified - otherwise. - - Interactive displays default to eight color planes (NCPL = 8) for most - monitors, while graph file output defaults to eight color planes for - VRML output, and four color planes for PSCR, HPGL, HPGL2, JPEG, PNG, - TIFF and FILE33. - - This command is valid in any processor. - """ - command = f"/SHOW,{fname},{option},{vect},{ncpl}" - return self.run(command, **kwargs) - - def tiff(self, kywrd="", opt="", **kwargs): - """Provides TIFF file Export for ANSYS Displays. - - APDL Command: TIFF - - Parameters - ---------- - kywrd - Specifies various TIFF file export options. - - COMP - If Kywrd = COMP, then OPT controls data compression - for the output file. If COMP = 0, then compression - is off. If COMP = 1 (default), then compression is - on. - - ORIENT - If Kywrd = ORIENT, then OPT will determine the - orientation of the entire plot. OPT can be - either Horizontal (default) or Vertical. - - COLOR - If Kywrd = COLOR, then OPT will determine the - color attribute of the saved file. OPT can be 0, - 1, or 2, corresponding to Black and White, - Grayscale, and Color (default), respectively. - - TMOD - If Kywrd = TMOD, then OPT will determine the text - method. OPT can be either 1 or 0, corresponding to - bitmap text (default) or line stroke text, - respectively. - - DEFAULT - If Kywrd = DEFAULT, then all of the default - values, for all of the Kywrd parameters listed - above, are active. - - opt - OPT can have the following names or values, depending on - the value for Kywrd (see above). - - 1 or 0 - If Kywrd = COMP, a value or 1 (on) or 0 (off) - will control compression for the TIFF file. - - Horizontal, Vertical - If Kywrd = ORIENT, the terms - Horizontal or Vertical determine - the orientation of the plot. - - 0, 1, 2 - If Kywrd = COLOR, the numbers 0, 1, and 2 - correspond to Black and White , Grayscale and - Color, respectively. - - 1, 0 - If Kywrd = TMOD, the values 1 and 0 determine - whether bitmap (1) or stroke text (0) fonts will be - used - """ - command = f"TIFF,{kywrd},{opt}" - return self.run(command, **kwargs) - - def window(self, wn="", xmin="", xmax="", ymin="", ymax="", ncopy="", **kwargs): - """Defines the window size on the screen. - - APDL Command: /WINDOW - - Parameters - ---------- - wn - Window reference number (1 to 5). Defaults to 1. This number, or - ALL (for all active windows), may be used on other commands. - - xmin, xmax, ymin, ymax - Screen coordinates defining window size. Screen coordinates are - measured as -1.0 to 1.67 with the origin at the screen center. For - example, (-1,1.67,-1,1) is full screen, (-1,0,-1,0) is the left - bottom quadrant. If XMIN = OFF, deactivate this previously defined - window; if ON, reactivate this previously defined window. If FULL, - LEFT, RIGH, TOP, BOT, LTOP, LBOT, RTOP, RBOT, form full, half, or - quarter window. If SQUA, form largest square window within the - current graphics area. If DELE, delete this window (cannot be - reactivated with ON). - - ncopy - Copies the current specifications from window NCOPY (1 to 5) to - this window. If NCOPY = 0 (or blank), no specifications are - copied. - - Notes - ----- - Defines the window size on the screen. Windows may occupy a separate - section of the screen or they may overlap. Requested displays are - formed in all windows according to the selected window specifications. - - This command is valid in any processor. - """ - command = f"/WINDOW,{wn},{xmin},{xmax},{ymin},{ymax},{ncopy}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/style.py b/src/ansys/mapdl/core/_commands/graphics_/style.py deleted file mode 100644 index e2ad27d1da2..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/style.py +++ /dev/null @@ -1,729 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from typing import Optional, Union -import warnings - -from ansys.mapdl.core.mapdl_types import MapdlInt - - -class Style: - def cplane(self, key="", **kwargs): - """Specifies the cutting plane for section and capped displays. - - APDL Command: /CPLANE - - Parameters - ---------- - key - Specifies the cutting plane: - - 0 - Cutting plane is normal to the viewing vector [/VIEW] and passes through the - focus point [/FOCUS] (default). - - 1 - The working plane [WPLANE] is the cutting plane. - - Notes - ----- - Defines the cutting plane to be used for section and capped displays - [/TYPE,,(1, 5, or 7)]. - - This command is valid in any processor. - """ - command = f"/CPLANE,{key}" - return self.run(command, **kwargs) - - def ctype(self, key="", dotd="", dots="", dshp="", tlen="", **kwargs): - """Specifies the type of contour display. - - APDL Command: /CTYPE - - Parameters - ---------- - key - Type of display: - - 0 - Standard contour display. - - 1 - Isosurface display. - - 2 - Particle gradient display. - - 3 - Gradient triad display. - - dotd - Maximum dot density for particle gradient display (KEY = 2). - Density is expressed as dots per screen width (defaults to 30). - - dots - Dot size for particle gradient display (KEY = 2). Size is - expressed as a fraction of the screen width (defaults to 0.0 - (single dot width)). - - dshp - Spherical dot shape precision for particle gradient display (KEY = - 2). (3-D options are supported only on 3-D devices): - - 0 - Flat 2-D circular dot. - - 1 - Flat-sided 3-D polyhedron. - - n - 3-D sphere with n (>1) polygon divisions per 90° of radius. - - tlen - Maximum length of triads for gradient triad display (KEY = 3). - Value is expressed as a fraction of the screen width (defaults to - 0.067). - - Notes - ----- - Use /CTYPE,STAT to display the current settings. Only the standard - contour display [/CTYPE,0) and the isosurface contour display - [/CTYPE,1] are supported by PowerGraphics [/GRAPHICS,POWER]. - - This command is valid in any processor. - """ - command = f"/CTYPE,{key},{dotd},{dots},{dshp},{tlen}" - return self.run(command, **kwargs) - - def edge(self, wn="", key="", angle="", **kwargs): - """Displays only the common lines ("edges") of an object. - - APDL Command: /EDGE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies. The default window - is 1. - - key - Edge key: - - 0 - Display common lines between all adjacent element faces. - - 1 - Display only the common lines between non-coplanar faces (that is, show only - the edges). - - angle - Largest angle between two faces for which the faces are considered - to be coplanar (0° to 180°). Defaults to 45°. A smaller angle - produces more edges, a larger angle produces fewer edges. - - Notes - ----- - The ANGLE field is used in PowerGraphics to determine geometric - discontinuities. It is a tolerance measure for the differences between - the normals of the surfaces being considered. Values within the - tolerance are accepted as coplanar (geometrically continuous). In - postprocessing displays, results are not averaged across discontinuous - surfaces. - - A surface can be displayed as an edge outline without interior detail. - This is useful for both geometry and postprocessing displays. Element - outlines are normally shown as solid lines for geometry and - displacement displays. Lines common to adjacent "coplanar" element - faces are removed from the display. Midside nodes of elements are - ignored. - - The /SHRINK option is ignored with the edge option. - - /EDGE is not supported for PLESOL and /ESHAPE displays when in - PowerGraphics mode (/GRAPHICS,POWER). - - The /EDGE command is valid in any processor. - """ - command = f"/EDGE,{wn},{key},{angle}" - return self.run(command, **kwargs) - - def eshape( - self, scale: Union[str, int] = "", key: MapdlInt = "", **kwargs - ) -> Optional[str]: - """Displays elements with shapes determined from the real constants or section definition. - - APDL Command: /ESHAPE - - - Parameters - ---------- - scale - Scaling factor: - - * 0 - Use simple display of line and area elements. This - value is the default. - - * 1 - Use real constants or section definition to form a - solid shape display of the applicable elements. - - FAC - Multiply certain real constants, such as thickness, - by FAC (where FAC > 0.01) and use them to form a - solid shape display of elements. - - key - Current shell thickness key: - - * 0 - Use current thickness in the displaced solid shape - display of shell elements (valid for SHELL181, - SHELL208, SHELL209, and SHELL281). This value is the - default. - - * 1 - Use initial thickness in the displaced solid shape - display of shell elements. - - Notes - ----- - The /ESHAPE command allows beams, shells, current sources, and - certain special-purpose elements to be displayed as solids - with the shape determined from the real constants or section - types. Elements are displayed via the EPLOT command. No checks - for valid or complete input are made for the display. - - Following are details about using this command with various - element types: - - SOLID65 elements are displayed with internal lines that - represent rebar sizes and orientations (requires vector mode - [/DEVICE] with a basic type of display [/TYPE,,BASIC]). The - rebar with the largest volume ratio in each element plots as a - red line, the next largest as green, and the smallest as blue. - - COMBIN14, COMBIN39, and MASS21 are displayed with a graphics - icon, with the offset determined by the real constants and - KEYOPT settings. - - BEAM188, BEAM189, PIPE288, PIPE289 and ELBOW290 are displayed - as solids with the shape determined via the section-definition - commands (SECTYPE and SECDATA). The arbitrary section option - (Subtype = ASEC) has no definite shape and appears as a thin - rectangle to show orientation. The elements are displayed with - internal lines representing the cross- section mesh. - - SOLID272 and SOLID273 are displayed as solids with the shape - determined via the section-definition commands (SECTYPE and - SECDATA). The 2-D master plane is revolved around the - prescribed axis of symmetry. - - Contour plots are available for these elements in - postprocessing for PowerGraphics only (/GRAPHICS,POWER). To - view 3-D deformed shapes for the elements, issue OUTRES,MISC - or OUTRES,ALL for static or transient analyses. To view 3-D - mode shapes for a modal or eigenvalue buckling analysis, - expand the modes with element results calculation ON (Elcalc = - YES for MXPAND). - - SOURC36, CIRCU124, and TRANS126 elements always plot using - /ESHAPE when PowerGraphics is activated (/GRAPHICS,POWER). - - In most cases, /ESHAPE renders a thickness representation of - your shell, plane and layered elements more readily in - PowerGraphics (/GRAPHICS,POWER). This type of representation - employs PowerGraphics to generate the enhanced representation, - and will often provide no enhancement in Full Graphics - (/GRAPHICS,FULL). This is especially true for POST1 results - displays, where /ESHAPE is not supported for most element - types with FULL graphics. - - When PowerGraphics is active, /ESHAPE may degrade the image if - adjacent elements have overlapping material, such as shell - elements which are not co-planar. Additionally, if adjacent - elements have different thicknesses, the polygons depicting - the connectivity between the "thicker" and "thinner" elements - along the shared element edges may not always be displayed. - - For POST1 results displays (such as PLNSOL), the following - limitations apply: - - Rotational displacements for beam elements are used to create - a more realistic displacement display. When /ESHAPE is active, - displacement plots (via PLNSOL,U,X and PLDISP, for example) - may disagree with your PRNSOL listings. This discrepancy will - become more noticeable when the SCALE value is not equal to - one. - - When shell elements are not co-planar, the resulting PLNSOL - display with /ESHAPE will actually be a PLESOL display as the - non-coincident pseudo-nodes are not averaged. Additionally, - /ESHAPE should not be used with coincident elements because - the plot may incorrectly average the displacements of the - coincident elements. - - When nodes are initially coincident and PowerGraphics is - active, duplicate polygons are eliminated to conserve display - time and disk space. The command may degrade the image if - initially coincident nodes have different displacements. The - tolerance for determining coincidence is 1E-9 times the - model’s bounding box diagonal. - - If you want to view solution results (PLNSOL, etc.) on layered - elements (such as SHELL181, SOLSH190, SOLID185 Layered Solid, - SOLID186 Layered Solid, SHELL208, SHELL209, SHELL281, and - ELBOW290), set KEYOPT(8) = 1 for the layer elements so that - the data for all layers is stored in the results file. - - You can plot the through-thickness temperatures of elements - SHELL131 and SHELL132 regardless of the thermal DOFs in use by - issuing the PLNSOL,TEMP command (with PowerGraphics and - /ESHAPE active). - - The /ESHAPE,1 and /ESHAPE,FAC commands are incompatible with - the /CYCEXPAND command used in cyclic symmetry analyses. - - This command is valid in any processor. - - """ - warnings.warn( - "pymapdl does not support /ESHAPE when plotting in " - "Python using ``mapdl.eplot()``. " - "Use ``mapdl.eplot(vtk=False)`` " - ) - command = f"/ESHAPE,{scale},{key}" - return self.run(command, **kwargs) - - def facet(self, lab="", **kwargs): - """Specifies the facet representation used to form solid model displays. - - APDL Command: /FACET - - Parameters - ---------- - lab - Valid labels: - - FINE - Use finer tessellation to increase the number of facets for the display. - Provides the best representation (but decreases speed of - operation). - - NORML - Use the basic number of facets for the display (default). - - COAR - Use a limited number of facets for the display. This option will increase the - speed of the operations, but may produce poor - representations for some imported models. - - WIRE - Display model with a wireframe representation (fast, but surfaces will not be - shown). - - Notes - ----- - Specifies the facet (or polygon) representation used to form solid - model displays. Used only with the APLOT, ASUM, VPLOT, and VSUM - commands. - - This command is valid in any processor. - """ - command = f"/FACET,{lab}" - return self.run(command, **kwargs) - - def gline(self, wn="", style="", **kwargs): - """Specifies the element outline style. - - APDL Command: /GLINE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - style - Outline key: - - 0 - Solid element outlines (default) - - 1 - Dashed element outlines - - -1 - No element outlines - - Notes - ----- - Determines the element outline style. Often used when node numbers are - displayed to prevent element lines from overwriting node numbers. - - Unless you are using an OpenGL or Starbase driver, the dashed element - outline option (/GLINE,WN,1) is not available in the following - situations: - - Z-buffered displays (/TYPE,WN,6). - - Capped Z-buffered displays (/TYPE,WN,7). - - Qslice Z-buffered displays (/TYPE,WN,8). - - This command is valid in any processor. - """ - command = f"/GLINE,{wn},{style}" - return self.run(command, **kwargs) - - def gmarker(self, curve="", key="", incr="", **kwargs): - """Specifies the curve marking style. - - APDL Command: /GMARKER - - Parameters - ---------- - curve - Curve number markers will be applied on (integer value between 1 - and 10). - - key - Marker key: - - 0 - No markers will be applied (default). - - 1 - TRIANGLES will be applied. - - 2 - SQUARES will be applied. - - 3 - DIAMONDS will be applied. - - 4 - CROSSES will be applied. - - incr - Determines the curve marking frequency. (a whole number value - between 1 and 255). If INCR = 1, markers are displayed at every - data point on the curve. If INCR = 2 then markers are displayed at - every second data point. If INCR = 3 then they are displayed at - every third data point. - - Notes - ----- - The user-specified markers will not be drawn when the area under the - curve is color-filled (/GROPT, FILL). - """ - command = f"/GMARKER,{curve},{key},{incr}" - return self.run(command, **kwargs) - - def gmface(self, lab="", n="", **kwargs): - """Specifies the facet representation used to form solid models. - - APDL Command: GMFACE - - Parameters - ---------- - lab - Valid Labels: - - FINE - Value that determines how coarse the facets will be. - - n - An integer value between one (small) and ten (large) that - determines the tolerances that will be applied to the creation of - arcs and surfaces. Ten will create many facets, which may in turn - cause ANSYS to run very slowly. One will create fewer facets, which - may in turn cause larger tolerance errors. - """ - command = f"GMFACE,{lab},{n}" - return self.run(command, **kwargs) - - def light(self, wn="", num="", int_="", xv="", yv="", zv="", refl="", **kwargs): - """Specifies the light direction for the display window. - - APDL Command: /LIGHT - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - num - Ambient or directional light key: - - 0 - Ambient light (default). - - 1 - Directional light. - - int\\_ - Light intensity factor (defaults to 0.3 for ambient, 1.0 for - directional). This option is valid only for 3-D devices). - - xv, yv, zv - Light direction (valid only for NUM = 1). The directional light - source is parallel to the line from point XV, YV, ZV to the origin, - in the global Cartesian system origin. Defaults to the viewing - direction [/VIEW]. - - refl - Light reflectance factor (valid only for NUM = 1 and 3-D devices). - - Notes - ----- - Defines the light direction for the window. Use this command only with - 3-D graphics devices or 2-D devices when Z-buffering is used [/TYPE,,(6 - or 7)]. The ambient light has no direction, only an intensity. You - can position the directional light source by defining a point (in the - global Cartesian coordinate system) representing a point along the - light directional line. This point, and the global Cartesian - coordinate system origin, define the line along which the light is - positioned looking toward the origin. You can use any point along the - light line; for example, both (1.,1.,1.) and (2.,2.,2.) give the same - light effect. For 3-D graphics devices only, the directional light - source also has intensity and reflectance factors. - - By choosing the highest intensity ambient light for 3-D graphics - devices (via the command /LIGHT,WN,0,1), you can nullify color shading - and other effects of directional lighting. - - This command is valid in any processor. - """ - command = f"/LIGHT,{wn},{num},{int_},{xv},{yv},{zv},{refl}" - return self.run(command, **kwargs) - - def normal(self, wn="", key="", **kwargs): - """Allows displaying area elements by top or bottom faces. - - APDL Command: /NORMAL - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - key - Display key: - - 0 - No face distinction. - - 1 - Show only area elements having their positive normals directed toward the - viewing point. - - -1 - Show only area elements having their positive normals directed away from the - viewing point. - - Notes - ----- - /NORMAL allows you to select area elements and area plots by the top or - bottom faces. It is useful for checking the normal directions on shell - elements. The positive normal (element Z direction) is defined by the - right-hand rule following the node I, J, K, L input direction. This - command is available only with raster or hidden-line displays, for - WIN32 or X11 2-D displays only. - - This command is valid in any processor. - """ - command = f"/NORMAL,{wn},{key}" - return self.run(command, **kwargs) - - def shade(self, wn="", type_="", **kwargs): - """Defines the type of surface shading used with Z-buffering. - - APDL Command: /SHADE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - type\\_ - Shading type: - - FACET or 0 - Facet shading (one color per area face) (default). - - GOURAUD or 1 - Gouraud smooth shading (smooth variation of color based on interpolated vertex - colors). - - PHONG or 2 - Phong smooth shading (smooth variation of color based on interpolated vertex - normals). - - Notes - ----- - Defines the type of surface shading used on area, volume, and - PowerGraphics [/GRAPHICS,POWER] displays when software Z-buffering is - enabled [/TYPE]. This command is only functional for 2-D display - devices. - - This command is valid in any processor. - """ - command = f"/SHADE,{wn},{type_}" - return self.run(command, **kwargs) - - def slashtype(self, wn="", type_="", **kwargs): - """Defines the type of display. - - APDL Command: /TYPE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - type_ - Display type. Defaults to `ZBUF` for raster mode displays or `BASIC` - for vector mode displays: - - BASIC or 0 - Basic display (no hidden or section operations). - - SECT or 1 - Section display (plane view). Use the `/CPLANE` command to - define the cutting plane. - - HIDC or 2 - Centroid hidden display (based on item centroid sort). - - HIDD or 3 - Face hidden display (based on face centroid sort). - - HIDP or 4 - Precise hidden display (like `HIDD` but with more precise checking). - Because all facets are sorted, this mode can be extremely slow, - especially for large models. - - CAP or 5 - Capped hidden display (same as combined `SECT` and `HIDD` with - model in front of section plane removed). - - ZBUF or 6 - Z-buffered display (like `HIDD` but using software Z-buffering). - - ZCAP or 7 - Capped Z-buffered display (same as combined `SECT` and `ZBUF` - with model in front of section plane removed). - - ZQSL or 8 - `QSLICE` Z-buffered display (same as `SECT` but the edge lines - of the remaining 3D model are shown). - - HQSL or 9 - `QSLICE` precise hidden display (like `ZQSL` but using precise hidden). - - Notes - ----- - **Command Default:** `ZBUF` for raster mode displays; `BASIC` for vector - mode displays. - - Defines the type of display, such as section display or hidden-line - display. Use the `/DEVICE` command to specify either raster or - vector mode. - - The `SECT`, `CAP`, `ZCAP`, `ZQSL`, and `HQSL` options produce section - displays. The section or "cutting" plane is specified on the `/CPLANE ` - command as either normal to the viewing vector at the focus point - (default), or as the working plane. - - When you use PowerGraphics, the section display options (`Section`, - `Slice`, and `Capped`) use different averaging techniques for the - interior and exterior results. Because of the different averaging - schemes, anomalies may appear at the transition areas. In many cases, - the automatically computed `MIN` and `MAX` values will differ from the - full range of interior values. You can lessen the effect of these - anomalies by issuing` AVRES,,FULL` (Main Menu> General Post Proc> - Options for Outp). This command sets your legend's automatic contour - interval range according to the minimum and maximum results found - throughout the entire model. - - With PowerGraphics active (`/GRAPHICS,POWER`), the averaging scheme for - surface data with interior element data included (`AVRES,,FULL`) and - multiple facets per edge (`/EFACET,2` or `/EFACET,4`) will yield - differing minimum and maximum contour values depending on the Z- - Buffering options (`/TYPE,,6` or `/TYPE,,7`). When the Section data is - not included in the averaging schemes (`/TYPE,,7`), the resulting - absolute value for the midside node is significantly smaller. - - The `HIDC`, `HIDD`, `HIDP`, `ZBUF`, `ZQSL`, and `HQSL` options produce - displays with "hidden" lines removed. Hidden lines are lines obscured - from view by another element, area, etc. The choice of non-Z-buffered - hidden-line procedure types is available only for raster mode - (`/DEVICE`) displays. For vector mode displays, all non-Z-buffered - "hidden-line" options use the same procedure (which is slightly - different from the raster procedures). Both geometry and postprocessing - displays may be of the hidden- line type. Interior stress contour lines - within solid elements can also be removed as hidden lines, leaving only - the stress contour lines and element outlines on the visible surfaces. - Midside nodes of elements are ignored on postprocessing displays. - Overlapping elements will not be displayed. - - The `ZBUF`, `ZCAP`, and `ZQSL` options use a specific hidden-line - technique called software Z-buffering. This technique allows a more - accurate display of overlapping surfaces (common when using Boolean - operations or `/ESHAPE` on element displays), and allows smooth shaded - displays on all interactive graphics displays. Z-buffered displays can - be performed faster than `HIDP` and `CAP` type displays for large - models. See also the `/LIGHT`, `/SHADE`, and `/GFILE` commands for - additional options when Z-buffering is used. - - This command is valid in any processor. - """ - command = f"/TYPE,{wn},{type_}" - return self.run(command, **kwargs) - - def trlcy(self, lab="", tlevel="", n1="", n2="", ninc="", **kwargs): - """Specifies the level of translucency. - - APDL Command: /TRLCY - - Parameters - ---------- - lab - Apply translucency level to the items specified by the following - labels: - - ELEM - Elements. Use N1, N2, NINC fields for element numbers. - - AREA - Solid model areas. Use N1, N2, NINC fields for area numbers. - - VOLU - Solid model volumes. Use N1, N2, NINC fields for volume numbers. - - ISURF - Isosurfaces (surfaces of constant stress, etc., value). Translucency varies - with result value, to a maximum of the specified - translucency level. - - CM - Component group. Use N1 for component name, ignore N2 and NINC. - - CURVE - Filled areas under curves of line graphs. Use N1, N2, NINC fields for curve - numbers. - - ZCAP - If /TYPE,WN,ZCAP is the current display type, then /TRLCY,ZCAP,TLEVEL will - display the model in window WN with the portion of the model - in front of the section plane displayed at the translucency - level TLEVEL. - - ON, OFF - Sets the specified translucency display on or off. All other fields are - ignored. - - tlevel - Translucency level: 0.0 (opaque) to 1.0 (transparent). - - n1, n2, ninc - Used only with labels as noted above. Apply translucency level to - Lab items numbered N1 to N2 (defaults to N1) in steps of NINC - (defaults to 1). If N1 is blank or ALL, apply specified - translucency level to entire selected range. If Lab is CM, use - component name for N1 and ignore N2 and NINC. A value of N1 = P - allows you to graphically pick elements, areas, and volumes. You - can then assign translucency levels to the entities via the picker. - The Lab and TLEVEL fields are ignored when translucency is applied - by picking. - - Notes - ----- - Specifies the level of translucency for various items. Issue - /TRLCY,DEFA to reset the default (0) translucency levels. This command - is valid only on selected 2-D and 3-D graphics devices; see in the - Basic Analysis Guide for more information on applying translucency. - - For 2-D devices, ANSYS displays only the visible faces of the items - being displayed. The information behind the facing planes is not - displayed. Issuing the /SHRINK command will force the hardware to - display information behind the translucent items. - - This command is valid in any processor. - """ - command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics_/views.py b/src/ansys/mapdl/core/_commands/graphics_/views.py deleted file mode 100644 index fd1e1a3dfe7..00000000000 --- a/src/ansys/mapdl/core/_commands/graphics_/views.py +++ /dev/null @@ -1,457 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Views: - def angle(self, wn="", theta="", axis="", kincr="", **kwargs): - """Rotates the display about an axis. - - APDL Command: /ANGLE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - theta - Angle (degrees) for changing display orientation (positive, - counterclockwise about specified axis). - - axis - Rotation axis: XS, YS, or ZS (default) for the screen axes; XM, - YM, or ZM for the global Cartesian model axes. ZS is normal to the - screen; all axes pass through the focus point. - - kincr - Cumulative rotation key: - - 0 - Do not use cumulative successive rotations. - - 1 - Use cumulative rotations. Rotations are relative to the previous rotation. - View settings (/VIEW) are recalculated. - - Notes - ----- - Default orientation is YS vertical. When the /XFRM command is set for - rotation about two points, or for entities, the /ANGLE command is - functional only for Axis = ZS or ZM and KINCR = 1. - - This command is valid in any processor. - """ - command = f"/ANGLE,{wn},{theta},{axis},{kincr}" - return self.run(command, **kwargs) - - def auto(self, wn="", **kwargs): - """Resets the focus and distance specifications to "automatically - - APDL Command: /AUTO - calculated." - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - Notes - ----- - Focus point and distance will be automatically calculated during next - display. Settings may still be changed with the /FOCUS and /DIST - commands after this command has been issued. See also the /USER - command. - - This command is valid in any processor. - """ - command = f"/AUTO,{wn}" - return self.run(command, **kwargs) - - def dist(self, wn="", dval="", kfact="", **kwargs): - """Specifies the viewing distance for magnifications and perspective. - - APDL Command: /DIST - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - dval - Distance along the view line from the observer to the focus point - (defaults to value producing full-window display). Distances "too - close" to the object will produce excessive magnifications. If - DVAL = AUTO, zero, or blank, the program will calculate the - distance automatically. If DVAL = USER, the distance of last - display will be used (useful when last display automatically - calculated distance). - - kfact - DVAL interpretation key: - - 0 - Interpret numerical DVAL values as described above. - - 1 - Interpret DVAL as a multiplier on the current distance (DVAL of 2 gives twice - the current distance; 0.5 gives half the current distance, - etc.). - - Notes - ----- - The scale factor is relative to the window shape. For example, for - objects centered in a square window and with parallel projection (no - perspective), a distance of : /2 (+10%) produces a full window - magnification, where : is the largest in-plane vertical or horizontal - dimension. See also /AUTO and /USER commands. - - This command is valid in any processor. - """ - command = f"/DIST,{wn},{dval},{kfact}" - return self.run(command, **kwargs) - - def focus(self, wn="", xf="", yf="", zf="", ktrans="", **kwargs): - """Specifies the focus point (center of the window). - - APDL Command: /FOCUS - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - xf, yf, zf - Location of the object to be at the focus point (center of the - window) in the global Cartesian coordinate system. If XF = AUTO, - allow automatic location calculation. If XF = USER, use focus - location of last display (useful when last display had auto focus). - - ktrans - Translate key: - - 0 - Interpret numerical XF, YF, ZF values as described above. - - 1 - Interpret XF, YF, ZF values as multiples of half-screens to translate from the - current position in the screen coordinate system. Example: XF - of 2.4 translates the display approximately 2.4 half-screens to - the left in the screen X (horizontal) direction. - - 2 - Interpret XF, YF, ZF values as multiples of half-screens to translate from the - current position in the global Cartesian coordinate system. - Example: XF of 1.5 translates the display approximately 1.5 - half-screens in the global Cartesian X direction of the model. - - Notes - ----- - Specifies the location on (or off) the model which is to be located at - the focus point (center of the window). For section and capped - displays, the cutting plane is also assumed to pass through this - location (unless the working plane is used via /CPLANE). See also - /AUTO and /USER commands. - - This command is valid in any processor. - """ - command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" - return self.run(command, **kwargs) - - def user(self, wn="", **kwargs): - """Conveniently resets /FOCUS and /DIST to USER. - - APDL Command: /USER - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - Notes - ----- - Conveniently resets scale parameters to USER on the /FOCUS and /DIST - commands. Scale parameters will be internally respecified to those - used for the last display. Convenient when the last scale parameters - were automatically calculated. User specified parameters hold until - changed or removed [/AUTO]. Parameters may be reset on the individual - commands after this command has been issued. - - This command is valid in any processor. - """ - command = f"/USER,{wn}" - return self.run(command, **kwargs) - - def vcone(self, wn="", phi="", **kwargs): - """Defines the view cone angle for perspective displays. - - APDL Command: /VCONE - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - phi - View cone angle (0.0 to 85.°) to define perspective. Use PHI = - 45.0° for typical perspective. Increase angle for more - perspective, decrease angle for less. If the distance [/DIST] is - not specified, it will be automatically calculated to give full - window magnification. If the distance is also specified, PHI - controls both the perspective and the magnification. The larger - the angle, the more the perspective and the less the magnification. - Defaults to 0.0 (no perspective). - - Notes - ----- - Perspective shows the true depth of the object in the display. A - variable magnification results since the back plane of the object is - further from the observer than the front plane. The largest - magnification occurs at the front plane. With perspective, the - magnification factor (MAGF) is not only a function of the distance from - the object, but also the window shape and the perspective (or view - cone) angle: Φ as follows: - - where , for square windows, is the largest in-plane vertical or - horizontal dimension, d is the distance from the observer to the plane - of: (usually the front plane of the object), and: Φ is the view cone - angle (defined with the /VCONE command). The bigger the cone angle, - the more the perspective. The magnification factor proportionally - decreases with increasing: Φ. The distance can be defined with the - /DIST or the /FOCUS command. Note, the distance input on the /DIST - command is equal to d only if the focus point is located on the plane - of : . It is recommended that if a general perspective is desired - (i.e., not any specific cone angle), use Φ = 45.0 (since TAN(45.0) = - 1.0) and let the d value be automatically calculated for full window - magnification. - - Note that any number of /DIST, /FOCUS, and /VCONE combinations can be - used to produce the same magnification. Distances less than the object - depth will produce views from within the object. - - A magnification factor of 1.0 just fills the window. If the automatic - scaling option is used [/AUTO], the magnification factor is fixed at - 0.91 (to allow a 10% margin around the object) and d is automatically - calculated for the given /VCONE and /FOCUS values. Any value of Φ - between 0.0 and 85.0 (usually 45.0) may be used to activate the - perspective. Views from inside the object are not possible when d is - automatically calculated (use manual scaling [/USER] along with /DIST - specification). - - This command is valid in any processor. - """ - command = f"/VCONE,{wn},{phi}" - return self.run(command, **kwargs) - - def view(self, wn="", xv="", yv="", zv="", **kwargs): - """Defines the viewing direction for the display. - - APDL Command: /VIEW - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - xv, yv, zv - The object is viewed along the line from point XV,YV,ZV (in the - global coordinate system) to the global coordinate system origin. - For section displays, the cutting plane is assumed to be - perpendicular to this line. If XV = WP, modify view to be normal - to the currently defined working plane. Defaults to (0,0,1). - - Notes - ----- - The view line is always normal to the screen. The view is selected by - defining a point (in the global Cartesian coordinate system) - representing a point along the viewing line. This point, and the - global Cartesian coordinate system origin, define the line along which - the object is viewed while looking toward the origin. Any point along - the view line may be used, i.e., (1,1,1) and (2,2,2) give the same - view. The display orientation may be changed as desired [/ANGLE]. The - display coordinate system type may be changed (from Cartesian to - cylindrical, spherical, toroidal, etc.) with the DSYS command. - - This command is valid in any processor. - """ - command = f"/VIEW,{wn},{xv},{yv},{zv}" - return self.run(command, **kwargs) - - def vup(self, wn="", label="", **kwargs): - """Specifies the global Cartesian coordinate system reference orientation. - - APDL Command: /VUP - - Parameters - ---------- - wn - Window number (or ALL) to which command applies (defaults to 1). - - label - Orientation: - - * ``Y`` : Y vertical upward, X horizontal to the right, Z - out from the screen (default). - * ``-Y`` : Y vertical downward, X horizontal to the left, - Z out from the screen. - * ``X`` : X vertical upward, Y horizontal to the left, Z - out from the screen. - * ``-X`` : X vertical downward, Y horizontal to the right, - Z out from the screen. - * ``Z`` : Z vertical upward, Y horizontal to the right, X - out from the screen. With this choice, you should use a - view other than the /VIEW default of (0,0,1). - * ``-Z`` : Z vertical downward, Y horizontal to the left, - X out from the screen. With this choice, you should use - a view other than the /VIEW default of (0,0,1). - - Notes - ----- - Specifies the global Cartesian coordinate system reference orientation. - The /VIEW and /ANGLE commands may be used to reorient the view and are - relative to this reference orientation. All coordinate systems are - right-handed. - - This command is valid in any processor. - """ - command = f"/VUP,{wn},{label}" - return self.run(command, **kwargs) - - def xfrm(self, lab="", x1="", y1="", z1="", x2="", y2="", z2="", **kwargs): - """Controls the centroid or the axis of dynamic rotation. - - APDL Command: /XFRM - - Parameters - ---------- - lab - The location or entity (centroid) used to define the center or axis - of rotation. - - NODE - If NODE is chosen for the center of rotation, the node number will be X1. If - the rotation is to be about an axis, then X1 and Y1 define - the two nodes between which a line is drawn to determine the - axis. The remaining arguments are ignored. - - ELEMENT - If ELEMENT is chosen for the center of rotation, the element number will be X1. - If the rotation is to be about an axis, then X1 and Y1 - define the two elements between which a line is drawn to - determine the axis. The remaining arguments are ignored. - - KP - If KP is chosen for the center of rotation, the keypoint number will be X1. If - the rotation is to be about an axis, then X1 and Y1 define the - two keypoints between which a line is drawn to determine the - axis. The remaining arguments are ignored. - - LINE - If LINE is chosen for the center of rotation, the line number will be X1. If - the rotation is to be about an axis, then X1 and Y1 define - the two lines between which a line is drawn to determine the - axis. The remaining arguments are ignored. - - AREA - If AREA is chosen for the center of rotation, the area number will be X1. If - the rotation is to be about an axis, then X1 and Y1 define - the two areas between which a line is drawn to determine the - axis. The remaining arguments are ignored. - - VOLUME - If VOLUME is chosen for the center of rotation, the volume number will be X1. - If the rotation is to be about an axis, then X1 and Y1 - define the two volumes between which a line is drawn to - determine the axis. The remaining arguments are ignored. - - XYZ - If XYZ is chosen for the center of rotation, the location of that center is - determined by the coordinates X1, Y1, Z1. If values are - specified for X2, Y2, Z2, then the axis of rotation will be - about the line between those two points. - - OFF - If LAB = OFF, DEFAULT, FOCUS or if no value is specified, then the center of - rotation is set at the FOCUS point, as defined by the /FOCUS - command. - - x1 - The entity number or X coordinate for the center of rotation. - - y1 - The entity number or Y coordinate for the center of rotation. - - z1 - The Z coordinate for the center of rotation. - - x2 - The X coordinate for the axis of rotation. - - y2 - The Y coordinate for the axis of rotation. - - z2 - The Z coordinate for the axis of rotation. - - Notes - ----- - The /XFRM command is active only when the cumulative rotation key is - specified ON for the /ANGLE command (KINCR = 1). This command affects - dynamic manipulations only. - - For center rotation, the middle mouse button will rotate the model - about the screen Z axis and the right mouse button will rotate the - model about the screen X and Y axis. - - For rotation about an axis, the middle mouse button will rotate the - model about the defined axis of rotation and the right mouse button - will be deactivated. - - This command is valid in any processor. - """ - command = f"/XFRM,{lab},{x1},{y1},{z1},{x2},{y2},{z2}" - return self.run(command, **kwargs) - - def zoom(self, wn="", lab="", x1="", y1="", x2="", y2="", **kwargs): - """Zooms a region of a display window. - - APDL Command: /ZOOM - - Parameters - ---------- - wn - Window number to which command applies (defaults to 1). - - lab - Label to define the desired type of zoom: - - OFF - Turns zoom off (refits image of entire model to the window). - - BACK - Goes back to previous zoom setting (five successive back ups, maximum). - - SCRN - Interprets X1,Y1 as the screen coordinates of the center of a square zoom - region; X2,Y2 as the screen coordinates of a point on one - side of that square. - - RECT - Interprets X1,Y1 and X2,Y2 as the screen coordinates of two opposite corners of - a rectangular zoom region. - - Notes - ----- - Zooms (centers and magnifies) the specified region of a display window. - /ZOOM will operate on a display that has been formed by an explicit - graphics action command (APLOT, EPLOT, etc.). /ZOOM has no effect on - an "immediate" graphics display. When /ZOOM is executed, the display - is automatically replotted such that the specified zoom region is - centered and sized to fill the window. - - Auto resizing is disabled when you issue the /ZOOM command. To restore - auto resizing, issue the /AUTO command, or select FIT from the Pan, - Zoom, Rotate box. - - This command is valid in any processor. - """ - command = f"/ZOOM,{wn},{lab},{x1},{y1},{x2},{y2}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index 262d6325265..af12cb37ea9 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -40,7 +40,7 @@ conn, database, display_, - graphics_, + graphics, hidden, inq_func, map_cmd, @@ -410,13 +410,13 @@ class DisplayCommands(display_.setup.Setup): class GraphicsCommands( - graphics_.annotation.Annotation, - graphics_.graphs.Graphs, - graphics_.labeling.Labelling, - graphics_.scaling.Scaling, - graphics_.setup.Setup, - graphics_.style.Style, - graphics_.views.Views, + graphics.annotation.Annotation, + graphics.graphs.Graphs, + graphics.labeling.Labeling, + graphics.scaling.Scaling, + graphics.set_up.SetUp, + graphics.style.Style, + graphics.views.Views, ): pass From 493cf6dab78bb6146249a235e8c1241d7bcf9d5b Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:12:22 +0000 Subject: [PATCH 02/10] chore: adding changelog file 3750.documentation.md [dependabot-skip] --- doc/changelog.d/3750.documentation.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/3750.documentation.md diff --git a/doc/changelog.d/3750.documentation.md b/doc/changelog.d/3750.documentation.md new file mode 100644 index 00000000000..51ed46c0324 --- /dev/null +++ b/doc/changelog.d/3750.documentation.md @@ -0,0 +1 @@ +feat: ``graphics`` submodule \ No newline at end of file From e629f58dcbe05b5e6c668b601fd81ec67d508c46 Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:21:28 +0100 Subject: [PATCH 03/10] feat: latest changes --- src/ansys/mapdl/core/_commands/graphics/set_up.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index b6afd209489..1bf59f998ba 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -267,7 +267,7 @@ def device(self, label: str = "", key: int | str = "", **kwargs): parameters. These values are device specific; using the same command input file ( :ref:`input` ) on different machines may yield different results.. The following ``KEY`` values determine the font information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, - JPEG....): + JPEG,...): * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. From 18591e759a8c1c24d1cb6a5f84275493efa0fc47 Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Tue, 18 Feb 2025 17:23:32 +0100 Subject: [PATCH 04/10] feat: latest changes - 2 --- src/ansys/mapdl/core/_commands/graphics/set_up.py | 2 +- src/ansys/mapdl/core/_commands/graphics/style.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index 1bf59f998ba..b6afd209489 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -267,7 +267,7 @@ def device(self, label: str = "", key: int | str = "", **kwargs): parameters. These values are device specific; using the same command input file ( :ref:`input` ) on different machines may yield different results.. The following ``KEY`` values determine the font information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, - JPEG,...): + JPEG....): * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. diff --git a/src/ansys/mapdl/core/_commands/graphics/style.py b/src/ansys/mapdl/core/_commands/graphics/style.py index 856da2a92b5..bfb7996ebef 100644 --- a/src/ansys/mapdl/core/_commands/graphics/style.py +++ b/src/ansys/mapdl/core/_commands/graphics/style.py @@ -20,6 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import warnings + class Style: From 0d0eecc569200de382d5d9591964e3b3a0e62c94 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 7 Mar 2025 16:40:39 +0000 Subject: [PATCH 05/10] chore: adding changelog file 3750.documentation.md [dependabot-skip] --- doc/changelog.d/changelog_template.jinja | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/changelog.d/changelog_template.jinja b/doc/changelog.d/changelog_template.jinja index a346bcd9d5b..3ca0146b8ab 100644 --- a/doc/changelog.d/changelog_template.jinja +++ b/doc/changelog.d/changelog_template.jinja @@ -1,17 +1,22 @@ {% if sections[""] %} -{% for category, val in definitions.items() if category in sections[""] %} -{{ definitions[category]['name'] }} -{% set underline = '^' * definitions[category]['name']|length %} -{{ underline }} +.. tab-set:: + +{%+ for category, val in definitions.items() if category in sections[""] %} + + .. tab-item:: {{ definitions[category]['name'] }} + + .. list-table:: + :header-rows: 0 + :widths: auto {% for text, values in sections[""][category].items() %} -- {{ text }} {{ values|join(', ') }} -{% endfor %} + * - {{ text }} + - {{ values|join(', ') }} {% endfor %} +{% endfor %} + {% else %} No significant changes. - - -{% endif %} \ No newline at end of file +{% endif %} From bfbb728d1b9bad81ff93ee55af175c7364d1c02e Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:57:24 +0200 Subject: [PATCH 06/10] feat: adding latest enhancements --- doc/source/mapdl_commands/graphics/index.rst | 16 +- .../core/_commands/graphics/annotation.py | 521 +++---- .../mapdl/core/_commands/graphics/graphs.py | 162 +-- .../mapdl/core/_commands/graphics/labeling.py | 1082 +++++++-------- .../mapdl/core/_commands/graphics/scaling.py | 111 +- .../mapdl/core/_commands/graphics/set_up.py | 1196 +++++++++-------- .../mapdl/core/_commands/graphics/style.py | 847 ++++++------ .../mapdl/core/_commands/graphics/views.py | 540 ++++---- 8 files changed, 2269 insertions(+), 2206 deletions(-) diff --git a/doc/source/mapdl_commands/graphics/index.rst b/doc/source/mapdl_commands/graphics/index.rst index 3cf0e8c47ae..ae36816d5cb 100644 --- a/doc/source/mapdl_commands/graphics/index.rst +++ b/doc/source/mapdl_commands/graphics/index.rst @@ -6,23 +6,23 @@ Graphics .. list-table:: - * - :ref:`ref_labeling` - * - :ref:`ref_set_up` * - :ref:`ref_scaling` + * - :ref:`ref_set_up` * - :ref:`ref_views` - * - :ref:`ref_style` - * - :ref:`ref_annotation` * - :ref:`ref_graphs` + * - :ref:`ref_annotation` + * - :ref:`ref_style` + * - :ref:`ref_labeling` .. toctree:: :maxdepth: 1 :hidden: - labeling - set_up scaling + set_up views - style - annotation graphs + annotation + style + labeling diff --git a/src/ansys/mapdl/core/_commands/graphics/annotation.py b/src/ansys/mapdl/core/_commands/graphics/annotation.py index 9192f631a7c..e7753520d59 100644 --- a/src/ansys/mapdl/core/_commands/graphics/annotation.py +++ b/src/ansys/mapdl/core/_commands/graphics/annotation.py @@ -23,6 +23,49 @@ class Annotation: + def slashline( + self, x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs + ): + r"""Creates annotation lines (GUI). + + Mechanical APDL Command: `/LINE `_ + + Parameters + ---------- + x1 : str + Line X starting location (-1.0 < X < 2.0). + + y1 : str + Line Y starting location (-1.0 < Y < 1.0). + + x2 : str + Line X ending location (-1.0 < X < 2.0). + + y2 : str + Line Y ending location (-1.0 < Y < 1.0). + + Notes + ----- + + .. _s-LINE_notes: + + This command defines annotation lines to be written directly onto the display at a specified + location. + + The command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + All lines are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` to set the attributes of the line. + + This command is valid in any processor. + """ + command = f"/LINE,{x1},{y1},{x2},{y2}" + return self.run(command, **kwargs) + def lsymbol( self, x: str = "", @@ -190,130 +233,6 @@ def slashlarc( command = f"/LARC,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" return self.run(command, **kwargs) - def slashline( - self, x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs - ): - r"""Creates annotation lines (GUI). - - Mechanical APDL Command: `/LINE `_ - - Parameters - ---------- - x1 : str - Line X starting location (-1.0 < X < 2.0). - - y1 : str - Line Y starting location (-1.0 < Y < 1.0). - - x2 : str - Line X ending location (-1.0 < X < 2.0). - - y2 : str - Line Y ending location (-1.0 < Y < 1.0). - - Notes - ----- - - .. _s-LINE_notes: - - This command defines annotation lines to be written directly onto the display at a specified - location. - - The command is generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file for batch input or for use - with the - :ref:`input` command). - - All lines are shown on subsequent displays unless the annotation is turned off or deleted. Issue - :ref:`lspec` to set the attributes of the line. - - This command is valid in any processor. - """ - command = f"/LINE,{x1},{y1},{x2},{y2}" - return self.run(command, **kwargs) - - def slashpspec( - self, - pcolor: int | str = "", - kfill: int | str = "", - kbordr: int | str = "", - **kwargs, - ): - r"""Creates annotation polygon attributes (GUI). - - Mechanical APDL Command: `/PSPEC `_ - - Parameters - ---------- - pcolor : int or str - Polygon color (0 :math:`` ``PCOLOR`` :math:`` 15): - - * ``0`` - Black. - - * ``1`` - Red-Magenta. - - * ``2`` - Magenta. - - * ``3`` - Blue-Magenta. - - * ``4`` - Blue. - - * ``5`` - Cyan-Blue. - - * ``6`` - Cyan. - - * ``7`` - Green-Cyan. - - * ``8`` - Green. - - * ``9`` - Yellow-Green. - - * ``10`` - Yellow. - - * ``11`` - Orange. - - * ``12`` - Red. - - * ``13`` - Dark Gray. - - * ``14`` - Light Gray. - - * ``15`` - White. - - kfill : int or str - Polygon fill key: - - * ``0`` - Hollow polygon. - - * ``1`` - Filled polygon. - - kbordr : int or str - Polygon border key: - - * ``0`` - No border. - - * ``1`` - Border. - - Notes - ----- - - .. _s-PSPEC_notes: - - Creates annotation polygon attributes to control certain characteristics of the polygons created via - :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, and :ref:`pwedge`. - - This command is generated by the graphical user interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file for batch input or for use - with - :ref:`input` ). - - This command is valid in any processor. - """ - command = f"/PSPEC,{pcolor},{kfill},{kbordr}" - return self.run(command, **kwargs) - def polygon( self, nvert: str = "", @@ -382,6 +301,43 @@ def polygon( command = f"/POLYGON,{nvert},{x1},{y1},{x2},{y2},{x3},{y3},{x4},{y4}" return self.run(command, **kwargs) + def pcircle(self, xcentr: str = "", ycentr: str = "", xlrad: str = "", **kwargs): + r"""Creates an annotation circle (GUI). + + Mechanical APDL Command: `/PCIRCLE `_ + + Parameters + ---------- + xcentr : str + Circle X center location (-1.0 < X < 2.0). + + ycentr : str + Circle Y center location (-1.0 < Y < 1.0). + + xlrad : str + Circle radius length. + + Notes + ----- + + .. _s-PCIRCLE_notes: + + Creates an annotation circle to be written directly onto the display at a specified location. This + is a command generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + This command is not intended to be typed in directly in a Mechanical APDL session (although it can + be + included in an input file for batch input or for use with the :ref:`input` command). + + All circles are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the circle. + + This command is valid in any processor. + """ + command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" + return self.run(command, **kwargs) + def pwedge( self, xcentr: str = "", @@ -433,6 +389,87 @@ def pwedge( command = f"/PWEDGE,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" return self.run(command, **kwargs) + def slashpspec( + self, + pcolor: int | str = "", + kfill: int | str = "", + kbordr: int | str = "", + **kwargs, + ): + r"""Creates annotation polygon attributes (GUI). + + Mechanical APDL Command: `/PSPEC `_ + + Parameters + ---------- + pcolor : int or str + Polygon color (0 :math:`` ``PCOLOR`` :math:`` 15): + + * ``0`` - Black. + + * ``1`` - Red-Magenta. + + * ``2`` - Magenta. + + * ``3`` - Blue-Magenta. + + * ``4`` - Blue. + + * ``5`` - Cyan-Blue. + + * ``6`` - Cyan. + + * ``7`` - Green-Cyan. + + * ``8`` - Green. + + * ``9`` - Yellow-Green. + + * ``10`` - Yellow. + + * ``11`` - Orange. + + * ``12`` - Red. + + * ``13`` - Dark Gray. + + * ``14`` - Light Gray. + + * ``15`` - White. + + kfill : int or str + Polygon fill key: + + * ``0`` - Hollow polygon. + + * ``1`` - Filled polygon. + + kbordr : int or str + Polygon border key: + + * ``0`` - No border. + + * ``1`` - Border. + + Notes + ----- + + .. _s-PSPEC_notes: + + Creates annotation polygon attributes to control certain characteristics of the polygons created via + :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, and :ref:`pwedge`. + + This command is generated by the graphical user interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with + :ref:`input` ). + + This command is valid in any processor. + """ + command = f"/PSPEC,{pcolor},{kfill},{kbordr}" + return self.run(command, **kwargs) + def pmore( self, x5: str = "", @@ -493,41 +530,41 @@ def pmore( command = f"/PMORE,,{x5},{y5},{x6},{y6},{x7},{y7},{x8},{y8}" return self.run(command, **kwargs) - def pcircle(self, xcentr: str = "", ycentr: str = "", xlrad: str = "", **kwargs): - r"""Creates an annotation circle (GUI). + def tlabel(self, xloc: str = "", yloc: str = "", text: str = "", **kwargs): + r"""Creates annotation text (GUI). - Mechanical APDL Command: `/PCIRCLE `_ + Mechanical APDL Command: `/TLABEL `_ Parameters ---------- - xcentr : str - Circle X center location (-1.0 < X < 2.0). + xloc : str + Text ``X`` starting location (-1.0 < ``X`` < 1.6). - ycentr : str - Circle Y center location (-1.0 < Y < 1.0). + yloc : str + Text Y starting location (-1.0 < ``Y`` < 1.0). - xlrad : str - Circle radius length. + text : str + Text string (60 characters maximum). Parameter substitution may be forced within the text by + enclosing the parameter name or parametric expression within percent (%) signs. Notes ----- - .. _s-PCIRCLE_notes: + .. _s-TLABEL_notes: - Creates an annotation circle to be written directly onto the display at a specified location. This - is a command generated by the Graphical User Interface (GUI) and appears in the log file ( + Defines annotation text to be written directly onto the display at a specified location. This + command is generated by the Graphical User Interface (GUI) and appears in the log file ( :file:`Jobname.LOG` ) if annotation is used. - This command is not intended to be typed in directly in a Mechanical APDL session (although it can - be - included in an input file for batch input or for use with the :ref:`input` command). + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). - All circles are shown on subsequent displays unless the annotation is turned off or deleted. Issue - :ref:`lspec` and :ref:`slashpspec` to set the attributes of the circle. + All text is shown on subsequent displays unless the annotation is disabled or deleted. Issue + :ref:`tspec` to set the attributes of the text. This command is valid in any processor. """ - command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" + command = f"/TLABEL,{xloc},{yloc},{text}" return self.run(command, **kwargs) def tspec( @@ -617,91 +654,68 @@ def tspec( command = f"/TSPEC,{tcolor},{tsize},{txthic},{pangle},{iangle}" return self.run(command, **kwargs) - def tlabel(self, xloc: str = "", yloc: str = "", text: str = "", **kwargs): - r"""Creates annotation text (GUI). - - Mechanical APDL Command: `/TLABEL `_ - - Parameters - ---------- - xloc : str - Text ``X`` starting location (-1.0 < ``X`` < 1.6). - - yloc : str - Text Y starting location (-1.0 < ``Y`` < 1.0). - - text : str - Text string (60 characters maximum). Parameter substitution may be forced within the text by - enclosing the parameter name or parametric expression within percent (%) signs. - - Notes - ----- - - .. _s-TLABEL_notes: - - Defines annotation text to be written directly onto the display at a specified location. This - command is generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. - - The command is not intended to be typed in directly in a Mechanical APDL session (although it can be - included in an input file for batch input or for use with :ref:`input` ). + def anum( + self, + num: str = "", + type_: int | str = "", + xhot: str = "", + yhot: str = "", + **kwargs, + ): + r"""Specifies the annotation number, type, and hot spot (GUI). - All text is shown on subsequent displays unless the annotation is disabled or deleted. Issue - :ref:`tspec` to set the attributes of the text. + Mechanical APDL Command: `/ANUM `_ - This command is valid in any processor. - """ - command = f"/TLABEL,{xloc},{yloc},{text}" - return self.run(command, **kwargs) + **Command default:** - def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): - r"""Activates graphics for annotating displays (GUI). + .. _s-ANUM_default: - Mechanical APDL Command: `/ANNOT `_ + Number, type, and hot spot are automatically determined. Parameters ---------- - lab : str - Annotation control key: + num : str + Annotation number. Mechanical APDL automatically assigns the lowest available number. You cannot + assign a higher number if a lower number is available; the program substitutes the lowest + available number in place of any user-specified higher number. - * ``OFF`` - Turns off annotation for each subsequent display (default). + type_ : int or str + Annotation internal type number. If ``TYPE`` = DELE, delete annotation ``NUM``. - * ``ON`` - Turns on annotation for each subsequent display. + * ``1`` - Text - * ``DELE`` - Deletes all annotation. + * ``2`` - Block text (not available in GUI) - * ``SAVE`` - Saves annotation on a file. Use ``VAL1`` for file name (defaults to :file:`Jobname` ) and ``VAL2`` - for the extension (defaults to ANO). + * ``3`` - Dimensions - * ``SCALE`` - Sets annotation scale factor (direct input only). Use ``VAL1`` for value (0.1 to 10.0) (defaults to - 1.0). + * ``4`` - Lines - * ``XORIG`` - Sets the annotation x origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). + * ``5`` - Rectangles - * ``YORIG`` - Sets annotation y origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). + * ``6`` - Circles - * ``SNAP`` - Sets annotation snap (menu button input only). Use ``VAL1`` for value (0.002 to 0.2) (defaults to - 0.002). + * ``7`` - Polygons - * ``STAT`` - Displays current annotation status. + * ``8`` - Arcs - * ``DEFA`` - Sets annotation specifications to the default values. + * ``9`` - Wedges, pies - * ``REFR`` - Redisplays annotation graphics. + * ``11`` - Symbols - * ``TMOD`` - Sets the annotation text mode. If ``VAL1`` = 1, annotation text will be drawn in scalable bitmap - fonts (default). If ``VAL1`` = 0, annotation text will be drawn with stroke text. + * ``12`` - Arrows - val1 : str - Value (or file name) as noted with label above. + * ``13`` - Bitmap - val2 : str - Value (or file name extension) as noted with label above. + xhot : str + X hot spot (-1.0 < X < 2.0). Used for menu button item delete. + + yhot : str + Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. Notes ----- - .. _s-ANNOT_notes: + .. _s-ANUM_notes: This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation is used. This command is not intended to be typed in directly in a Mechanical APDL @@ -709,21 +723,12 @@ def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): (although it can be included in an input file for batch input or for use with the :ref:`input` command). - You cannot use the "!" and "$" characters in Mechanical APDL text annotation. - - :ref:`annot` activates annotation graphics for adding annotation to displays. Commands representing - the annotation instructions are automatically created by the annotation functions in the GUI and - written to :file:`Jobname.LOG`. - - The annotation commands are :ref:`annot`, :ref:`anum`, :ref:`tlabel`, :ref:`slashline`, - :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, :ref:`pwedge`, - :ref:`tspec`, :ref:`lspec`, and :ref:`slashpspec`. Annotation graphics are relative to the full - Graphics Window and are not affected by Mechanical APDL window-specific commands ( :ref:`window`, - :ref:`view`, etc.). + Type 13 (bitmap) annotation applies user defined bitmaps defined using the FILE option of the + :ref:`txtre` command. This command is valid in any processor. """ - command = f"/ANNOT,{lab},{val1},{val2}" + command = f"/ANUM,{num},{type_},{xhot},{yhot}" return self.run(command, **kwargs) def an3d(self, **kwargs): @@ -734,6 +739,12 @@ def an3d(self, **kwargs): Notes ----- + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + .. _AN3D_notes: Because 3D annotation is applied in relation to the XYZ coordinates of the anchor, you can transform @@ -764,68 +775,55 @@ def an3d(self, **kwargs): command = "/AN3D" return self.run(command, **kwargs) - def anum( - self, - num: str = "", - type_: int | str = "", - xhot: str = "", - yhot: str = "", - **kwargs, - ): - r"""Specifies the annotation number, type, and hot spot (GUI). - - Mechanical APDL Command: `/ANUM `_ - - **Command default:** - - .. _s-ANUM_default: + def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): + r"""Activates graphics for annotating displays (GUI). - Number, type, and hot spot are automatically determined. + Mechanical APDL Command: `/ANNOT `_ Parameters ---------- - num : str - Annotation number. Mechanical APDL automatically assigns the lowest available number. You cannot - assign a higher number if a lower number is available; the program substitutes the lowest - available number in place of any user-specified higher number. - - type_ : int or str - Annotation internal type number. If ``TYPE`` = DELE, delete annotation ``NUM``. + lab : str + Annotation control key: - * ``1`` - Text + * ``OFF`` - Turns off annotation for each subsequent display (default). - * ``2`` - Block text (not available in GUI) + * ``ON`` - Turns on annotation for each subsequent display. - * ``3`` - Dimensions + * ``DELE`` - Deletes all annotation. - * ``4`` - Lines + * ``SAVE`` - Saves annotation on a file. Use ``VAL1`` for file name (defaults to :file:`Jobname` ) + and ``VAL2`` for the extension (defaults to ANO). - * ``5`` - Rectangles + * ``SCALE`` - Sets annotation scale factor (direct input only). Use ``VAL1`` for value (0.1 to 10.0) + (defaults to 1.0). - * ``6`` - Circles + * ``XORIG`` - Sets the annotation x origin (direct input only). Use ``VAL1`` for value (-3.0 to + 3.0). - * ``7`` - Polygons + * ``YORIG`` - Sets annotation y origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). - * ``8`` - Arcs + * ``SNAP`` - Sets annotation snap (menu button input only). Use ``VAL1`` for value (0.002 to 0.2) + (defaults to 0.002). - * ``9`` - Wedges, pies + * ``STAT`` - Displays current annotation status. - * ``11`` - Symbols + * ``DEFA`` - Sets annotation specifications to the default values. - * ``12`` - Arrows + * ``REFR`` - Redisplays annotation graphics. - * ``13`` - Bitmap + * ``TMOD`` - Sets the annotation text mode. If ``VAL1`` = 1, annotation text will be drawn in + scalable bitmap fonts (default). If ``VAL1`` = 0, annotation text will be drawn with stroke text. - xhot : str - X hot spot (-1.0 < X < 2.0). Used for menu button item delete. + val1 : str + Value (or file name) as noted with label above. - yhot : str - Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. + val2 : str + Value (or file name extension) as noted with label above. Notes ----- - .. _s-ANUM_notes: + .. _s-ANNOT_notes: This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation is used. This command is not intended to be typed in directly in a Mechanical APDL @@ -833,10 +831,19 @@ def anum( (although it can be included in an input file for batch input or for use with the :ref:`input` command). - Type 13 (bitmap) annotation applies user defined bitmaps defined using the FILE option of the - :ref:`txtre` command. + You cannot use the "!" and "$" characters in Mechanical APDL text annotation. + + :ref:`annot` activates annotation graphics for adding annotation to displays. Commands representing + the annotation instructions are automatically created by the annotation functions in the GUI and + written to :file:`Jobname.LOG`. + + The annotation commands are :ref:`annot`, :ref:`anum`, :ref:`tlabel`, :ref:`slashline`, + :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, :ref:`pwedge`, + :ref:`tspec`, :ref:`lspec`, and :ref:`slashpspec`. Annotation graphics are relative to the full + Graphics Window and are not affected by Mechanical APDL window-specific commands ( :ref:`window`, + :ref:`view`, etc.). This command is valid in any processor. """ - command = f"/ANUM,{num},{type_},{xhot},{yhot}" + command = f"/ANNOT,{lab},{val1},{val2}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/graphs.py b/src/ansys/mapdl/core/_commands/graphics/graphs.py index 9ddeb7f0fc3..d97fac9ab6f 100644 --- a/src/ansys/mapdl/core/_commands/graphics/graphs.py +++ b/src/ansys/mapdl/core/_commands/graphics/graphs.py @@ -132,11 +132,12 @@ def grtyp(self, kaxis: int | str = "", **kwargs): * ``0 or 1`` - Single Y-axis. Up to 10 curves scaled to a single Y-axis. - * ``2`` - Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves with - widely differing numbering ranges. + * ``2`` - Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves + with widely differing numbering ranges. - * ``3`` - Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves maximum). - Allows clearer display with an isometric view. The default view when ``KAXIS`` = 3 is View,1,1,2,3. + * ``3`` - Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves + maximum). Allows clearer display with an isometric view. The default view when ``KAXIS`` = 3 is + View,1,1,2,3. Notes ----- @@ -154,6 +155,47 @@ def grtyp(self, kaxis: int | str = "", **kwargs): command = f"/GRTYP,{kaxis}" return self.run(command, **kwargs) + def gthk(self, label: str = "", thick: int | str = "", **kwargs): + r"""Sets line thicknesses for graph lines. + + Mechanical APDL Command: `/GTHK `_ + + Parameters + ---------- + label : str + Apply thicknesses as selected from the following labels: + + * ``AXIS`` - Modify thickness of ordinate and abscissa axes on graph displays. + + * ``GRID`` - Modify thickness of grid lines on graph displays. + + * ``CURVE`` - Modify thickness of curve lines (when no area fill ( :ref:`gropt` )). + + thick : int or str + Thickness ratio (whole numbers only, from -1 to 10): + + * ``-1`` - Do not draw the curve, but show only the markers specified by :ref:`gmarker`. + + * ``0 or 1`` - Thin lines. + + * ``2`` - The default thickness. + + * ``3`` - 1.5 times the default thickness. + + * ``etc.`` - (up to 10) + + Notes + ----- + + .. _s-GTHK_notes: + + Sets line thicknesses for graph lines (in raster mode only). Use :ref:`gthk`,STAT to show settings. + + This command is valid in any processor. + """ + command = f"/GTHK,{label},{thick}" + return self.run(command, **kwargs) + def gropt(self, lab: str = "", key: str = "", **kwargs): r"""Sets various line graph display options. @@ -166,13 +208,14 @@ def gropt(self, lab: str = "", key: str = "", **kwargs): * ``AXDV`` - Axis division (tick) marks (defaults to ``KEY`` = ON). - * ``AXNM`` - Axis scale numbers (defaults to ``KEY`` = ON, which puts numbers at the back plane of the graph). If - ``KEY`` = FRONT, numbers are on the front plane of the graph. + * ``AXNM`` - Axis scale numbers (defaults to ``KEY`` = ON, which puts numbers at the back plane of + the graph). If ``KEY`` = FRONT, numbers are on the front plane of the graph. * ``AXNSC`` - Axis number size scale factor. Input the scale value for ``KEY`` (defaults to 1.0). - * ``ASCAL`` - Automatic scaling of additional Y-axes for multi-curve ( :ref:`grtyp`, 2 or 3) graphs (defaults to - ``KEY`` = ON). If ``KEY`` = OFF, use base Y-axis scaling (see the :ref:`yrange` command). + * ``ASCAL`` - Automatic scaling of additional Y-axes for multi-curve ( :ref:`grtyp`, 2 or 3) graphs + (defaults to ``KEY`` = ON). If ``KEY`` = OFF, use base Y-axis scaling (see the :ref:`yrange` + command). * ``LOGX`` - Log X scale (defaults to ``KEY`` = OFF (linear)). @@ -180,18 +223,18 @@ def gropt(self, lab: str = "", key: str = "", **kwargs): * ``FILL`` - Color fill areas under curves (defaults to ``KEY`` = OFF). - * ``CGRID`` - Superimpose background grid ( :ref:`grid` ) over areas under filled curves (defaults to ``KEY`` = - OFF). + * ``CGRID`` - Superimpose background grid ( :ref:`grid` ) over areas under filled curves (defaults + to ``KEY`` = OFF). - * ``DIG1`` - Number of significant digits before decimal point for axis values. Input the value for ``KEY`` - (defaults to 4). + * ``DIG1`` - Number of significant digits before decimal point for axis values. Input the value for + ``KEY`` (defaults to 4). - * ``DIG2`` - Number of significant digits after decimal point for axis values. Input the value for ``KEY`` - (defaults to 3). + * ``DIG2`` - Number of significant digits after decimal point for axis values. Input the value for + ``KEY`` (defaults to 3). - * ``VIEW`` - View key for graph displays (defaults to ``KEY`` = OFF, in which case the view is (0,0,1) for 2D - graph displays or (1,2,3) for 3D graph displays). If ``KEY`` = ON, the view settings for graph - displays are the same as the view settings for the model. + * ``VIEW`` - View key for graph displays (defaults to ``KEY`` = OFF, in which case the view is + (0,0,1) for 2D graph displays or (1,2,3) for 3D graph displays). If ``KEY`` = ON, the view settings + for graph displays are the same as the view settings for the model. * ``REVX`` - Plots the values on the X-axis in reverse order. @@ -201,26 +244,26 @@ def gropt(self, lab: str = "", key: str = "", **kwargs): * ``DIVY`` - Determines the number of divisions (grid markers) that will be plotted on the Y axis. - * ``LTYP`` - Specifies whether program-generated ( ``KEY`` = 1) or system-derived ( ``KEY`` = 0) fonts are used - for the axis labels. + * ``LTYP`` - Specifies whether program-generated ( ``KEY`` = 1) or system-derived ( ``KEY`` = 0) + fonts are used for the axis labels. - * ``CURL`` - Determines the position of the curve labels. If ( ``KEY`` = 1), the curve label will be plotted in - the legend column, and the label will be displayed in the same color as the curve. If ( ``KEY`` = 0) - the curve labels will be plotted near the curve. (default). + * ``CURL`` - Determines the position of the curve labels. If ( ``KEY`` = 1), the curve label will be + plotted in the legend column, and the label will be displayed in the same color as the curve. If ( + ``KEY`` = 0) the curve labels will be plotted near the curve. (default). - * ``XAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount from the - default (along the bottom) location for the X axis. If ``KEY`` = 1.0, a full offset occurs (the X - axis is moved to the top of the graph). If ``KEY`` = 0.5, the axis is offset to the midpoint of the - graph, and if ``KEY`` = 0 the axis remains in the original position, along the bottom of the graph. - For any offset, a grey copy of the original axis (containing the axis numbering) remains at the - original location. + * ``XAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount + from the default (along the bottom) location for the X axis. If ``KEY`` = 1.0, a full offset occurs + (the X axis is moved to the top of the graph). If ``KEY`` = 0.5, the axis is offset to the midpoint + of the graph, and if ``KEY`` = 0 the axis remains in the original position, along the bottom of the + graph. For any offset, a grey copy of the original axis (containing the axis numbering) remains at + the original location. - * ``YAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount from the - default (along the left side of the graph) location for the Y axis. If ``KEY`` = 1.0, a full offset - occurs (the Y axis is moved to the right side of the graph). If ``KEY`` = 0.5, the axis is offset to - the midpoint of the graph, and if ``KEY`` = 0 the axis remains in the original position, along the - left side of the graph. For any offset, a gray copy of the original axis (containing the axis - numbering) remains at the original location. + * ``YAXO`` - When you use this label, the subsequent ``KEY`` value will determine an offset amount + from the default (along the left side of the graph) location for the Y axis. If ``KEY`` = 1.0, a + full offset occurs (the Y axis is moved to the right side of the graph). If ``KEY`` = 0.5, the axis + is offset to the midpoint of the graph, and if ``KEY`` = 0 the axis remains in the original + position, along the left side of the graph. For any offset, a gray copy of the original axis + (containing the axis numbering) remains at the original location. key : str Option values: @@ -235,12 +278,12 @@ def gropt(self, lab: str = "", key: str = "", **kwargs): * ``FRONT`` - If ``Lab`` is AXNM, FRONT may also be input. - * ``Ndiv`` - If ``Lab`` is DIVX or DIVY, determines the number of divisions (1-99) that will be applied to the - axis. + * ``Ndiv`` - If ``Lab`` is DIVX or DIVY, determines the number of divisions (1-99) that will be + applied to the axis. - * ``Kfont`` - If ``Lab`` is LTYP, ``Kfont`` is ON (1) or OFF(0). ON uses program-generated fonts for the axis - labels, while OFF uses SYSTEM (Windows, X-system, etc.) fonts. Default: ``Kfont`` = ON (Mechanical APDL - fonts). + * ``Kfont`` - If ``Lab`` is LTYP, ``Kfont`` is ON (1) or OFF(0). ON uses program-generated fonts for + the axis labels, while OFF uses SYSTEM (Windows, X-system, etc.) fonts. Default: ``Kfont`` = ON + (Mechanical APDL fonts). Notes ----- @@ -296,44 +339,3 @@ def grid(self, key: str = "", **kwargs): """ command = f"/GRID,{key}" return self.run(command, **kwargs) - - def gthk(self, label: str = "", thick: int | str = "", **kwargs): - r"""Sets line thicknesses for graph lines. - - Mechanical APDL Command: `/GTHK `_ - - Parameters - ---------- - label : str - Apply thicknesses as selected from the following labels: - - * ``AXIS`` - Modify thickness of ordinate and abscissa axes on graph displays. - - * ``GRID`` - Modify thickness of grid lines on graph displays. - - * ``CURVE`` - Modify thickness of curve lines (when no area fill ( :ref:`gropt` )). - - thick : int or str - Thickness ratio (whole numbers only, from -1 to 10): - - * ``-1`` - Do not draw the curve, but show only the markers specified by :ref:`gmarker`. - - * ``0 or 1`` - Thin lines. - - * ``2`` - The default thickness. - - * ``3`` - 1.5 times the default thickness. - - * ``etc.`` - (up to 10) - - Notes - ----- - - .. _s-GTHK_notes: - - Sets line thicknesses for graph lines (in raster mode only). Use :ref:`gthk`,STAT to show settings. - - This command is valid in any processor. - """ - command = f"/GTHK,{label},{thick}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py index 6ea180307a3..1d0a89fe970 100644 --- a/src/ansys/mapdl/core/_commands/graphics/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -23,335 +23,107 @@ class Labeling: - def hbc(self, wn: str = "", key: str = "", **kwargs): - r"""Determines how boundary condition symbols are displayed in a display window. - - Mechanical APDL Command: `/HBC `_ - - Parameters - ---------- - wn : str - Window reference number. This number can be any window numbered 1 to 5, or ALL (for all active - windows). Default = 1. - - key : str - Controls hidden-surface boundary condition display behavior: - - ON, YES or 1 = Enable - Your boundary condition symbols are processed by the hidden-surface - algorithm (for 2D graphics devices) and use an improved pressure-contour display (for 2D and 3D - graphics devices). - - OFF, NO or 0 (default) = Disable (default) - Your boundary condition symbols are not processed - by the hidden-surface algorithm.. - - Notes - ----- - - .. _s-HBC_notes: - - With :ref:`hbc`, ``WN``,ON in effect, Mechanical APDL does not display symbols obscured by the model - in the - current view (that is, symbols inside of or behind the model are not drawn). This behavior lessens - display clutter. - """ - command = f"/HBC,{wn},{key}" - return self.run(command, **kwargs) - - def cformat(self, nfirst: str = "", nlast: str = "", **kwargs): - r"""Controls the graphical display of alphanumeric character strings for parameters, components, - assemblies, and tables. - - Mechanical APDL Command: `/CFORMAT `_ - - Parameters - ---------- - nfirst : str - Display the first ``n`` characters of the parameter, component, assembly, or table name, up to - 32. Defaults to 32. - - nlast : str - Display the last ``n`` characters of the parameter, component, assembly, or table name, up to - 32. Defaults to 0. - - Notes - ----- - - .. _s-CFORMAT_notes: - - Use this command to control the length of the character string that is shown in the graphics window - for a parameter, component, assembly, or table name. - - The total number of characters ( ``NFIRST`` + ``NLAST`` +3) cannot exceed 32. - - If ``NFIRST`` is greater than zero and ``NLAST`` = 0, only the ``NFIRST`` characters are displayed, - followed by an ellipsis. - - If ``NFIRST`` = 0 and ``NLAST`` is greater than zero, only the ``NLAST`` characters are displayed, - preceded by an ellipsis (...). - - If both ``NFIRST`` and ``NLAST`` are greater than zero, the name will be shown as ``NFIRST``, - followed by an ellipsis (...), followed by ``NLAST``, up to a maximum of 32 characters. - - For example, if ``NFIRST`` = 6 and ``NLAST`` = 3, and the character string is LENGTHOFSIDEONE, then - it will appear in the graphics window as LENGTH...ONE. - - If the actual length of the character string is less than the specified combination of ``NFIRST`` + - ``NLAST`` +3, then the actual string will be used. - - This command is valid in any processor. - """ - command = f"/CFORMAT,{nfirst},{nlast}" - return self.run(command, **kwargs) - - def cval( - self, - wn: str = "", - v1: str = "", - v2: str = "", - v3: str = "", - v4: str = "", - v5: str = "", - v6: str = "", - v7: str = "", - v8: str = "", - **kwargs, - ): - r"""Specifies nonuniform contour values on stress displays. - - Mechanical APDL Command: `/CVAL `_ - - **Command default:** - - .. _s-CVAL_default: - - Nine contour values uniformly spaced between the extreme values. - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - v1 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v2 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v3 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v4 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v5 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v6 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v7 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - v8 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. - - Notes - ----- - - .. _s-CVAL_notes: - - This command is similar to the :ref:`contour` command. With :ref:`cval`, however, you define the - upper level of each contour band instead of having the contours uniformly distributed over the - range. The minimum value (including a zero value for the first band) for a contour band cannot be - specified. If you use both :ref:`contour` and :ref:`cval`, the last command issued takes precedence. - - This command is valid in any processor. - """ - command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" - return self.run(command, **kwargs) - - def contour( - self, - wn: str = "", - ncont: str = "", - vmin: str = "", - vinc: str = "", - vmax: str = "", - **kwargs, - ): - r"""Specifies the uniform contour values on stress displays. - - Mechanical APDL Command: `/CONTOUR `_ - - **Command default:** - - .. _s-CONTOUR_default: + def psymb(self, label: str = "", key: int | str = "", **kwargs): + r"""Shows various symbols on displays. - Nine contour values uniformly spaced between the extreme values, or no contours if the ratio of - range to minimum value (or range to maximum if minimum = 0) is less than 0.001. + Mechanical APDL Command: `/PSYMB `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - ncont : str - Number of contour values. ``NCONT`` defaults to 9 for X11 or WIN32 and to 128 for X11c or - WIN32C. The default graphics window display for 3D devices is a smooth continuous shading effect - that spans the maximum of 128 contours available. Use the :ref:`dv3d` command to create defined - banding for your contour values (values of 9 and 128 are displayed in smooth shading only). The - legend, however, will display only nine color boxes, which span the full range of colors - displayed in the graphics window. - - vmin : str - Minimum contour value. If ``VMIN`` = AUTO, automatically calculate contour values based upon - ``NCONT`` uniformly spaced values over the min-max extreme range. Or, if ``VMIN`` = USER, set - contour values to those of the last display (useful when last display automatically calculated - contours). - - vinc : str - Value increment (positive) between contour values. Defaults to ( ``VMAX`` - ``VMIN`` ) - ``/NCONT``. - - vmax : str - Maximum contour value. Ignored if both ``VMIN`` and ``VINC`` are specified. - - Notes - ----- + label : str + Show symbols as selected from the following labels: - .. _s-CONTOUR_notes: + * ``CS`` - Local coordinate systems. - Values represent contour lines in vector mode, and the algebraic maximum of contour bands in raster - mode. + * ``NDIR`` - Nodal coordinate systems (on rotated nodes only). - Regardless of how many contours ( ``NCONT`` ) are specified, the actual number of contours appearing - on your display depends also on the device name, whether the display is directed to the screen or to - a file, the display mode (vector or raster), and the number of color planes. (All of those items are - controlled via :ref:`show`.) In any case, regardless of whether they are smoothed or banded, only - 128 contours can be displayed. + * ``ESYS`` - Element coordinate systems (element displays only). - For more information about changing the number of contours, see `Creating Geometric Results Displays - `_. + * ``LDIR`` - Line directions (line displays only). - When the current Mechanical APDL graphics are not displayed as Multi-Plots: + * ``LDIV`` - Controls the display of element divisions on lines. - If the current device is a 3D device ( :ref:`show`,3D), the model contours in all active windows are - the same, even if separate :ref:`contour` commands are issued for each active window. Mechanical - APDL - maintains a single data structure (segment) containing one set of contours. The program displays the - same segment in all windows. The view settings of each window constitute the only differences in the - contour plots in the active windows. + * ``ADIR`` - Area direction symbol (for keypoint, line, area and volume plots). - This command is valid in any processor. + * ``LAYR`` - Layer orientations (relative to the projected element x-axis) or fiber orientations in + smeared reinforcing elements. Used only within an element display. Use ``KEY`` to specify the layer + number. - For alternate specifications, see :ref:`cval`. - """ - command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" - return self.run(command, **kwargs) + * ``ECON`` - Element mesh symbols on keypoints and lines. - def clabel(self, wn: str = "", key: int | str = "", **kwargs): - r"""Specifies contour labeling. + * ``DOT`` - Larger symbols displayed for node and keypoint locations. When ``Label`` = DOT, ``KEY`` + = 1 by default. - Mechanical APDL Command: `/CLABEL `_ + * ``XNOD`` - Extra node of surface or circuit elements. - **Command default:** + * ``FBCS`` - Force boundary condition scaling. Subsequent ``KEY`` value determines whether or not to + scale the applied and derived forces/moments to the same maximum value. - .. _s-CLABEL_default: + * ``DEFA`` - Resets the symbol keys so that Mechanical APDL displays none of the symbols controlled by the + :ref:`psymb` command. The value of the ``KEY`` field is ignored. - Show contour line labels. + * ``STAT`` - Prints the status of the settings of the symbol keys controlled by the :ref:`psymb` + command. The ``KEY`` field is ignored. - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + * ``MARK`` - Controls the marker size ( :ref:`gmarker` ). When ``Label`` = MARK, ``KEY`` = 10 by + default. key : int or str - Labeling key: - - * ``0 or 1`` - Label contours with legend or color (default). - - * ``-1`` - No contour labeling. - - * ``N`` - Same as 1 except show alphabetic legend only on every ``N`` th element. - - Notes - ----- - - .. _s-CLABEL_notes: - - Labels contours for identification with alphabetic legend for vector displays and color for raster - displays. Number of contours is automatically reduced to 9 (or fewer) for clarity. Use - :ref:`contour` command to increase (24 maximum for alphabetic labeling; no limit for color - labeling). - - This command is valid in any processor. - """ - command = f"/CLABEL,{wn},{key}" - return self.run(command, **kwargs) - - def number(self, nkey: int | str = "", **kwargs): - r"""Specifies whether numbers, colors, or both are used for displays. - - Mechanical APDL Command: `/NUMBER `_ + Symbol key: - Parameters - ---------- - nkey : int or str - Numbering style: + * ``-1`` - Effective only if ``Label`` = LAYR and solid shape element display ( :ref:`eshape` ) is + active. Orientation of all layers appears with the solid shape element display. - * ``0`` - Color (terminal dependent) the numbered items and show numbers. + * ``0`` - No symbol (default). If ``Label`` = LDIV, then ``KEY`` = 0 indicates that the displayed + element divisions will correspond to the existing mesh (the word MESHED or EXISTING can also be + substituted). Also, for ``Label`` = LDIV, if you execute any meshing command (such as :ref:`amesh` + or :ref:`vmesh` ), ``KEY`` is set to 0 (MESHED) automatically. If ``Label`` = FBCS, then ``KEY`` = 0 + indicates that boundary condition scaling will not be common. The applied and derived forces/moments + will be scaled to their respective maximum values. - * ``1`` - Color the numbered items. Do not show the numbers. + * ``1`` - Include symbol. If ``Label`` = LDIV, then ``KEY`` = 1 indicates that the displayed line + divisions will correspond to the value assigned by :ref:`lesize` (the word LESIZE can also be + substituted). Also, for ``Label`` = LDIV, if you execute the :ref:`lesize` command, ``KEY`` is set + to 1 (LESIZE) automatically. If ``Label`` = FBCS, then ``KEY`` = 1 indicates that boundary condition + scaling will be common. The applied and derived forces/moments will be scaled to the same maximum + value. - * ``2`` - Show the numbers. Do not color the items. + * ``N`` - If ``Label`` = LAYR, then ``N`` is equal to the layer number. If ``Label`` = DOT, then + ``N`` can be equal to 0,1,.....15, indicating the dot size. If ``Label`` = MARK, then ``N`` can be + equal to 1,.....10, indicating the marker size. If - * ``-1`` - Do not color the items or show the numbers. For contour plots, the resulting display will vary (see - below). + ``Label`` = LDIV, then ``KEY`` = -1, indicates that no element divisions will be displayed (the + word OFF can also be substituted). Notes ----- - .. _s-NUMBER_notes: - - Specifies whether numbers, colors, or both are used for numbering displays ( :ref:`pnum` ) of nodes, - elements, keypoints, lines, areas, and volumes. + .. _s-PSYMB_notes: - Shading is also available for terminals configured with more than 4 color planes ( :ref:`show` ). - Color automatically appears for certain items and may be manually controlled (off or on) for other - items. + Includes various symbols on the display. Triads are right-handed with x displayed as the longest + leg. Where color is displayed, x is white, y is green, and z is blue. For beams, x is always along + the length of the element. For lines, an arrow represents the direction of a line, from the + beginning keypoint to the end keypoint. See :ref:`plopts` command for additional display options. + Use :ref:`pstatus` or :ref:`psymb`,STAT to display settings. Use :ref:`psymb`,DEFA to reset all + specifications back to their defaults. The command :ref:`psymb`,ECON,1 causes the symbol "M" to be + displayed on keypoints and lines associated with meshed entities. When you issue the command + :ref:`psymb`,DOT,1, a larger symbol is displayed for each node and keypoint location. Using + :ref:`psymb`,MARK,1, a smaller marker size can be displayed. - When you suppress color ( ``NKEY`` = -1) your contour plots will produce different results, - depending on your graphics equipment. For non-3D devices (X11, Win32, etc.) your contour plot will - be white (no color). For 3D devices, such as OpenGL, the resulting display will be in color. + PowerGraphics ( :ref:`graphics`,POWER) does not support :ref:`psymb`,ESYS and :ref:`psymb`,LAYR. - The following items are automatically given discrete colors: Boundary condition symbols ( :ref:`pbc` - ), curves on graph displays, and distorted geometry on postprocessing displays. Contour lines in - postprocessing displays are automatically colored based upon a continuous, rather than a discrete, - spectrum so that red is associated with the highest contour value. On terminals with raster - capability ( :ref:`show` ), the area between contour lines is filled with the color of the higher - contour. + If ``KEY`` = ``N`` and PowerGraphics is off, the centroid of the surface elements is connected to + the extra node using a gray line. However, if PowerGraphics is on, the color of the line connecting + the centroid to the extra node is the same as that for the elements themselves (as determined by + :ref:`pnum` ). - Explicit entity colors or the discrete color mapping may be changed with the :ref:`color` command. + When ``Label`` = LAYR, the layer systems can be visualized with all current-technology layered + elements and the smeared reinforcing element REINF265. To use :ref:`psymb`,LAYR with REINF265, first + set the vector-mode graphics option ( :ref:`device`,VECTOR,1). This command is valid in any processor. """ - command = f"/NUMBER,{nkey}" + command = f"/PSYMB,{label},{key}" return self.run(command, **kwargs) def pbf(self, item: str = "", key: int | str = "", **kwargs): @@ -422,100 +194,92 @@ def pbf(self, item: str = "", key: int | str = "", **kwargs): command = f"/PBF,{item},,{key}" return self.run(command, **kwargs) - def plopts(self, label: str = "", key: int | str = "", **kwargs): - r"""Controls graphics options on subsequent displays. - - Mechanical APDL Command: `/PLOPTS `_ - - **Command default:** - - .. _s-PLOPTS_default: - - See individual label defaults. + def pnum(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls entity numbering/coloring on plots. - The Multi-legend mode ( :ref:`plopts`,INFO,3) is the default for contour legend displays. + Mechanical APDL Command: `/PNUM `_ Parameters ---------- label : str - Apply display items as selected from the following labels: + Type of numbering/coloring: - * ``INFO`` - Controls the display of the legend (ON or OFF) and allows the choice of preset or Multi-legend - placement. Control is provided by the ``KEY`` values. (Defaults to ``KEY`` =3 when the GUI is on. - Defaults to ``KEY`` = 2 otherwise.) + * ``NODE`` - Node numbers on node and element plots. - * ``LEG1`` - Header portion of legend column (defaults to ON). + * ``ELEM`` - Element numbers and colors on element plots. - * ``LEG2`` - View portion of legend column (defaults to ON (except off with contour displays)). + * ``SEC`` - Section numbers and colors on element and solid model plots (see :ref:`s-PNUM.notes`). - * ``LEG3`` - View the contour section of the legend column (defaults to ON). + * ``MAT`` - Material set numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - * ``FRAME`` - Frame border lines around windows (defaults to ON). + * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - * ``TITLE`` - Title (bottom left text) (defaults to ON). + * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - * ``MINM`` - Min-Max symbols on contour displays (defaults to ON). + * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see + :ref:`s-PNUM.notes`). + + * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. + + LOC and ELEM numbers will be the same unless the model has been reordered. - * ``LOGO`` - Ansys logo (defaults to OFF (displayed as text at top of legend column)). If ``KEY`` = ON, - the text is removed from legend column but the logo symbol is displayed in whichever active window - is either in the uppermost right corner and on top, or if there is no window in that location, then - in the window to the furthest right of the screen. Version information remains in the legend column. + * ``KP`` - Keypoint numbers on solid model plots. + + * ``LINE`` - Line numbers on solid model plots (both numbers and colors on line plots). - * ``WINS`` - Controls whether graphics windows automatically stretch or shrink to adjust to screen size as the - legend column is turned off or on ( :ref:`plopts`,INFO) (defaults to ON). If WINS is on and the - legend column is changed from off to on, all windows are shrunk regardless of what their correct - size is. + * ``AREA`` - Area numbers on solid model plots (both numbers and colors on area plots). - * ``WP`` - Working plane (defaults to OFF). The working plane is drawn as part of the display ( not just an - overlaid image as in :ref:`wpstyl` ). This option is best used in combination with a hidden-line - technique ( :ref:`slashtype` ). + * ``VOLU`` - Volume numbers on solid model plots (both numbers and colors on volume plots). - * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the - display as follows: + * ``SVAL`` - Stress (or any contour) values on postprocessing plots, and surface load values and + colors on model plots when surface load symbols are on ( :ref:`psf` ). For tabular boundary + conditions, the table- evaluated values will be displayed on node, element, or contour displays in + POST1 when load symbols ( :ref:`pbf`, :ref:`psf`, :ref:`pbc` ) are on and TABNAM is OFF. - 0 – No date or time displays are included in your legend. 1 – Only the date is shown. 2 – Both - the date and time are shown (default). + * ``TABNAM`` - Table names for tabular boundary conditions. If this label is turned on, the table + name appears next to the appropriate symbol, arrow, face outline, or contour as dictated by the + :ref:`psf`, :ref:`pbc`, and :ref:`pbf` commands. - * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the - display as follows: + * ``STAT`` - Shows current settings for :ref:`pnum`. - 0 – The Mechanical APDL jobname is not included in your legend (default). 1 – The Mechanical APDL jobname is - included in your legend. + * ``DEFA`` - Resets all :ref:`pnum` specifications back to default. key : int or str Switch: - * ``OFF or 0`` - Do not apply this display item. For ``Label`` = DATE, no time or date are displayed. - - * ``ON or 1`` - Apply this display item. For ``Label`` = DATE, show only the date. - - * ``AUTO or 2`` - For ``Label`` = INFO, initiate Auto-legend mode. If the display has contours, the legend is ON; if - the display has no contours, the legend is OFF. For ``Label`` = DATE, display both the date and - time. + * ``0`` - Turns OFF numbers/colors for specified label. - * ``3`` - For ``Label`` = INFO, switch to Multi-legend mode. See the :ref:`udoc` command for the available - legend configurations. + * ``1`` - Turns ON numbers/colors for specified label. Notes ----- - .. _s-PLOPTS_notes: + .. _s-PNUM_notes: - Use :ref:`plopts`,STAT to display settings. Use :ref:`plopts`,DEFA to reset all specifications back - to their defaults. + This command specifies entity numbering and coloring for subsequent plots. - When you perform multiple results displays, contours on the legend column may be truncated. To avoid - this, specify :ref:`plopts`,LEG1,0. + The MAT, TYPE, REAL, and ESYS labels activate both the numbering and coloring of the corresponding + attributes for :ref:`eplot`, :ref:`kplot`, :ref:`lplot`, :ref:`aplot`, and :ref:`vplot`. The ELEM, + MAT, TYPE, REAL, ESYS, and LOC labels are mutually exclusive, that is, only one can be specified at + a time. Also, turning on a LINE, AREA, or VOLU label will turn off the MAT, TYPE, and REAL labels. - The Multi-legend mode provides a number of legend data item priority and placement options. These - options are accessed via the GUI at Utility Menu> PlotCtrls> Window Controls> Window Options. The - :ref:`udoc` command provides command line o ptions for this capability. + PowerGraphics ( :ref:`graphics`,POWER) displays for :ref:`pnum` can be problematic. :ref:`pnum`,ELEM + will display erratically depending on other display command specifications, while :ref:`pnum`,LOC + and :ref:`pnum`,ESYS are not supported. - This command is valid in any processor. + Element and volume numbers are not visible for 3D elements and volumes when Z-buffering is turned on + ( :ref:`slashtype`,,[6,7, or 8]). - This command is not available for Academic Research or Teaching level products + Use :ref:`pstatus` or :ref:`pnum`,STAT to show settings. Use :ref:`pnum`,DEFA to reset all + specifications back to default. Use the :ref:`number` command to control whether numbers and colors + are displayed together. + + This command is valid in any processor """ - command = f"/PLOPTS,{label},{key}" + command = f"/PNUM,{label},{key}" return self.run(command, **kwargs) def pbc( @@ -592,13 +356,13 @@ def pbc( * ``RMOM`` - POST1 reaction moments (MX, MY, MZ). - * ``PATH`` - Path geometry (undistorted) associated with the :ref:`path` command after a :ref:`pdef` or - :ref:`pvect` command has been issued. + * ``PATH`` - Path geometry (undistorted) associated with the :ref:`path` command after a :ref:`pdef` + or :ref:`pvect` command has been issued. * ``ACEL`` - Global acceleration (ACELX, ACELY, ACELZ vector). - * ``OMEG`` - Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, DOMEGY, DOMEGZ - vector). + * ``OMEG`` - Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, DOMEGY, + DOMEGZ vector). * ``ALL`` - Represents all appropriate labels. @@ -664,6 +428,103 @@ def pbc( command = f"/PBC,{item},,{key},{min},{max},{abs}" return self.run(command, **kwargs) + def plopts(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls graphics options on subsequent displays. + + Mechanical APDL Command: `/PLOPTS `_ + + **Command default:** + + .. _s-PLOPTS_default: + + See individual label defaults. + + The Multi-legend mode ( :ref:`plopts`,INFO,3) is the default for contour legend displays. + + Parameters + ---------- + label : str + Apply display items as selected from the following labels: + + * ``INFO`` - Controls the display of the legend (ON or OFF) and allows the choice of preset or + Multi-legend placement. Control is provided by the ``KEY`` values. (Defaults to ``KEY`` =3 when the + GUI is on. Defaults to ``KEY`` = 2 otherwise.) + + * ``LEG1`` - Header portion of legend column (defaults to ON). + + * ``LEG2`` - View portion of legend column (defaults to ON (except off with contour displays)). + + * ``LEG3`` - View the contour section of the legend column (defaults to ON). + + * ``FRAME`` - Frame border lines around windows (defaults to ON). + + * ``TITLE`` - Title (bottom left text) (defaults to ON). + + * ``MINM`` - Min-Max symbols on contour displays (defaults to ON). + + * ``LOGO`` - Ansys logo (defaults to OFF (displayed as text at top of legend column)). If + ``KEY`` = ON, the text is removed from legend column but the logo symbol is displayed in whichever + active window is either in the uppermost right corner and on top, or if there is no window in that + location, then in the window to the furthest right of the screen. Version information remains in the + legend column. + + * ``WINS`` - Controls whether graphics windows automatically stretch or shrink to adjust to screen + size as the legend column is turned off or on ( :ref:`plopts`,INFO) (defaults to ON). If WINS is on + and the legend column is changed from off to on, all windows are shrunk regardless of what their + correct size is. + + * ``WP`` - Working plane (defaults to OFF). The working plane is drawn as part of the display ( not + just an overlaid image as in :ref:`wpstyl` ). This option is best used in combination with a hidden- + line technique ( :ref:`slashtype` ). + + * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the display as follows: + + * 0 – No date or time displays are included in your legend. + * 1 – Only the date is shown. + * 2 – Both the date and time are shown (default). + + * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the display as follows: + + * 0 – The Mechanical APDL jobname is not included in your legend (default). + * 1 – The Mechanical APDL jobname is included in your legend. + + key : int or str + Switch: + + * ``OFF or 0`` - Do not apply this display item. For ``Label`` = DATE, no time or date are + displayed. + + * ``ON or 1`` - Apply this display item. For ``Label`` = DATE, show only the date. + + * ``AUTO or 2`` - For ``Label`` = INFO, initiate Auto-legend mode. If the display has contours, the + legend is ON; if the display has no contours, the legend is OFF. For ``Label`` = DATE, display both + the date and time. + + * ``3`` - For ``Label`` = INFO, switch to Multi-legend mode. See the :ref:`udoc` command for the + available legend configurations. + + Notes + ----- + + .. _s-PLOPTS_notes: + + Use :ref:`plopts`,STAT to display settings. Use :ref:`plopts`,DEFA to reset all specifications back + to their defaults. + + When you perform multiple results displays, contours on the legend column may be truncated. To avoid + this, specify :ref:`plopts`,LEG1,0. + + The Multi-legend mode provides a number of legend data item priority and placement options. These + options are accessed via the GUI at Utility Menu> PlotCtrls> Window Controls> Window Options. The + :ref:`udoc` command provides command line o ptions for this capability. + + This command is valid in any processor. + + This command is not available for Academic Research or Teaching level products + """ + command = f"/PLOPTS,{label},{key}" + return self.run(command, **kwargs) + def psf( self, item: str = "", @@ -686,23 +547,23 @@ def psf( Parameters ---------- item : str - Labels identifying the surface load to be shown; see. + Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. comp : str - Labels identifying the surface load to be shown; see. + Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. key : int or str Key to turn surface load symbols on or off: * ``0`` - Off (default). - * ``1`` - On, shown as face outlines. Line surface loads ( :ref:`sfl` ) on solid model plots are shown as - arrows. + * ``1`` - On, shown as face outlines. Line surface loads ( :ref:`sfl` ) on solid model plots are + shown as arrows. * ``2`` - On, shown as arrows. - * ``3`` - On, shown as color filled surfaces. Line and area surface loads ( :ref:`sfl` and :ref:`sfa` ) on - solid model plots are shown as arrows. + * ``3`` - On, shown as color filled surfaces. Line and area surface loads ( :ref:`sfl` and + :ref:`sfa` ) on solid model plots are shown as arrows. kshell : int or str Visibility key for shell elements. @@ -717,8 +578,8 @@ def psf( * ``ON`` - The symbols (arrows or face outlines) will show up in color with the legend showing the corresponding color labels (default). - * ``OFF`` - The contour legend will not be displayed. The symbols (arrows or face outlines) will show up in - grey. The size of the arrows will be proportional to the applied load. + * ``OFF`` - The contour legend will not be displayed. The symbols (arrows or face outlines) will + show up in grey. The size of the arrows will be proportional to the applied load. Notes ----- @@ -764,6 +625,8 @@ def psf( This command is valid in any processor. + .. _psf.tab.1: + **/PSF - Valid Item and Component Labels** .. flat-table:: @@ -773,13 +636,13 @@ def psf( - Comp - Description - Comments - * - :rspan:`14` PRES [ ] + * - :rspan:`14` PRES [ :ref:`psf.labels.fn.1`] - NORM (or blank) - Applied pressure normal to the face (real component only). - For element types other than SURF153, SURF154 and SURF156. * - NORM - Applied pressure normal to the face (real component). - - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ ] + - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ :ref:`psf.labels.fn.2`] * - TANX - Applied pressure in the element tangential x direction (real component). * - TANY @@ -792,7 +655,7 @@ def psf( - Applied pressure in the element tangential y direction (imaginary component). * - LOCX - Applied pressure in the local x direction (real component). - - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ ] + - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ :ref:`psf.labels.fn.2`] * - LOCY - Applied pressure in the local y direction (real component). * - LOCZ @@ -805,7 +668,7 @@ def psf( - Applied pressure in the local z direction (imaginary component). * - RVEC - Applied pressure in the user-defined direction (real component). - - :rspan:`1` For `supported structural element`_ with``KCSYS`` = 2. [ ] + - :rspan:`1` For `supported structural element`_ with``KCSYS`` = 2. [ :ref:`psf.labels.fn.2`] * - IVEC - Applied pressure in the user-defined direction (imaginary component). * - :rspan:`1` CONV @@ -877,233 +740,297 @@ def psf( command = f"/PSF,{item},{comp},{key},{kshell},{color}" return self.run(command, **kwargs) - def psymb(self, label: str = "", key: int | str = "", **kwargs): - r"""Shows various symbols on displays. + def triad(self, lab: str = "", **kwargs): + r"""Shows the global XYZ coordinate triad on displays. - Mechanical APDL Command: `/PSYMB `_ + Mechanical APDL Command: `/TRIAD `_ Parameters ---------- - label : str - Show symbols as selected from the following labels: + lab : str + Display triad as follows: - * ``CS`` - Local coordinate systems. + * ``ORIG`` - Display triad at global origin (default). - * ``NDIR`` - Nodal coordinate systems (on rotated nodes only). + * ``OFF`` - Turn off triad display. - * ``ESYS`` - Element coordinate systems (element displays only). + * ``LBOT`` - Display triad in lower left screen corner. - * ``LDIR`` - Line directions (line displays only). + * ``RBOT`` - Display triad in lower right screen corner. - * ``LDIV`` - Controls the display of element divisions on lines. + * ``LTOP`` - Display triad in upper left screen corner. - * ``ADIR`` - Area direction symbol (for keypoint, line, area and volume plots). + * ``RTOP`` - Display triad in upper right screen corner. - * ``LAYR`` - Layer orientations (relative to the projected element x-axis) or fiber orientations in smeared - reinforcing elements. Used only within an element display. Use ``KEY`` to specify the layer number. + Notes + ----- - * ``ECON`` - Element mesh symbols on keypoints and lines. + .. _s-TRIAD_notes: - * ``DOT`` - Larger symbols displayed for node and keypoint locations. When ``Label`` = DOT, ``KEY`` = 1 by - default. + For efficiency, Mechanical APDL maintains a single data structure (segment) which includes the triad + as a + 3D data object. - * ``XNOD`` - Extra node of surface or circuit elements. + If a 3D device is involved ( :ref:`show`,3D) and the graphics are not being displayed as multi- + plots, the triad location is determined by the view settings for window #1. - * ``FBCS`` - Force boundary condition scaling. Subsequent ``KEY`` value determines whether or not to scale the - applied and derived forces/moments to the same maximum value. + A request for triad display anywhere except for the origin may yield an improper display in windows + 2 through 5. - * ``DEFA`` - Resets the symbol keys so that Mechanical APDL displays none of the symbols controlled by the :ref:`psymb` - command. The value of the ``KEY`` field is ignored. + The program displays the same segment in all windows. The view settings of each window constitute + the only difference in the display in the active windows. - * ``STAT`` - Prints the status of the settings of the symbol keys controlled by the :ref:`psymb` command. The - ``KEY`` field is ignored. + This command is valid in any processor. + """ + command = f"/TRIAD,{lab}" + return self.run(command, **kwargs) - * ``MARK`` - Controls the marker size ( :ref:`gmarker` ). When ``Label`` = MARK, ``KEY`` = 10 by default. + def contour( + self, + wn: str = "", + ncont: str = "", + vmin: str = "", + vinc: str = "", + vmax: str = "", + **kwargs, + ): + r"""Specifies the uniform contour values on stress displays. - key : int or str - Symbol key: + Mechanical APDL Command: `/CONTOUR `_ - * ``-1`` - Effective only if ``Label`` = LAYR and solid shape element display ( :ref:`eshape` ) is active. - Orientation of all layers appears with the solid shape element display. + **Command default:** - * ``0`` - No symbol (default). If ``Label`` = LDIV, then ``KEY`` = 0 indicates that the displayed element - divisions will correspond to the existing mesh (the word MESHED or EXISTING can also be - substituted). Also, for ``Label`` = LDIV, if you execute any meshing command (such as :ref:`amesh` - or :ref:`vmesh` ), ``KEY`` is set to 0 (MESHED) automatically. If ``Label`` = FBCS, then ``KEY`` = 0 - indicates that boundary condition scaling will not be common. The applied and derived forces/moments - will be scaled to their respective maximum values. + .. _s-CONTOUR_default: - * ``1`` - Include symbol. If ``Label`` = LDIV, then ``KEY`` = 1 indicates that the displayed line divisions - will correspond to the value assigned by :ref:`lesize` (the word LESIZE can also be substituted). - Also, for ``Label`` = LDIV, if you execute the :ref:`lesize` command, ``KEY`` is set to 1 (LESIZE) - automatically. If ``Label`` = FBCS, then ``KEY`` = 1 indicates that boundary condition scaling will - be common. The applied and derived forces/moments will be scaled to the same maximum value. + Nine contour values uniformly spaced between the extreme values, or no contours if the ratio of + range to minimum value (or range to maximum if minimum = 0) is less than 0.001. - * ``N`` - If ``Label`` = LAYR, then ``N`` is equal to the layer number. If ``Label`` = DOT, then ``N`` can be - equal to 0,1,.....15, indicating the dot size. If ``Label`` = MARK, then ``N`` can be equal to - 1,.....10, indicating the marker size. If + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). - ``Label`` = LDIV, then ``KEY`` = -1, indicates that no element divisions will be displayed (the - word OFF can also be substituted). + ncont : str + Number of contour values. ``NCONT`` defaults to 9 for X11 or WIN32 and to 128 for X11c or + WIN32C. The default graphics window display for 3D devices is a smooth continuous shading effect + that spans the maximum of 128 contours available. Use the :ref:`dv3d` command to create defined + banding for your contour values (values of 9 and 128 are displayed in smooth shading only). The + legend, however, will display only nine color boxes, which span the full range of colors + displayed in the graphics window. + + vmin : str + Minimum contour value. If ``VMIN`` = AUTO, automatically calculate contour values based upon + ``NCONT`` uniformly spaced values over the min-max extreme range. Or, if ``VMIN`` = USER, set + contour values to those of the last display (useful when last display automatically calculated + contours). + + vinc : str + Value increment (positive) between contour values. Defaults to ( ``VMAX`` - ``VMIN`` ) + ``/NCONT``. + + vmax : str + Maximum contour value. Ignored if both ``VMIN`` and ``VINC`` are specified. Notes ----- - .. _s-PSYMB_notes: + .. _s-CONTOUR_notes: - Includes various symbols on the display. Triads are right-handed with x displayed as the longest - leg. Where color is displayed, x is white, y is green, and z is blue. For beams, x is always along - the length of the element. For lines, an arrow represents the direction of a line, from the - beginning keypoint to the end keypoint. See :ref:`plopts` command for additional display options. - Use :ref:`pstatus` or :ref:`psymb`,STAT to display settings. Use :ref:`psymb`,DEFA to reset all - specifications back to their defaults. The command :ref:`psymb`,ECON,1 causes the symbol "M" to be - displayed on keypoints and lines associated with meshed entities. When you issue the command - :ref:`psymb`,DOT,1, a larger symbol is displayed for each node and keypoint location. Using - :ref:`psymb`,MARK,1, a smaller marker size can be displayed. + Values represent contour lines in vector mode, and the algebraic maximum of contour bands in raster + mode. - PowerGraphics ( :ref:`graphics`,POWER) does not support :ref:`psymb`,ESYS and :ref:`psymb`,LAYR. + Regardless of how many contours ( ``NCONT`` ) are specified, the actual number of contours appearing + on your display depends also on the device name, whether the display is directed to the screen or to + a file, the display mode (vector or raster), and the number of color planes. (All of those items are + controlled via :ref:`show`.) In any case, regardless of whether they are smoothed or banded, only + 128 contours can be displayed. - If ``KEY`` = ``N`` and PowerGraphics is off, the centroid of the surface elements is connected to - the extra node using a gray line. However, if PowerGraphics is on, the color of the line connecting - the centroid to the extra node is the same as that for the elements themselves (as determined by - :ref:`pnum` ). + For more information about changing the number of contours, see `Creating Geometric Results Displays + `_. - When ``Label`` = LAYR, the layer systems can be visualized with all current-technology layered - elements and the smeared reinforcing element REINF265. To use :ref:`psymb`,LAYR with REINF265, first - set the vector-mode graphics option ( :ref:`device`,VECTOR,1). + When the current Mechanical APDL graphics are not displayed as Multi-Plots: + + * If the current device is a 3D device ( :ref:`show`,3D), the model contours in all active windows + are the same, even if separate :ref:`contour` commands are issued for each active window. + * Mechanical APDL maintains a single data structure (segment) containing one set of contours. The + program + displays the same segment in all windows. The view settings of each window constitute the only + differences in the contour plots in the active windows. This command is valid in any processor. + + For alternate specifications, see :ref:`cval`. """ - command = f"/PSYMB,{label},{key}" + command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" return self.run(command, **kwargs) - def pnum(self, label: str = "", key: int | str = "", **kwargs): - r"""Controls entity numbering/coloring on plots. + def clabel(self, wn: str = "", key: int | str = "", **kwargs): + r"""Specifies contour labeling. + + Mechanical APDL Command: `/CLABEL `_ + + **Command default:** + + .. _s-CLABEL_default: - Mechanical APDL Command: `/PNUM `_ + Show contour line labels. Parameters ---------- - label : str - Type of numbering/coloring: - - * ``NODE`` - Node numbers on node and element plots. - - * ``ELEM`` - Element numbers and colors on element plots. + wn : str + Window number (or ALL) to which command applies (defaults to 1). - * ``SEC`` - Section numbers and colors on element and solid model plots (see ). + key : int or str + Labeling key: - * ``MAT`` - Material set numbers and colors on element and solid model plots (see ). + * ``0 or 1`` - Label contours with legend or color (default). - * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see ). + * ``-1`` - No contour labeling. - * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see ). + * ``N`` - Same as 1 except show alphabetic legend only on every ``N`` th element. - * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see ). + Notes + ----- - * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. + .. _s-CLABEL_notes: - LOC and ELEM numbers will be the same unless the model has been reordered. + Labels contours for identification with alphabetic legend for vector displays and color for raster + displays. Number of contours is automatically reduced to 9 (or fewer) for clarity. Use + :ref:`contour` command to increase (24 maximum for alphabetic labeling; no limit for color + labeling). - * ``KP`` - Keypoint numbers on solid model plots. + This command is valid in any processor. + """ + command = f"/CLABEL,{wn},{key}" + return self.run(command, **kwargs) - * ``LINE`` - Line numbers on solid model plots (both numbers and colors on line plots). + def cval( + self, + wn: str = "", + v1: str = "", + v2: str = "", + v3: str = "", + v4: str = "", + v5: str = "", + v6: str = "", + v7: str = "", + v8: str = "", + **kwargs, + ): + r"""Specifies nonuniform contour values on stress displays. - * ``AREA`` - Area numbers on solid model plots (both numbers and colors on area plots). + Mechanical APDL Command: `/CVAL `_ - * ``VOLU`` - Volume numbers on solid model plots (both numbers and colors on volume plots). + **Command default:** - * ``SVAL`` - Stress (or any contour) values on postprocessing plots, and surface load values and colors on model - plots when surface load symbols are on ( :ref:`psf` ). For tabular boundary conditions, the table- - evaluated values will be displayed on node, element, or contour displays in POST1 when load symbols - ( :ref:`pbf`, :ref:`psf`, :ref:`pbc` ) are on and TABNAM is OFF. + .. _s-CVAL_default: - * ``TABNAM`` - Table names for tabular boundary conditions. If this label is turned on, the table name appears next - to the appropriate symbol, arrow, face outline, or contour as dictated by the :ref:`psf`, - :ref:`pbc`, and :ref:`pbf` commands. + Nine contour values uniformly spaced between the extreme values. - * ``STAT`` - Shows current settings for :ref:`pnum`. + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). - * ``DEFA`` - Resets all :ref:`pnum` specifications back to default. + v1 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - key : int or str - Switch: + v2 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - * ``0`` - Turns OFF numbers/colors for specified label. + v3 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - * ``1`` - Turns ON numbers/colors for specified label. + v4 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - Notes - ----- + v5 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - .. _s-PNUM_notes: + v6 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - This command specifies entity numbering and coloring for subsequent plots. + v7 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - The MAT, TYPE, REAL, and ESYS labels activate both the numbering and coloring of the corresponding - attributes for :ref:`eplot`, :ref:`kplot`, :ref:`lplot`, :ref:`aplot`, and :ref:`vplot`. The ELEM, - MAT, TYPE, REAL, ESYS, and LOC labels are mutually exclusive, that is, only one can be specified at - a time. Also, turning on a LINE, AREA, or VOLU label will turn off the MAT, TYPE, and REAL labels. + v8 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. - PowerGraphics ( :ref:`graphics`,POWER) displays for :ref:`pnum` can be problematic. :ref:`pnum`,ELEM - will display erratically depending on other display command specifications, while :ref:`pnum`,LOC - and :ref:`pnum`,ESYS are not supported. + Notes + ----- - Element and volume numbers are not visible for 3D elements and volumes when Z-buffering is turned on - ( :ref:`slashtype`,,[6,7, or 8]). + .. _s-CVAL_notes: - Use :ref:`pstatus` or :ref:`pnum`,STAT to show settings. Use :ref:`pnum`,DEFA to reset all - specifications back to default. Use the :ref:`number` command to control whether numbers and colors - are displayed together. + This command is similar to the :ref:`contour` command. With :ref:`cval`, however, you define the + upper level of each contour band instead of having the contours uniformly distributed over the + range. The minimum value (including a zero value for the first band) for a contour band cannot be + specified. If you use both :ref:`contour` and :ref:`cval`, the last command issued takes precedence. - This command is valid in any processor + This command is valid in any processor. """ - command = f"/PNUM,{label},{key}" + command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" return self.run(command, **kwargs) - def triad(self, lab: str = "", **kwargs): - r"""Shows the global XYZ coordinate triad on displays. + def cformat(self, nfirst: str = "", nlast: str = "", **kwargs): + r"""Controls the graphical display of alphanumeric character strings for parameters, components, + assemblies, and tables. - Mechanical APDL Command: `/TRIAD `_ + Mechanical APDL Command: `/CFORMAT `_ Parameters ---------- - lab : str - Display triad as follows: - - * ``ORIG`` - Display triad at global origin (default). - - * ``OFF`` - Turn off triad display. + nfirst : str + Display the first ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 32. - * ``LBOT`` - Display triad in lower left screen corner. + nlast : str + Display the last ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 0. - * ``RBOT`` - Display triad in lower right screen corner. + Notes + ----- - * ``LTOP`` - Display triad in upper left screen corner. + .. _s-CFORMAT_notes: - * ``RTOP`` - Display triad in upper right screen corner. + Use this command to control the length of the character string that is shown in the graphics window + for a parameter, component, assembly, or table name. - Notes - ----- + The total number of characters ( ``NFIRST`` + ``NLAST`` +3) cannot exceed 32. - .. _s-TRIAD_notes: + If ``NFIRST`` is greater than zero and ``NLAST`` = 0, only the ``NFIRST`` characters are displayed, + followed by an ellipsis. - For efficiency, Mechanical APDL maintains a single data structure (segment) which includes the triad - as a - 3D data object. + If ``NFIRST`` = 0 and ``NLAST`` is greater than zero, only the ``NLAST`` characters are displayed, + preceded by an ellipsis (...). - If a 3D device is involved ( :ref:`show`,3D) and the graphics are not being displayed as multi- - plots, the triad location is determined by the view settings for window #1. + If both ``NFIRST`` and ``NLAST`` are greater than zero, the name will be shown as ``NFIRST``, + followed by an ellipsis (...), followed by ``NLAST``, up to a maximum of 32 characters. - A request for triad display anywhere except for the origin may yield an improper display in windows - 2 through 5. + For example, if ``NFIRST`` = 6 and ``NLAST`` = 3, and the character string is LENGTHOFSIDEONE, then + it will appear in the graphics window as LENGTH...ONE. - The program displays the same segment in all windows. The view settings of each window constitute - the only difference in the display in the active windows. + If the actual length of the character string is less than the specified combination of ``NFIRST`` + + ``NLAST`` +3, then the actual string will be used. This command is valid in any processor. """ - command = f"/TRIAD,{lab}" + command = f"/CFORMAT,{nfirst},{nlast}" return self.run(command, **kwargs) def udoc(self, wind: str = "", class_: str = "", key: str = "", **kwargs): @@ -1119,47 +1046,47 @@ def udoc(self, wind: str = "", class_: str = "", key: str = "", **kwargs): class_ : str The type (and relative importance) of legend item being displayed: - * ``CNTR`` - Contour legend. This legend item is controlled separately from the other legend items (see note - below). + * ``CNTR`` - Contour legend. This legend item is controlled separately from the other legend items + (see note below). * ``DATE`` - The items in the DATE class include the date and time, or the Mechanical APDL graphical logo ( :ref:`plopts`,LOGO,1). This item is shown by default in all plots. - * ``GWIN`` - The items in the GWIN class include the entity acronyms that appear in the legend of a multiplot of - entities (Nodes, Elements, Keypoints, Lines, Areas, Volumes). GWIN items are shown by default for - all :ref:`gplot` displays. + * ``GWIN`` - The items in the GWIN class include the entity acronyms that appear in the legend of a + multiplot of entities (Nodes, Elements, Keypoints, Lines, Areas, Volumes). GWIN items are shown by + default for all :ref:`gplot` displays. - * ``TYPE`` - Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL SOLUTIONS, etc.). - TYPE items are shown by default in all plots. + * ``TYPE`` - Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL + SOLUTIONS, etc.). TYPE items are shown by default in all plots. - * ``TYP2`` - Items in the TYP2 class include supplementary type information, such as DMAX and SMAX for nodal - solutions. TYP2 items are shown by default in all plots. + * ``TYP2`` - Items in the TYP2 class include supplementary type information, such as DMAX and SMAX + for nodal solutions. TYP2 items are shown by default in all plots. - * ``INUM`` - Items in the INUM class include the number labels generated by the :ref:`pnum` command. This class - is displayed by default in all plots that contain :ref:`pnum` information. + * ``INUM`` - Items in the INUM class include the number labels generated by the :ref:`pnum` command. + This class is displayed by default in all plots that contain :ref:`pnum` information. - * ``BCDC`` - The items in the BCDC class include labels created by the :ref:`pbc` command. This class is shown by - default in all plots which contain :ref:`pbc` information. + * ``BCDC`` - The items in the BCDC class include labels created by the :ref:`pbc` command. This + class is shown by default in all plots which contain :ref:`pbc` information. - * ``VECT`` - Items in the VECT class include labels created by the :ref:`plvect` command. This class is shown by - default for all :ref:`plvect` plots. + * ``VECT`` - Items in the VECT class include labels created by the :ref:`plvect` command. This class + is shown by default for all :ref:`plvect` plots. - * ``SURF`` - The items in the SURF class include labels from the :ref:`psf` legend. This class is shown by - default on all plots of surface boundary conditions. + * ``SURF`` - The items in the SURF class include labels from the :ref:`psf` legend. This class is + shown by default on all plots of surface boundary conditions. - * ``BODY`` - Items from the BODY class include labels from the :ref:`pbf` legend. This class is shown by default - in all plots of body forces. + * ``BODY`` - Items from the BODY class include labels from the :ref:`pbf` legend. This class is + shown by default in all plots of body forces. - * ``PSTA`` - Items from the PSTA class include stress scaling statistics, such as the :ref:`sscale` setting. This - class is not shown as the default for any type of plot, and must be specifically referenced to - display the included data. + * ``PSTA`` - Items from the PSTA class include stress scaling statistics, such as the :ref:`sscale` + setting. This class is not shown as the default for any type of plot, and must be specifically + referenced to display the included data. - * ``VIEW`` - The items in the VIEW class include view statistics. This class is not shown as the default for any - type of plot, and must be specifically referenced to display the included data. + * ``VIEW`` - The items in the VIEW class include view statistics. This class is not shown as the + default for any type of plot, and must be specifically referenced to display the included data. - * ``MISC`` - The items in the MISC class include supplementary labels like /EXPANDED and Stress Section Cross - Section. This class is not shown as the default for any type of plot, and must be specifically - referenced to display the included data. + * ``MISC`` - The items in the MISC class include supplementary labels like /EXPANDED and Stress + Section Cross Section. This class is not shown as the default for any type of plot, and must be + specifically referenced to display the included data. key : str Switch: @@ -1195,6 +1122,89 @@ class is not shown as the default for any type of plot, and must be specifically command = f"/UDOC,{wind},{class_},{key}" return self.run(command, **kwargs) + def hbc(self, wn: str = "", key: str = "", **kwargs): + r"""Determines how boundary condition symbols are displayed in a display window. + + Mechanical APDL Command: `/HBC `_ + + Parameters + ---------- + wn : str + Window reference number. This number can be any window numbered 1 to 5, or ALL (for all active + windows). Default = 1. + + key : str + Controls hidden-surface boundary condition display behavior: + + ON, YES or 1 = Enable - Your boundary condition symbols are processed by the hidden-surface + algorithm (for 2D graphics devices) and use an improved pressure-contour display (for 2D and 3D + graphics devices). + + OFF, NO or 0 (default) = Disable (default) - Your boundary condition symbols are not processed + by the hidden-surface algorithm.. + + Notes + ----- + + .. _s-HBC_notes: + + With :ref:`hbc`, ``WN``,ON in effect, Mechanical APDL does not display symbols obscured by the model + in the + current view (that is, symbols inside of or behind the model are not drawn). This behavior lessens + display clutter. + """ + command = f"/HBC,{wn},{key}" + return self.run(command, **kwargs) + + def number(self, nkey: int | str = "", **kwargs): + r"""Specifies whether numbers, colors, or both are used for displays. + + Mechanical APDL Command: `/NUMBER `_ + + Parameters + ---------- + nkey : int or str + Numbering style: + + * ``0`` - Color (terminal dependent) the numbered items and show numbers. + + * ``1`` - Color the numbered items. Do not show the numbers. + + * ``2`` - Show the numbers. Do not color the items. + + * ``-1`` - Do not color the items or show the numbers. For contour plots, the resulting display will + vary (see below). + + Notes + ----- + + .. _s-NUMBER_notes: + + Specifies whether numbers, colors, or both are used for numbering displays ( :ref:`pnum` ) of nodes, + elements, keypoints, lines, areas, and volumes. + + Shading is also available for terminals configured with more than 4 color planes ( :ref:`show` ). + Color automatically appears for certain items and may be manually controlled (off or on) for other + items. + + When you suppress color ( ``NKEY`` = -1) your contour plots will produce different results, + depending on your graphics equipment. For non-3D devices (X11, Win32, etc.) your contour plot will + be white (no color). For 3D devices, such as OpenGL, the resulting display will be in color. + + The following items are automatically given discrete colors: Boundary condition symbols ( :ref:`pbc` + ), curves on graph displays, and distorted geometry on postprocessing displays. Contour lines in + postprocessing displays are automatically colored based upon a continuous, rather than a discrete, + spectrum so that red is associated with the highest contour value. On terminals with raster + capability ( :ref:`show` ), the area between contour lines is filled with the color of the higher + contour. + + Explicit entity colors or the discrete color mapping may be changed with the :ref:`color` command. + + This command is valid in any processor. + """ + command = f"/NUMBER,{nkey}" + return self.run(command, **kwargs) + def gformat(self, ftype: str = "", nwidth: str = "", dsignf: str = "", **kwargs): r"""Specifies the format for the graphical display of numbers. diff --git a/src/ansys/mapdl/core/_commands/graphics/scaling.py b/src/ansys/mapdl/core/_commands/graphics/scaling.py index 53b26e93bc5..54c16f11dbf 100644 --- a/src/ansys/mapdl/core/_commands/graphics/scaling.py +++ b/src/ansys/mapdl/core/_commands/graphics/scaling.py @@ -23,6 +23,20 @@ class Scaling: + def iclwid(self, factor: str = "", **kwargs): + r"""Scales the line width of circuit builder icons. + + Mechanical APDL Command: `/ICLWID `_ + + Parameters + ---------- + factor : str + Multiplication factor applied to the default line width (defaults to 1). The minimum is 1 and + the maximum is 6. + """ + command = f"/ICLWID,{factor}" + return self.run(command, **kwargs) + def icscale(self, wn: str = "", factor: str = "", **kwargs): r"""Scales the icon size for elements supported in the circuit builder. @@ -47,18 +61,39 @@ def icscale(self, wn: str = "", factor: str = "", **kwargs): command = f"/ICSCALE,{wn},{factor}" return self.run(command, **kwargs) - def iclwid(self, factor: str = "", **kwargs): - r"""Scales the line width of circuit builder icons. + def vscale(self, wn: str = "", vratio: str = "", key: int | str = "", **kwargs): + r"""Scales the length of displayed vectors. - Mechanical APDL Command: `/ICLWID `_ + Mechanical APDL Command: `/VSCALE `_ Parameters ---------- - factor : str - Multiplication factor applied to the default line width (defaults to 1). The minimum is 1 and - the maximum is 6. + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + vratio : str + Ratio value applied to the automatically calculated scale factor (defaults to 1.0, that is, use + scale factor as automatically calculated). + + key : int or str + Relative scaling key: + + * ``0`` - Use relative length scaling among vectors based on magnitudes. + + * ``1`` - Use uniform length scaling for all vector lengths. + + Notes + ----- + + .. _s-VSCALE_notes: + + Allows scaling of the vector length displayed with the :ref:`plvect` command of POST1 and the + :ref:`pbc` and :ref:`psf` commands. Also allows the scaling of the element (that is, + :ref:`psymb`,ESYS) and the nodal (that is, :ref:`psymb`,NDIR) coordinate system symbols. + + This command is valid in any processor. """ - command = f"/ICLWID,{factor}" + command = f"/VSCALE,{wn},{vratio},{key}" return self.run(command, **kwargs) def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): @@ -72,12 +107,14 @@ def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): The default value is AUTO or 0 except when: - Large deflection effects are included ( :ref:`nlgeom`,ON) and it is not a modal analysis; then the - default is 1. It is a spectrum analysis ( :ref:`antype`,SPECTR); then the default is OFF. The - amplitude of a time-harmonic solution is computed using the :ref:`hrcplx` command (OMEGAT _font - FamName="Agency FB"? ≥ /_font? 360 _font FamName="Agency FB"? ° /_font? ); then the default is OFF. - The amplitude of a complex modal or harmonic solution is stored into the database using the - :ref:`set` command ( ``KIMG`` = AMPL); then the default is OFF. + * Large deflection effects are included ( :ref:`nlgeom`,ON) and it is not a modal analysis; then the + default is 1. + * It is a spectrum analysis ( :ref:`antype`,SPECTR); then the default is OFF. + * The amplitude of a time-harmonic solution is computed using the :ref:`hrcplx` command (OMEGAT + _font FamName="Agency FB"? ≥ /_font? 360 _font FamName="Agency FB"? ° /_font? ); then the default + is OFF. + * The amplitude of a complex modal or harmonic solution is stored into the database using the + :ref:`set` command ( ``KIMG`` = AMPL); then the default is OFF. Parameters ---------- @@ -86,18 +123,19 @@ def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): dmult : int or str - * ``AUTO or 0`` - Scale displacements automatically so that maximum displacement (vector amplitude) displays as 5 - percent of the maximum model length, as measured in the global Cartesian X, Y, or Z directions. + * ``AUTO or 0`` - Scale displacements automatically so that maximum displacement (vector amplitude) + displays as 5 percent of the maximum model length, as measured in the global Cartesian X, Y, or Z + directions. - * ``1`` - Do not scale displacements (that is, scale displacements by 1.0, true to geometry). Often used with - large deflection results. + * ``1`` - Do not scale displacements (that is, scale displacements by 1.0, true to geometry). Often + used with large deflection results. * ``FACTOR`` - Scale displacements by numerical value input for FACTOR. * ``OFF`` - Remove displacement scaling (that is, scale displacements by 0.0, no distortion). - * ``USER`` - Set ``DMULT`` to that used for last display (useful when last ``DMULT`` value was automatically - calculated). + * ``USER`` - Set ``DMULT`` to that used for last display (useful when last ``DMULT`` value was + automatically calculated). Notes ----- @@ -145,41 +183,6 @@ def ratio(self, wn: str = "", ratox: str = "", ratoy: str = "", **kwargs): command = f"/RATIO,{wn},{ratox},{ratoy}" return self.run(command, **kwargs) - def vscale(self, wn: str = "", vratio: str = "", key: int | str = "", **kwargs): - r"""Scales the length of displayed vectors. - - Mechanical APDL Command: `/VSCALE `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - vratio : str - Ratio value applied to the automatically calculated scale factor (defaults to 1.0, that is, use - scale factor as automatically calculated). - - key : int or str - Relative scaling key: - - * ``0`` - Use relative length scaling among vectors based on magnitudes. - - * ``1`` - Use uniform length scaling for all vector lengths. - - Notes - ----- - - .. _s-VSCALE_notes: - - Allows scaling of the vector length displayed with the :ref:`plvect` command of POST1 and the - :ref:`pbc` and :ref:`psf` commands. Also allows the scaling of the element (that is, - :ref:`psymb`,ESYS) and the nodal (that is, :ref:`psymb`,NDIR) coordinate system symbols. - - This command is valid in any processor. - """ - command = f"/VSCALE,{wn},{vratio},{key}" - return self.run(command, **kwargs) - def sscale(self, wn: str = "", smult: str = "", **kwargs): r"""Sets the contour multiplier for topographic displays. diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index b6afd209489..1d0158b0b2f 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -109,40 +109,40 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): lab : str Mode label: - * ``ACCU`` - Activating the accumulation buffer for OpenGL graphics, providing faster model rotation when shaded - backgrounds are in use. This feature is off by default. + * ``ACCU`` - Activating the accumulation buffer for OpenGL graphics, providing faster model rotation + when shaded backgrounds are in use. This feature is off by default. - * ``ACTR`` - Label term to designate the cursor position as the center for automatic dynamic rotational center - capability. The subsequent ``Key`` value (see below) turns this capability on and off. This feature - is on by default. (Available for OpenGL displays only.) + * ``ACTR`` - Label term to designate the cursor position as the center for automatic dynamic + rotational center capability. The subsequent ``Key`` value (see below) turns this capability on and + off. This feature is on by default. (Available for OpenGL displays only.) - * ``ANIM`` - Animation mode. The ANIM option allows you to create animation frames in pixmap mode instead of - display list mode. This may improve large model performance, but it eliminates local manipulation - while animation is in progress. This feature is on by default. + * ``ANIM`` - Animation mode. The ANIM option allows you to create animation frames in pixmap mode + instead of display list mode. This may improve large model performance, but it eliminates local + manipulation while animation is in progress. This feature is on by default. - * ``ANTI`` - Label term to control Anti-aliasing, a smoothing technique for your graph plots. (see below) The - subsequent ``Key`` value turns this capability on and off. The default for this feature is off. - (Available for OpenGL displays only). + * ``ANTI`` - Label term to control Anti-aliasing, a smoothing technique for your graph plots. (see + below) The subsequent ``Key`` value turns this capability on and off. The default for this feature + is off. (Available for OpenGL displays only). - * ``CNTR`` - Switches banded contours on (1) or off (0) for your 3D contour display. The default is 1 (ON). Other - contour parameters such as number of contours or the increment and range are defined using the - :ref:`contour` command. When either 9 or 128 contours are specified via :ref:`contour`, this command - is ignored and a smooth contour is always displayed. + * ``CNTR`` - Switches banded contours on (1) or off (0) for your 3D contour display. The default is + 1 (ON). Other contour parameters such as number of contours or the increment and range are defined + using the :ref:`contour` command. When either 9 or 128 contours are specified via :ref:`contour`, + this command is ignored and a smooth contour is always displayed. - * ``DGEN`` - Local manipulation degenerate mode. You access the DGEN option to set wire-frame local manipulation - mode for 3D devices (device dependent). This feature is off by default. + * ``DGEN`` - Local manipulation degenerate mode. You access the DGEN option to set wire-frame local + manipulation mode for 3D devices (device dependent). This feature is off by default. - * ``DLIST`` - With DLIST, you can specify whether screen updates and redraws will be performed using the Mechanical APDL - display list (off), or the 3D device's display list (on). DLIST is on by default for Windows - systems, but off for Linux. + * ``DLIST`` - With DLIST, you can specify whether screen updates and redraws will be performed using + the Mechanical APDL display list (off), or the 3D device's display list (on). DLIST is on by default for + Windows systems, but off for Linux. - * ``DELS`` - You use DELS to suppress contour display screen overwrites when :ref:`noerase` is active. This - prevents the bleed-through that occurs when you overlay contour plots. + * ``DELS`` - You use DELS to suppress contour display screen overwrites when :ref:`noerase` is + active. This prevents the bleed-through that occurs when you overlay contour plots. - * ``TRIS`` - Triangle strip mode. Tri-stripping provides faster 3D display capabilities and is on by default. - Some display enhancements, such as texturing, are adversely affected by tri-stripping. You can turn - off tri-stripping in order to improve these display functions. Be sure to turn tri-stripping on - after the desired output is obtained. + * ``TRIS`` - Triangle strip mode. Tri-stripping provides faster 3D display capabilities and is on by + default. Some display enhancements, such as texturing, are adversely affected by tri-stripping. You + can turn off tri-stripping in order to improve these display functions. Be sure to turn tri- + stripping on after the desired output is obtained. key : int or str The following key options apply to ``Lab`` = ACCU: @@ -153,14 +153,15 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): The following key options apply to ``Lab`` = ACTR: - * ``0`` - (OFF) The cursor position has no effect on the existing rotational center for dynamic operations. + * ``0`` - (OFF) The cursor position has no effect on the existing rotational center for dynamic + operations. - * ``1`` - (ON) The rotational center for dynamic rotations in OpenGL is determined by the position of the - mouse cursor on (or within 15 pixels of) the model. Any rotations that are initiated with the cursor - more than 15 pixels from the model will occur about the midpoint of the Z-axis at that point in - space. If the Z-buffer has not been refreshed the Z-axis will have an infinite value, and rotations - will appear to occur about an extremely long Z-axis. This behavior stops when the graphics window is - refreshed or replotted. (default) + * ``1`` - (ON) The rotational center for dynamic rotations in OpenGL is determined by the position + of the mouse cursor on (or within 15 pixels of) the model. Any rotations that are initiated with the + cursor more than 15 pixels from the model will occur about the midpoint of the Z-axis at that point + in space. If the Z-buffer has not been refreshed the Z-axis will have an infinite value, and + rotations will appear to occur about an extremely long Z-axis. This behavior stops when the graphics + window is refreshed or replotted. (default) Note that when using the GUI in 3D mode, when ACTR = 1, the ``Rotational Center`` option is grayed out under Utility Menu> PlotCtrls> View Setting because the rotational center is determined strictly @@ -168,12 +169,12 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): The following key options apply to ``Lab`` = ANIM: - * ``0`` - Display list animation. The object can be dynamically manipulated while animating. No legend, - countour or annotation items are displayed. (see Notes, below) + * ``0`` - Display list animation. The object can be dynamically manipulated while animating. No + legend, countour or annotation items are displayed. (see Notes, below) - * ``1`` - On Linux, device-dependent pixmap animation is used. On the PC, bitmap animation is provided - (default). When you animate in this mode, you cannot dynamically manipulate your model (see Notes, - below). + * ``1`` - On Linux, device-dependent pixmap animation is used. On the PC, bitmap animation is + provided (default). When you animate in this mode, you cannot dynamically manipulate your model (see + Notes, below). * ``2`` - On the PC only, this option provides AVI animation which uses the AVI movie player. @@ -186,8 +187,8 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): * ``0`` - (OFF) Anti-aliasing is not active (default). - * ``1`` - (ON) The anti-aliasing technique will be applied to smooth the lines in your displays (valid for - OpenGL only). + * ``1`` - (ON) The anti-aliasing technique will be applied to smooth the lines in your displays + (valid for OpenGL only). The following key options apply to ``Lab`` = DGEN: @@ -197,10 +198,11 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): The following key options apply to ``Lab`` = DLIST: - * ``0`` - (OFF) The Mechanical APDL display list is used for plotting and dynamic graphics manipulation (Linux - default). + * ``0`` - (OFF) The Mechanical APDL display list is used for plotting and dynamic graphics manipulation + (Linux default). - * ``1`` - (ON) The local (3D device) display list is used for plotting and dynamic rotation (Windows default). + * ``1`` - (ON) The local (3D device) display list is used for plotting and dynamic rotation (Windows + default). The following key options apply to ``Lab`` = TRIS: @@ -210,6 +212,13 @@ def dv3d(self, lab: str = "", key: int | str = "", **kwargs): Notes ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + Mechanical APDL uses display list animation for its 3D models. This memory resident array method interfaces with the OpenGL model information to allow the program to efficiently pan, zoom, rotate and @@ -248,18 +257,19 @@ def device(self, label: str = "", key: int | str = "", **kwargs): For any PowerGraphics plots involving elements, regardless of :ref:`show` settings, plots will generally be displayed faster. - * ``VECTOR`` - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display geometries are - shown as outlines (wireframes). When vector mode is off (default), these entities are shown filled - with color. + * ``VECTOR`` - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display + geometries are shown as outlines (wireframes). When vector mode is off (default), these entities are + shown filled with color. - * ``DITHER`` - When dithering is turned on (default), color intensity transitions are smoothed. This selection a + * ``DITHER`` - When dithering is turned on (default), color intensity transitions are smoothed. This + selection a applies only to smooth-shaded images, that is, Z-buffered ( :ref:`slashtype` ), or raster plots with Gouraud or Phong shading ( :ref:`shade` ). - * ``ANIM`` - Select the animation type used on 2D devices on the PC platform. A ``KEY`` value of BMP (or 0) sets - animation mode to the Mechanical APDL animation controller (default). A ``KEY`` value of AVI (or 2) sets - animation mode to AVI movie player file. + * ``ANIM`` - Select the animation type used on 2D devices on the PC platform. A ``KEY`` value of BMP + (or 0) sets animation mode to the Mechanical APDL animation controller (default). A ``KEY`` value of AVI + (or 2) sets animation mode to AVI movie player file. * ``FONT`` - Font selection for the Mechanical APDL graphics window. When ``Label`` = FONT, the command format is: :ref:`device`,FONT, ``KEY``, ``Val1``, ``Val2``, ``Val3``, ``Val4``, ``Val5``, ``Val6`` where @@ -278,15 +288,15 @@ def device(self, label: str = "", key: int | str = "", **kwargs): Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 are character strings; value 4 is a nonzero integer: - * ``Val1`` - Family name (for example, Courier). If ``Val1`` = MENU, all other values are ignored and a font - selection menu appears (GUI must be active). + * ``Val1`` - Family name (for example, Courier). If ``Val1`` = MENU, all other values are ignored + and a font selection menu appears (GUI must be active). * ``Val2`` - Weight (for example, medium) * ``Val3`` - Slant (for example, r) - * ``Val4`` - Pixel size (for example, 14). Note that this value does no affect the annotation fonts ( ``KEY`` = - 3). Use the :ref:`tspec` command for annotation font size. + * ``Val4`` - Pixel size (for example, 14). Note that this value does no affect the annotation fonts + ( ``KEY`` = 3). Use the :ref:`tspec` command for annotation font size. * ``Val5`` - unused @@ -295,10 +305,10 @@ def device(self, label: str = "", key: int | str = "", **kwargs): PC: The values are encoded in a PC logical font structure. Value 1 is a character string, and the remaining values are integers: - * ``Val1`` - Family name (for example, Courier\2New) Substitute an asterisk (\2) for any blank character that - appears in a family name. If ``Val1`` = MENU, all other values are ignored and a font selection menu - appears (GUI must be active). When this value is blank, Mechanical APDL uses the first available resource - it finds. + * ``Val1`` - Family name (for example, Courier\2New) Substitute an asterisk (\2) for any blank + character that appears in a family name. If ``Val1`` = MENU, all other values are ignored and a font + selection menu appears (GUI must be active). When this value is blank, Mechanical APDL uses the first + available resource it finds. * ``Val2`` - Weight (0 - 1000) @@ -310,11 +320,11 @@ def device(self, label: str = "", key: int | str = "", **kwargs): * ``Val6`` - Italics (0 = OFF, 1 = ON) - * ``TEXT`` - Text size specification for the Mechanical APDL graphics window. Using this label with the :ref:`device` - command requires the following form: :ref:`device`,TEXT, ``KEY``, ``PERCENT``. ``KEY`` = 1 for - LEGEND fonts; ``KEY`` = 2 for ENTITY fonts. ``PERCENT`` specifies the new text size as a percent of - the default text size. If ``PERCENT`` = 100, the new text size is precisely the default size. If - ``PERCENT`` = 200, the new text size is twice the default text size. + * ``TEXT`` - Text size specification for the Mechanical APDL graphics window. Using this label with the + :ref:`device` command requires the following form: :ref:`device`,TEXT, ``KEY``, ``PERCENT``. ``KEY`` + = 1 for LEGEND fonts; ``KEY`` = 2 for ENTITY fonts. ``PERCENT`` specifies the new text size as a + percent of the default text size. If ``PERCENT`` = 100, the new text size is precisely the default + size. If ``PERCENT`` = 200, the new text size is twice the default text size. key : int or str Control key: @@ -381,6 +391,236 @@ def dsys(self, kcn: str = "", **kwargs): command = f"DSYS,{kcn}" return self.run(command, **kwargs) + def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): + r"""Provides PNG file export for Mechanical APDL displays. + + Mechanical APDL Command: `PNGR `_ + + Parameters + ---------- + kywrd : str + Specifies various PNG file export options. + + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` is either ON or OFF (blank is interpreted as OFF). + This option allows you to turn PNG file compression ON or OFF. If OPT = ON, then The VAL field is + read to determine the degree of compression. See the VALUE argument for acceptable compression + values. + + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire + plot. ``OPT`` can be either Horizontal (default) or Vertical. + + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. + ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), + respectively. + + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either + 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. + + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd + parameters listed above, are active. + + * ``STAT`` - Shows the current status of PNG file export. + + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + + * ``ON, OFF`` - If ``Kywrd`` = COMP, the values On and Off control the use of compression. The + degree of compression is determined by VAL + + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the + orientation of the plot. + + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, + Grayscale and Color, respectively. + + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) + fonts will be used + + val : int or str + ``VAL`` is active only when ``Kywrd`` = COMP, and determines the degree of compression applied to + the exported file (see above). + + * ``-1`` - Apply the default, optimum value for compression. This value represents the best + combination of speed and compression. It varies according to the release level of the ZLIB + compression package. + + * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression + level (fastest) and 9 is the highest compression level (slowest). + + """ + command = f"PNGR,{kywrd},{opt},{val}" + return self.run(command, **kwargs) + + def pstatus(self, wn: str = "", **kwargs): + r"""Displays the global or window display specifications. + + Mechanical APDL Command: `/PSTATUS `_ + + Parameters + ---------- + wn : str + Window number for status (defaults to global specifications). + + Notes + ----- + + .. _s-PSTATUS_notes: + + Displays the current global or window display specifications. Global display specifications are + common to all windows (e.g. :ref:`show`, etc.). Window display specifications are specific to one + window (e.g. :ref:`view`, :ref:`slashtype`, etc.). + + This command is valid in any processor. + """ + command = f"/PSTATUS,{wn}" + return self.run(command, **kwargs) + + def tiff(self, kywrd: str = "", opt: str = "", **kwargs): + r"""Provides TIFF file export for Mechanical APDL displays. + + Mechanical APDL Command: `TIFF `_ + + Parameters + ---------- + kywrd : str + Specifies various TIFF file export options. + + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` controls data compression for the output file. If + COMP = 0, then compression is off. If COMP = 1 (default), then compression is on. + + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire + plot. ``OPT`` can be either Horizontal (default) or Vertical. + + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color attribute of the saved + file. ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), + respectively. + + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either + 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. + + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd + parameters listed above, are active. + + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + + * ``1 or 0`` - If ``Kywrd`` = COMP, a value or 1 (on) or 0 (off) will control compression for the + TIFF file. + + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the + orientation of the plot. + + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, + Grayscale and Color, respectively. + + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) + fonts will be used + + """ + command = f"TIFF,{kywrd},{opt}" + return self.run(command, **kwargs) + + def mrep( + self, + name: str = "", + arg1: str = "", + arg2: str = "", + arg3: str = "", + arg4: str = "", + arg5: str = "", + arg6: str = "", + arg7: str = "", + arg8: str = "", + arg9: str = "", + arg10: str = "", + arg11: str = "", + arg12: str = "", + arg13: str = "", + arg14: str = "", + arg15: str = "", + arg16: str = "", + arg17: str = "", + arg18: str = "", + **kwargs, + ): + r"""Enables you to reissue the graphics command macro "name" during a replot or zoom operation. + + Mechanical APDL Command: `/MREP `_ + + Parameters + ---------- + name : str + The name identifying the macro file or macro block on a macro library file. The name can contain + up to eight characters maximum and must begin with a letter. + + arg1 : str + Values to be passed into the file or block. + + arg2 : str + Values to be passed into the file or block. + + arg3 : str + Values to be passed into the file or block. + + arg4 : str + Values to be passed into the file or block. + + arg5 : str + Values to be passed into the file or block. + + arg6 : str + Values to be passed into the file or block. + + arg7 : str + Values to be passed into the file or block. + + arg8 : str + Values to be passed into the file or block. + + arg9 : str + Values to be passed into the file or block. + + arg10 : str + Values to be passed into the file or block. + + arg11 : str + Values to be passed into the file or block. + + arg12 : str + Values to be passed into the file or block. + + arg13 : str + Values to be passed into the file or block. + + arg14 : str + Values to be passed into the file or block. + + arg15 : str + Values to be passed into the file or block. + + arg16 : str + Values to be passed into the file or block. + + arg17 : str + Values to be passed into the file or block. + + arg18 : str + Values to be passed into the file or block. + + Notes + ----- + + .. _s-MREP_notes: + + This command reissues the graphics command macro "name" during a replot operation ( :ref:`replot` ) + or a zoom ( :ref:`zoom` ) operation. The program passes the command macro arguments to the replot + and zoom feature for use by the graphics macro. You should place the ``s-MREP`` command at the end + of the graphics command macro, following the last graphics command within the macro, to enable the + replot or zoom feature. + """ + command = f"/MREP,{name},{arg1},{arg2},{arg3},,{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" + return self.run(command, **kwargs) + def color( self, lab: str = "", @@ -405,14 +645,14 @@ def color( lab : str Apply color to the items specified by the following labels: - * ``AXES`` - Determines the color (specified in next argument, ``Clab`` ) that the axes of a graph will be - plotted in. + * ``AXES`` - Determines the color (specified in next argument, ``Clab`` ) that the axes of a graph + will be plotted in. - * ``AXNUM`` - Determines the color (specified in next argument, ``Clab`` ) that the numbering on the axes of a - graph will be plotted in. + * ``AXNUM`` - Determines the color (specified in next argument, ``Clab`` ) that the numbering on the + axes of a graph will be plotted in. - * ``NUM`` - Discretely numbered items (such as element types, element materials, etc., as shown on the - :ref:`pnum` command). Also specify number (1 to 11) in the ``N1`` field. For example, + * ``NUM`` - Discretely numbered items (such as element types, element materials, etc., as shown on + the :ref:`pnum` command). Also specify number (1 to 11) in the ``N1`` field. For example, :ref:`color`,NUM,RED,3 will assign the color red to all items having the discrete number 3 (material displays would show elements having material 3 as red). @@ -426,15 +666,15 @@ def color( * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. - * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc.). This option is particularly useful when capturing - frames for animating a single isosurface value. + * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc.). This option is particularly useful + when capturing frames for animating a single isosurface value. - * ``WBAK`` - Window background. Use ``N1``, ``N2``, ``NINC`` fields for window numbers. The options that you - select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. + * ``WBAK`` - Window background. Use ``N1``, ``N2``, ``NINC`` fields for window numbers. The options + that you select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. - * ``b.c.label`` - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, CURR, F, M, HEAT, FLOW, - VF, AMPS, FLUX, CSG, CURT, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See the :ref:`pbc` command - for boundary condition label definitions. + * ``b.c.label`` - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, CURR, F, + M, HEAT, FLOW, VF, AMPS, FLUX, CSG, CURT, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See the + :ref:`pbc` command for boundary condition label definitions. * ``GRBAK`` - Graph background. @@ -446,18 +686,19 @@ def color( * ``CM`` - Component group. Use ``N1`` field for component name, ignore ``N2`` and ``NINC``. - * ``CNTR`` - Mechanical APDL contour stress colors. The maximum number of contours available is 128. The number of - colors that can be specified interactively (GUI) is 9. ( :ref:`contour`, 9). Any other setting will - yield inconsistent results. + * ``CNTR`` - Mechanical APDL contour stress colors. The maximum number of contours available is 128. The + number of colors that can be specified interactively (GUI) is 9. ( :ref:`contour`, 9). Any other + setting will yield inconsistent results. - * ``SMAX`` - Specifies that all stress values above the maximum value entered in :ref:`contour` will be displayed - in the color designated in the ``Clab`` field. Defaults to dark grey. + * ``SMAX`` - Specifies that all stress values above the maximum value entered in :ref:`contour` will + be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. - * ``SMIN`` - Specifies that all stress values below the minimum value entered in :ref:`contour` will be displayed - in the color designated in the ``Clab`` field. Defaults to dark grey. + * ``SMIN`` - Specifies that all stress values below the minimum value entered in :ref:`contour` will + be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. - * ``PBAK`` - Activates background shading options (see command syntax at end of argument descriptions below). The - options that you select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. + * ``PBAK`` - Activates background shading options (see command syntax at end of argument + descriptions below). The options that you select using ``Lab`` = PBAK will supersede those applied + using ``Lab`` = WBAK. clab : str Valid color labels are: @@ -518,6 +759,12 @@ def color( Notes ----- + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + .. _s-COLOR_notes: Issue :ref:`color`,STAT to display the current color mapping. Issue :ref:`color`,DEFA to reset the @@ -558,7 +805,8 @@ def cmap( * ``CREATE`` - Starts the CMAP utility and modifies or creates the specified file. - * ``SAVE`` - Writes the active color map to the specified file, which can be imported into future sessions. + * ``SAVE`` - Writes the active color map to the specified file, which can be imported into future + sessions. ncntr : str Number of contours to be defined. Default = 9 (even if an existing file is being modified). @@ -658,6 +906,25 @@ def window( command = f"/WINDOW,{wn},{xmin},{xmax},{ymin},{ymax},{ncopy}" return self.run(command, **kwargs) + def slashreset(self, **kwargs): + r"""Resets display specifications to their initial defaults. + + Mechanical APDL Command: `/RESET `_ + + Notes + ----- + + .. _s-RESET_notes: + + Resets slash display specifications ( :ref:`window`, :ref:`slashtype`, :ref:`view`, etc.) back to + their initial default settings (for convenience). Also resets the focus location to the geometric + center of the object. + + This command is valid in any processor. + """ + command = "/RESET" + return self.run(command, **kwargs) + def replot(self, label: str = "", **kwargs): r"""Reissues the last display command. @@ -670,8 +937,8 @@ def replot(self, label: str = "", **kwargs): * ``RESIZE`` - Issued internally when a graphics window resize occurs (Default). - * ``FAST`` - Only applicable for 3D devices that allow a fast redisplay for changes in the view characteristics - only. + * ``FAST`` - Only applicable for 3D devices that allow a fast redisplay for changes in the view + characteristics only. Notes ----- @@ -713,34 +980,16 @@ def replot(self, label: str = "", **kwargs): last display command (such as :ref:`eplot` ) displays the finite element model. To show boundary conditions, the following options are available: - Issue :ref:`replot` after you issue :ref:`sbctran` to transfer solid model boundary conditions to - the finite element model. Issue :ref:`replot` after you issue a solid model display command (such as - :ref:`vplot` ). + * Issue :ref:`replot` after you issue :ref:`sbctran` to transfer solid model boundary conditions to + the finite element model. + + * Issue :ref:`replot` after you issue a solid model display command (such as :ref:`vplot` ). This command is valid in any processor (except as noted above). """ command = f"/REPLOT,{label}" return self.run(command, **kwargs) - def slashreset(self, **kwargs): - r"""Resets display specifications to their initial defaults. - - Mechanical APDL Command: `/RESET `_ - - Notes - ----- - - .. _s-RESET_notes: - - Resets slash display specifications ( :ref:`window`, :ref:`slashtype`, :ref:`view`, etc.) back to - their initial default settings (for convenience). Also resets the focus location to the geometric - center of the object. - - This command is valid in any processor. - """ - command = "/RESET" - return self.run(command, **kwargs) - def noerase(self, **kwargs): r"""Prevents the screen erase between displays. @@ -772,379 +1021,186 @@ def noerase(self, **kwargs): command = "/NOERASE" return self.run(command, **kwargs) - def pstatus(self, wn: str = "", **kwargs): - r"""Displays the global or window display specifications. + def show( + self, + fname: str = "", + option: str = "", + vect: int | str = "", + ncpl: str = "", + **kwargs, + ): + r"""Specifies the device and other parameters for graphics displays. - Mechanical APDL Command: `/PSTATUS `_ + Mechanical APDL Command: `/SHOW `_ Parameters ---------- - wn : str - Window number for status (defaults to global specifications). + fname : str + Device name, file name, or keyword, as listed below: - Notes - ----- + * ``<, device name >`` - Any valid graphics display device name (for example, X11, 3D etc.). + Defaults to X11 for most systems. See `Getting Started with Graphics + `_ in the `Basic Analysis Guide `_ + for details. A device name must be defined before activating the Graphical User Interface (GUI). + Once the GUI is activated, the device name cannot be changed for that session, except for switching + between X11 and X11C. - .. _s-PSTATUS_notes: - - Displays the current global or window display specifications. Global display specifications are - common to all windows (e.g. :ref:`show`, etc.). Window display specifications are specific to one - window (e.g. :ref:`view`, :ref:`slashtype`, etc.). - - This command is valid in any processor. - """ - command = f"/PSTATUS,{wn}" - return self.run(command, **kwargs) - - def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): - r"""Provides PNG file export for Mechanical APDL displays. - - Mechanical APDL Command: `PNGR `_ - - Parameters - ---------- - kywrd : str - Specifies various PNG file export options. - - * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` is either ON or OFF (blank is interpreted as OFF). This option - allows you to turn PNG file compression ON or OFF. If OPT = ON, then The VAL field is read to - determine the degree of compression. See the VALUE argument for acceptable compression values. - - * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can - be either Horizontal (default) or Vertical. - - * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. ``OPT`` can be - 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. - - * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, - corresponding to bitmap text (default) or line stroke text, respectively. - - * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed - above, are active. - - * ``STAT`` - Shows the current status of PNG file export. - - opt : str - ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - - * ``ON, OFF`` - If ``Kywrd`` = COMP, the values On and Off control the use of compression. The degree of compression - is determined by VAL - - * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. - - * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, - respectively. - - * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will - be used - - val : int or str - ``VAL`` is active only when ``Kywrd`` = COMP, and determines the degree of compression applied to - the exported file (see above). - - * ``-1`` - Apply the default, optimum value for compression. This value represents the best combination of - speed and compression. It varies according to the release level of the ZLIB compression package. - - * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression level (fastest) - and 9 is the highest compression level (slowest). - - """ - command = f"PNGR,{kywrd},{opt},{val}" - return self.run(command, **kwargs) - - def tiff(self, kywrd: str = "", opt: str = "", **kwargs): - r"""Provides TIFF file export for Mechanical APDL displays. - - Mechanical APDL Command: `TIFF `_ - - Parameters - ---------- - kywrd : str - Specifies various TIFF file export options. - - * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` controls data compression for the output file. If COMP = 0, then - compression is off. If COMP = 1 (default), then compression is on. - - * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can - be either Horizontal (default) or Vertical. - - * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color attribute of the saved file. ``OPT`` can - be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. - - * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, - corresponding to bitmap text (default) or line stroke text, respectively. - - * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed - above, are active. - - opt : str - ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - - * ``1 or 0`` - If ``Kywrd`` = COMP, a value or 1 (on) or 0 (off) will control compression for the TIFF file. - - * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. - - * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, - respectively. - - * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will - be used - - """ - command = f"TIFF,{kywrd},{opt}" - return self.run(command, **kwargs) - - def mrep( - self, - name: str = "", - arg1: str = "", - arg2: str = "", - arg3: str = "", - arg4: str = "", - arg5: str = "", - arg6: str = "", - arg7: str = "", - arg8: str = "", - arg9: str = "", - arg10: str = "", - arg11: str = "", - arg12: str = "", - arg13: str = "", - arg14: str = "", - arg15: str = "", - arg16: str = "", - arg17: str = "", - arg18: str = "", - **kwargs, - ): - r"""Enables you to reissue the graphics command macro "name" during a replot or zoom operation. - - Mechanical APDL Command: `/MREP `_ - - Parameters - ---------- - name : str - The name identifying the macro file or macro block on a macro library file. The name can contain - up to eight characters maximum and must begin with a letter. - - arg1 : str - Values to be passed into the file or block. - - arg2 : str - Values to be passed into the file or block. - - arg3 : str - Values to be passed into the file or block. - - arg4 : str - Values to be passed into the file or block. + * ``TERM`` - Graphics displays are switched back to the last-specified device name. - arg5 : str - Values to be passed into the file or block. + * ``CLOSE`` - This option purges the graphics file buffer. The CLOSE option should be issued any + time you are changing graphics devices or file output types during a session. Graphics displays are + switched back to the last-specified device name, and any open graphics files are closed. The CLOSE + option is similar to the TERM option, however, with the CLOSE option, another process can access the + data in the graphics file. The CLOSE option causes graphics file buffers to be flushed to the + graphics file. - arg6 : str - Values to be passed into the file or block. + * ``OFF`` - Graphics display requests are ignored. - arg7 : str - Values to be passed into the file or block. + * ``(blank)`` - If blank in interactive mode, graphics will be displayed on screen as requested by + display commands (no file written). - arg8 : str - Values to be passed into the file or block. + * ``JPEG`` - Creates JPEG files that are named :file:`Jobname` nnn.jpg, where ``nnn`` is a numeric + value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.jpg`, :file:`Jobname001.jpg`, :file:`Jobname002.jpg`, and so on. Ignores the + ``Ext`` field. - arg9 : str - Values to be passed into the file or block. + * ``TIFF`` - Creates tagged image format files that are named :file:`Jobname` nnn.tif, where ``nnn`` + is a numeric value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.tif`, :file:`Jobname001.tif`, :file:`Jobname002.tif`, and so on. This value for + the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`tiff` command for options.) - arg10 : str - Values to be passed into the file or block. + * ``PNG`` - Creates PNG (Portable Network Graphics) files that are named :file:`Jobname` nnn.png, + where ``nnn`` is a numeric value that is incremented by one as each additional file is created; that + is, :file:`Jobname000.png`, :file:`Jobname001.png`, :file:`Jobname002.png`, and so on. This value + for the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`pngr` command for options.) - arg11 : str - Values to be passed into the file or block. + * ``VRML`` - Creates Virtual Reality Meta Language files named :file:`Jobname000.wrl` that can be + displayed on 3D Internet web browsers. Ignores the ``Ext`` and ``NCPL`` fields. - arg12 : str - Values to be passed into the file or block. + option : str + Assign a file name extension or specify reverse video output: - arg13 : str - Values to be passed into the file or block. + * ``Ext`` - File name extension (eight-character maximum). - arg14 : str - Values to be passed into the file or block. + * ``REV`` - Reverse background/image (black/white) colors. Valid with ``Fname`` = PNG (recommended), + JPEG, and TIFF. This option is ignored if a previously specified color map table ( :ref:`cmap` or + :ref:`rgb` ) is in effect. - arg15 : str - Values to be passed into the file or block. + vect : int or str + Specifies raster or vector display mode. This affects area, volume, and element displays, as well as + geometric results displays such as contour plots. See the :ref:`device` command for an alternate way to toggle between raster and vector mode. Changing ``VECT`` also resets the :ref:`slashtype` command to its default. - arg16 : str - Values to be passed into the file or block. + * ``0`` - Raster display (color filled entities; default) - arg17 : str - Values to be passed into the file or block. + * ``1`` - Vector display (outlined entities; that is, "wireframe") - arg18 : str - Values to be passed into the file or block. + ncpl : str + Sets the number of color planes (4 to 8). Default is device-dependent. ``NCPL`` is not supported + by all graphics devices. Notes ----- - .. _s-MREP_notes: - - This command reissues the graphics command macro "name" during a replot operation ( :ref:`replot` ) - or a zoom ( :ref:`zoom` ) operation. The program passes the command macro arguments to the replot - and zoom feature for use by the graphics macro. You should place the ``s-MREP`` command at the end - of the graphics command macro, following the last graphics command within the macro, to enable the - replot or zoom feature. - """ - command = f"/MREP,{name},{arg1},{arg2},{arg3},,{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" - return self.run(command, **kwargs) - - def gresume(self, fname: str = "", ext: str = "", **kwargs): - r"""Sets graphics settings to the settings on a file. - - Mechanical APDL Command: `/GRESUME `_ - - Parameters - ---------- - fname : str - File name and directory path (248 characters maximum, including the characters needed for the - directory path). An unspecified directory path defaults to the working directory; in this case, - you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. - - ext : str - Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is - blank. + .. _s-SHOW_notes: - Notes - ----- + Specifies the device to be used for graphics displays, and specifies other graphics display + parameters. Display may be shown at the time of generation (for interactive runs at a graphics + display terminal) or diverted to a file. Issue :ref:`pstatus` for display status. - .. _s-GRESUME_notes: + Batch runs do not have access to the fonts available on your system. The Courier and Helvetica font + files used for JPEG, PNG and TIFF batch output are copyrighted by Adobe Systems Inc. and Digital + Equipment Corp. Permission to use these trademarks is hereby granted only in association with the + images described above. Batch run JPEG output is produced at the default quality index value of 75, + unless specified otherwise. - Causes a file to be read to reset the graphics slash (/) commands as they were at the last - :ref:`gsave` command. + Interactive displays default to eight color planes ( ``NCPL`` = 8) for most monitors, while graph + file output defaults to eight color planes for VRML output, and four color planes for JPEG, PNG, and + TIFF. This command is valid in any processor. """ - command = f"/GRESUME,{fname},{ext}" + command = f"/SHOW,{fname},{option},{vect},{ncpl}" return self.run(command, **kwargs) - def gfile(self, size: str = "", **kwargs): - r"""Specifies the pixel resolution on Z-buffered graphics files. + def seg(self, label: str = "", aviname: str = "", delay: str = "", **kwargs): + r"""Allows graphics data to be stored in the local terminal memory. - Mechanical APDL Command: `/GFILE `_ + Mechanical APDL Command: `/SEG `_ Parameters ---------- - size : str - Pixel resolution. Defaults to a pixel resolution of 800. Valid values are from 256 to 2400. - - Notes - ----- + label : str + Storage key: - .. _s-GFILE_notes: + * ``SINGL`` - Store subsequent display in a single segment (overwrites last storage). - Defines the pixel resolution on subsequently written graphics files (for example, JPEG, PNG, TIFF) - for software Z-buffered displays ( :ref:`slashtype` ). Lowering the pixel resolution produces a - fuzzier image; increasing the resolution produces a sharper image but takes a little longer. + * ``MULTI`` - Store subsequent displays in unique segments ( :ref:`anim` ). - This command is valid in any processor. - """ - command = f"/GFILE,{size}" - return self.run(command, **kwargs) + * ``DELET`` - Delete all currently stored segments. - def graphics(self, key: str = "", **kwargs): - r"""Defines the type of graphics display. + * ``OFF`` - Stop storing display data in segments. - Mechanical APDL Command: `/GRAPHICS `_ + * ``STAT`` - Display segment status. - Parameters - ---------- - key : str - Graphics key: + * ``PC`` - This option only applies to PC versions of Mechanical APDL and only when animating via the AVI + movie player ( :ref:`device`,ANIM,2). The command appends frames to the :file:`File.AVI`, so that + the animation goes in both directions (that is, forward--backward--forward). You must have a current + animation file to use this option. - * ``FULL`` - Display all model geometry and results. + aviname : str + Name of the animation file that will be created when each frame is saved. The :file:`.AVI` + extension is applied automatically. Defaults to :file:`Jobname.AVI` if no filename is specified. - * ``POWER`` - Activate PowerGraphics (default when GUI is on). + delay : str + Delay factor between each frame, in seconds. Defaults to 0.015 seconds if no value is specified. Notes ----- - .. _s-GRAPHICS_notes: - - The :ref:`graphics` command specifies the type of graphics display. ``Key`` = POWER activates the - PowerGraphics capability. PowerGraphics offers faster plotting than the _nolinebreak? ``Key`` = FULL - option, /_nolinebreak? and speeds up element, results, area, line, and volume displays. - - The default PowerGraphics mode is enabled automatically when accessing the GUI. This action - supersedes all prior macros or start-up routines ( :file:`start.ans`, :file:`config.ans`, etc.). - Full graphics mode is accessed only by issuing :ref:`graphics`,FULL after the GUI is active. - - Results values (both printed and plotted) may differ between the _nolinebreak? ``Key`` = FULL - /_nolinebreak? and ``Key`` = POWER options because each option specifies a different set of data for - averaging and display. For _nolinebreak? ``Key`` = FULL /_nolinebreak?, all element and results - values (interior and surface) are included. For _nolinebreak? ``Key`` = POWER /_nolinebreak?, only - element and results values along the model exterior surface are processed. - - When ``Key`` = FULL, it is possible to deselect an individual node, select all elements (including - the element that contains that node), and then perform postprocessing calculations on those elements - and have that unselected node not be considered in those calculations. If PowerGraphics is active, - however, postprocessing always displays based on selected elements. - - If you have specified one facet per element edge for PowerGraphics displays (via the :ref:`efacet` - command or options from the General Postproc or Utility menu), PowerGraphics does not plot midside - nodes. ( :ref:`efacet` applies to element type displays only.) - - Maximum values shown in plots can differ from printed maximum values. This is due to different - averaging schemes used for plotted and printed maximum values. - - When using solution coordinate systems for results output ( :ref:`rsys`,SOLU) with PowerGraphics, - the deformed or displaced shape in a POST1 contour display can be unexpected (although the contours - are displayed in the expected colors). The program does not rotate displacement values (Ux,Uy,Uz) to - global; instead, the displacements (stored locally) are added directly to the global coordinates - (X,Y,Z). For example, if in PREP7 the nodes are rotated 90 degrees about the z axis and the global - Uy displacements are relatively large, the Ux values will be large, causing the model to display a - large deformation in the global X direction. - - PowerGraphics displays do not average at geometric discontinuities. The printouts in PowerGraphics - will, however, provide averaging information at geometric discontinuities if the models do not - contain shell elements. Carefully inspect the data you obtain at geometric discontinuities. - - PowerGraphics does not support the following diffusion analysis results: CONC, CG, DF, EPDI. - - ``Key`` = FULL is not available for `XFEM-based crack-growth analysis - `_. + .. _s-SEG_notes: - Excepting a few options, PowerGraphics supports these commands: + Allows graphics data to be stored in the terminal local memory (device-dependent). Storage occurs + concurrently with the display. - InformalTables need to be added. - The following commands are executed via the _nolinebreak? ``Key`` = FULL /_nolinebreak? option, - regardless of whether PowerGraphics is activated: + Although the information from your graphics window is stored as an individual segment, you cannot + plot directly ( :ref:`gplot` ) from the segment memory. - InformalTables need to be added. + This command is valid in any processor. """ - command = f"/GRAPHICS,{key}" + command = f"/SEG,{label},{aviname},{delay}" return self.run(command, **kwargs) - def gcolumn(self, curve: str = "", string: str = "", **kwargs): - r"""Allows the user to apply a label to a specified curve. + def gsave(self, fname: str = "", ext: str = "", **kwargs): + r"""Saves graphics settings to a file for later use. - Mechanical APDL Command: `/GCOLUMN `_ + Mechanical APDL Command: `/GSAVE `_ Parameters ---------- - curve : str - Curve number on which label will be applied (integer value between 1 and 10). - - string : str - Name or designation that will be applied to the curve (8 characters max). + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is + blank. Notes ----- - .. _s-GCOLUMN_notes: + .. _s-GSAVE_notes: - This command is used for an array parameter plot (a plot created by the :ref:`starvplot` command). - Normally the label for curve 1 is COL 1, the label for curve 2 is COL 2 and so on; the column number - is the field containing the dependent variables for that particular curve. Issuing :ref:`gcolumn`, - ``CURVE``, with no string value specified resets the label to the original value. + This command does not save all graphics settings, but only those that may be reset by the + :ref:`slashreset` command. The database remains untouched. Use the :ref:`gresume` command to read + the file. Repeated use of the :ref:`gsave` command overwrites the previous data on the file. The + following commands are saved by :ref:`gsave` : + + InformalTables need to be added. + + This command is valid in any processor. """ - command = f"/GCOLUMN,{curve},{string}" + command = f"/GSAVE,{fname},{ext}" return self.run(command, **kwargs) def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): @@ -1195,9 +1251,14 @@ def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): The :ref:`gtype` command gives you several options for multi-window layout: - One window Two windows (left and right or top and bottom of the screen) Three windows (two at the - top and one at the bottom of the screen, or one top and two bottom windows Four windows (two at the - top and two at the bottom) + * One window + + * Two windows (left and right or top and bottom of the screen) + + * Three windows (two at the top and one at the bottom of the screen, or one top and two bottom + windows + + * Four windows (two at the top and two at the bottom) Once you choose a window layout, you can choose one of the following: multiple plots, replotting, or no redisplay. @@ -1207,10 +1268,60 @@ def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): command = f"/GTYPE,{wn},{label},{key}" return self.run(command, **kwargs) - def gsave(self, fname: str = "", ext: str = "", **kwargs): - r"""Saves graphics settings to a file for later use. + def gcolumn(self, curve: str = "", string: str = "", **kwargs): + r"""Allows the user to apply a label to a specified curve. - Mechanical APDL Command: `/GSAVE `_ + Mechanical APDL Command: `/GCOLUMN `_ + + Parameters + ---------- + curve : str + Curve number on which label will be applied (integer value between 1 and 10). + + string : str + Name or designation that will be applied to the curve (8 characters max). + + Notes + ----- + + .. _s-GCOLUMN_notes: + + This command is used for an array parameter plot (a plot created by the :ref:`starvplot` command). + Normally the label for curve 1 is COL 1, the label for curve 2 is COL 2 and so on; the column number + is the field containing the dependent variables for that particular curve. Issuing :ref:`gcolumn`, + ``CURVE``, with no string value specified resets the label to the original value. + """ + command = f"/GCOLUMN,{curve},{string}" + return self.run(command, **kwargs) + + def gfile(self, size: str = "", **kwargs): + r"""Specifies the pixel resolution on Z-buffered graphics files. + + Mechanical APDL Command: `/GFILE `_ + + Parameters + ---------- + size : str + Pixel resolution. Defaults to a pixel resolution of 800. Valid values are from 256 to 2400. + + Notes + ----- + + .. _s-GFILE_notes: + + Defines the pixel resolution on subsequently written graphics files (for example, JPEG, PNG, TIFF) + for software Z-buffered displays ( :ref:`slashtype` ). Lowering the pixel resolution produces a + fuzzier image; increasing the resolution produces a sharper image but takes a little longer. + + This command is valid in any processor. + """ + command = f"/GFILE,{size}" + return self.run(command, **kwargs) + + def gresume(self, fname: str = "", ext: str = "", **kwargs): + r"""Sets graphics settings to the settings on a file. + + Mechanical APDL Command: `/GRESUME `_ Parameters ---------- @@ -1226,18 +1337,14 @@ def gsave(self, fname: str = "", ext: str = "", **kwargs): Notes ----- - .. _s-GSAVE_notes: - - This command does not save all graphics settings, but only those that may be reset by the - :ref:`slashreset` command. The database remains untouched. Use the :ref:`gresume` command to read - the file. Repeated use of the :ref:`gsave` command overwrites the previous data on the file. The - following commands are saved by :ref:`gsave` : + .. _s-GRESUME_notes: - InformalTables need to be added. + Causes a file to be read to reset the graphics slash (/) commands as they were at the last + :ref:`gsave` command. This command is valid in any processor. """ - command = f"/GSAVE,{fname},{ext}" + command = f"/GRESUME,{fname},{ext}" return self.run(command, **kwargs) def gcmd( @@ -1340,191 +1447,120 @@ def gplot(self, **kwargs): command = "GPLOT" return self.run(command, **kwargs) - def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): - r"""Provides JPEG file export for Mechanical APDL displays. - - Mechanical APDL Command: `JPEG `_ - - Parameters - ---------- - kywrd : str - Specifies various JPEG file export options. - - * ``QUAL`` - If ``Kywrd`` = QUAL, then ``OPT`` is an integer value defining the JPEG quality index on an - arbitrary scale ranging from 1 to 100. The default value is 75. - - * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire plot. ``OPT`` can - be either Horizontal (default) or Vertical. - - * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. ``OPT`` can be - 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), respectively. - - * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either 1 or 0, - corresponding to bitmap text (default) or line stroke text, respectively. - - * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd parameters listed - above, are active. - - opt : str - ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - - * ``1 to 100`` - If ``Kywrd`` = QUAL, a value between 1 and 100 will determine the quality index of the JPEG file. - - * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the orientation of the plot. - - * ``0,1,2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale and Color, - respectively. - - * ``1,0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will - be used - - """ - command = f"JPEG,{kywrd},{opt}" - return self.run(command, **kwargs) - - def show( - self, - fname: str = "", - option: str = "", - vect: int | str = "", - ncpl: str = "", - **kwargs, - ): - r"""Specifies the device and other parameters for graphics displays. + def graphics(self, key: str = "", **kwargs): + r"""Defines the type of graphics display. - Mechanical APDL Command: `/SHOW `_ + Mechanical APDL Command: `/GRAPHICS `_ Parameters ---------- - fname : str - Device name, file name, or keyword, as listed below: - - * ``<, device name >`` - Any valid graphics display device name (for example, X11, 3D etc.). Defaults to X11 for most - systems. See `Getting Started with Graphics - `_ in the `Basic Analysis Guide `_ - for details. A device name must be defined before activating the Graphical User Interface (GUI). - Once the GUI is activated, the device name cannot be changed for that session, except for switching - between X11 and X11C. - - * ``TERM`` - Graphics displays are switched back to the last-specified device name. - - * ``CLOSE`` - This option purges the graphics file buffer. The CLOSE option should be issued any time you are - changing graphics devices or file output types during a session. Graphics displays are switched back - to the last-specified device name, and any open graphics files are closed. The CLOSE option is - similar to the TERM option, however, with the CLOSE option, another process can access the data in - the graphics file. The CLOSE option causes graphics file buffers to be flushed to the graphics file. - - * ``OFF`` - Graphics display requests are ignored. - - * ``(blank)`` - If blank in interactive mode, graphics will be displayed on screen as requested by display commands - (no file written). + key : str + Graphics key: - * ``JPEG`` - Creates JPEG files that are named :file:`Jobname` nnn.jpg, where ``nnn`` is a numeric value that is - incremented by one as each additional file is created; that is, :file:`Jobname000.jpg`, - :file:`Jobname001.jpg`, :file:`Jobname002.jpg`, and so on. Ignores the ``Ext`` field. + * ``FULL`` - Display all model geometry and results. - * ``TIFF`` - Creates tagged image format files that are named :file:`Jobname` nnn.tif, where ``nnn`` is a numeric - value that is incremented by one as each additional file is created; that is, - :file:`Jobname000.tif`, :file:`Jobname001.tif`, :file:`Jobname002.tif`, and so on. This value for - the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`tiff` command for options.) + * ``POWER`` - Activate PowerGraphics (default when GUI is on). - * ``PNG`` - Creates PNG (Portable Network Graphics) files that are named :file:`Jobname` nnn.png, where ``nnn`` - is a numeric value that is incremented by one as each additional file is created; that is, - :file:`Jobname000.png`, :file:`Jobname001.png`, :file:`Jobname002.png`, and so on. This value for - the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`pngr` command for options.) + Notes + ----- - * ``VRML`` - Creates Virtual Reality Meta Language files named :file:`Jobname000.wrl` that can be displayed on 3D - Internet web browsers. Ignores the ``Ext`` and ``NCPL`` fields. + .. _s-GRAPHICS_notes: - option : str - Assign a file name extension or specify reverse video output: + The :ref:`graphics` command specifies the type of graphics display. ``Key`` = POWER activates the + PowerGraphics capability. PowerGraphics offers faster plotting than the _nolinebreak? ``Key`` = FULL + option, /_nolinebreak? and speeds up element, results, area, line, and volume displays. - * ``Ext`` - File name extension (eight-character maximum). + The default PowerGraphics mode is enabled automatically when accessing the GUI. This action + supersedes all prior macros or start-up routines ( :file:`start.ans`, :file:`config.ans`, etc.). + Full graphics mode is accessed only by issuing :ref:`graphics`,FULL after the GUI is active. - * ``REV`` - Reverse background/image (black/white) colors. Valid with ``Fname`` = PNG (recommended), JPEG, and - TIFF. This option is ignored if a previously specified color map table ( :ref:`cmap` or :ref:`rgb` ) - is in effect. + Results values (both printed and plotted) may differ between the _nolinebreak? ``Key`` = FULL + /_nolinebreak? and ``Key`` = POWER options because each option specifies a different set of data for + averaging and display. For _nolinebreak? ``Key`` = FULL /_nolinebreak?, all element and results + values (interior and surface) are included. For _nolinebreak? ``Key`` = POWER /_nolinebreak?, only + element and results values along the model exterior surface are processed. - vect : int or str - Specifies raster or vector display mode. This affects area, volume, and element displays, as well as - geometric results displays such as contour plots. See the :ref:`device` command for an alternate way to toggle between raster and vector mode. Changing ``VECT`` also resets the :ref:`slashtype` command to its default. + When ``Key`` = FULL, it is possible to deselect an individual node, select all elements (including + the element that contains that node), and then perform postprocessing calculations on those elements + and have that unselected node not be considered in those calculations. If PowerGraphics is active, + however, postprocessing always displays based on selected elements. - * ``0`` - Raster display (color filled entities; default) + If you have specified one facet per element edge for PowerGraphics displays (via the :ref:`efacet` + command or options from the General Postproc or Utility menu), PowerGraphics does not plot midside + nodes. ( :ref:`efacet` applies to element type displays only.) - * ``1`` - Vector display (outlined entities; that is, "wireframe") + Maximum values shown in plots can differ from printed maximum values. This is due to different + averaging schemes used for plotted and printed maximum values. - ncpl : str - Sets the number of color planes (4 to 8). Default is device-dependent. ``NCPL`` is not supported - by all graphics devices. + When using solution coordinate systems for results output ( :ref:`rsys`,SOLU) with PowerGraphics, + the deformed or displaced shape in a POST1 contour display can be unexpected (although the contours + are displayed in the expected colors). The program does not rotate displacement values (Ux,Uy,Uz) to + global; instead, the displacements (stored locally) are added directly to the global coordinates + (X,Y,Z). For example, if in PREP7 the nodes are rotated 90 degrees about the z axis and the global + Uy displacements are relatively large, the Ux values will be large, causing the model to display a + large deformation in the global X direction. - Notes - ----- + PowerGraphics displays do not average at geometric discontinuities. The printouts in PowerGraphics + will, however, provide averaging information at geometric discontinuities if the models do not + contain shell elements. Carefully inspect the data you obtain at geometric discontinuities. - .. _s-SHOW_notes: + PowerGraphics does not support the following diffusion analysis results: CONC, CG, DF, EPDI. - Specifies the device to be used for graphics displays, and specifies other graphics display - parameters. Display may be shown at the time of generation (for interactive runs at a graphics - display terminal) or diverted to a file. Issue :ref:`pstatus` for display status. + ``Key`` = FULL is not available for `XFEM-based crack-growth analysis + `_. - Batch runs do not have access to the fonts available on your system. The Courier and Helvetica font - files used for JPEG, PNG and TIFF batch output are copyrighted by Adobe Systems Inc. and Digital - Equipment Corp. Permission to use these trademarks is hereby granted only in association with the - images described above. Batch run JPEG output is produced at the default quality index value of 75, - unless specified otherwise. + Excepting a few options, PowerGraphics supports these commands: - Interactive displays default to eight color planes ( ``NCPL`` = 8) for most monitors, while graph - file output defaults to eight color planes for VRML output, and four color planes for JPEG, PNG, and - TIFF. + InformalTables need to be added. + The following commands are executed via the _nolinebreak? ``Key`` = FULL /_nolinebreak? option, + regardless of whether PowerGraphics is activated: - This command is valid in any processor. + InformalTables need to be added. """ - command = f"/SHOW,{fname},{option},{vect},{ncpl}" + command = f"/GRAPHICS,{key}" return self.run(command, **kwargs) - def seg(self, label: str = "", aviname: str = "", delay: str = "", **kwargs): - r"""Allows graphics data to be stored in the local terminal memory. + def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): + r"""Provides JPEG file export for Mechanical APDL displays. - Mechanical APDL Command: `/SEG `_ + Mechanical APDL Command: `JPEG `_ Parameters ---------- - label : str - Storage key: - - * ``SINGL`` - Store subsequent display in a single segment (overwrites last storage). - - * ``MULTI`` - Store subsequent displays in unique segments ( :ref:`anim` ). + kywrd : str + Specifies various JPEG file export options. - * ``DELET`` - Delete all currently stored segments. + * ``QUAL`` - If ``Kywrd`` = QUAL, then ``OPT`` is an integer value defining the JPEG quality index + on an arbitrary scale ranging from 1 to 100. The default value is 75. - * ``OFF`` - Stop storing display data in segments. + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire + plot. ``OPT`` can be either Horizontal (default) or Vertical. - * ``STAT`` - Display segment status. + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. + ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), + respectively. - * ``PC`` - This option only applies to PC versions of Mechanical APDL and only when animating via the AVI movie player - ( :ref:`device`,ANIM,2). The command appends frames to the :file:`File.AVI`, so that the animation - goes in both directions (that is, forward--backward--forward). You must have a current animation - file to use this option. + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either + 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. - aviname : str - Name of the animation file that will be created when each frame is saved. The :file:`.AVI` - extension is applied automatically. Defaults to :file:`Jobname.AVI` if no filename is specified. + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd + parameters listed above, are active. - delay : str - Delay factor between each frame, in seconds. Defaults to 0.015 seconds if no value is specified. + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - Notes - ----- + * ``1 to 100`` - If ``Kywrd`` = QUAL, a value between 1 and 100 will determine the quality index of + the JPEG file. - .. _s-SEG_notes: + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the + orientation of the plot. - Allows graphics data to be stored in the terminal local memory (device-dependent). Storage occurs - concurrently with the display. + * ``0,1,2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, Grayscale + and Color, respectively. - Although the information from your graphics window is stored as an individual segment, you cannot - plot directly ( :ref:`gplot` ) from the segment memory. + * ``1,0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) + fonts will be used - This command is valid in any processor. """ - command = f"/SEG,{label},{aviname},{delay}" + command = f"JPEG,{kywrd},{opt}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/style.py b/src/ansys/mapdl/core/_commands/graphics/style.py index bfb7996ebef..c9e14063c6c 100644 --- a/src/ansys/mapdl/core/_commands/graphics/style.py +++ b/src/ansys/mapdl/core/_commands/graphics/style.py @@ -25,107 +25,6 @@ class Style: - def ctype( - self, - key: int | str = "", - dotd: str = "", - dots: str = "", - dshp: int | str = "", - tlen: str = "", - **kwargs, - ): - r"""Specifies the type of contour display. - - Mechanical APDL Command: `/CTYPE `_ - - **Command default:** - - .. _s-CTYPE_default: - - Standard contour display. - - Parameters - ---------- - key : int or str - Type of display: - - * ``0`` - Standard contour display. - - * ``1`` - Isosurface display. - - * ``2`` - Particle gradient display. - - * ``3`` - Gradient triad display. - - dotd : str - Maximum dot density for particle gradient display ( ``KEY`` = 2). Density is expressed as dots - per screen width (defaults to 30). - - dots : str - Dot size for particle gradient display ( ``KEY`` = 2). Size is expressed as a fraction of the - screen width (defaults to 0.0 (single dot width)). - - dshp : int or str - Spherical dot shape precision for particle gradient display ( ``KEY`` = 2). (3D options are supported only on 3D devices): - - * ``0`` - Flat 2D circular dot. - - * ``1`` - Flat-sided 3D polyhedron. - - * ``n`` - 3D sphere with ``n`` (>1) polygon divisions per 90° of radius. - - tlen : str - Maximum length of triads for gradient triad display ( ``KEY`` = 3). Value is expressed as a - fraction of the screen width (defaults to 0.067). - - Notes - ----- - - .. _s-CTYPE_notes: - - Use :ref:`ctype`,STAT to display the current settings. Only the standard contour display ( - :ref:`ctype`,0) and the isosurface contour display ( :ref:`ctype`,1) are supported by PowerGraphics - ( :ref:`graphics`,POWER). - - This command is valid in any processor. - """ - command = f"/CTYPE,{key},{dotd},{dots},{dshp},{tlen}" - return self.run(command, **kwargs) - - def cplane(self, key: int | str = "", **kwargs): - r"""Specifies the cutting plane for section and capped displays. - - Mechanical APDL Command: `/CPLANE `_ - - **Command default:** - - .. _s-CPLANE_default: - - The cutting plane is normal to the viewing vector at the focus point. - - Parameters - ---------- - key : int or str - Specifies the cutting plane: - - * ``0`` - Cutting plane is normal to the viewing vector ( :ref:`view` ) and passes through the focus point ( - :ref:`focus` ) (default). - - * ``1`` - The working plane ( :ref:`wplane` ) is the cutting plane. - - Notes - ----- - - .. _s-CPLANE_notes: - - Defines the cutting plane to be used for section and capped displays ( :ref:`slashtype`,,(1, 5, or - 7)). - - This command is valid in any processor. - """ - command = f"/CPLANE,{key}" - return self.run(command, **kwargs) - def light( self, wn: str = "", @@ -197,145 +96,6 @@ def light( command = f"/LIGHT,{wn},{num},{int},{xv},{yv},{zv},{refl}" return self.run(command, **kwargs) - def eshape(self, scale: str = "", key: str = "", **kwargs): - r"""Displays elements with shapes determined from the real constants, section definition, or other - inputs. - - Mechanical APDL Command: `/ESHAPE `_ - - **Command default:** - - .. _s-ESHAPE_default: - - Use simple display of line and area elements ( ``SCALE`` = 0). - - Parameters - ---------- - scale : int or str - Scaling factor: - - * ``0`` - Use simple display of line and area elements. This value is the default. - - * ``1`` - Use real constants, section definition, or other information to form a solid shape display of the - applicable elements. - - * ``FAC`` - Multiply certain real constants, such as thickness, by ``FAC`` (where ``FAC`` > 0.01) and use them - to form a solid shape display of elements. - - key : int or str - Current shell thickness key: - - * ``0`` - Use current thickness in the displaced solid shape display of shell elements (valid for SHELL181, - SHELL208, SHELL209, and SHELL281 ). This value is the default. - - * ``1`` - Use initial thickness in the displaced solid shape display of shell elements. - - Notes - ----- - The /ESHAPE command allows beams, shells, current sources, and - certain special-purpose elements to be displayed as solids - with the shape determined from the real constants or section - types. Elements are displayed via the EPLOT command. No checks - for valid or complete input are made for the display. - - Following are details about using this command with various - element types: - - SOLID65 elements are displayed with internal lines that - represent rebar sizes and orientations (requires vector mode - [/DEVICE] with a basic type of display [/TYPE,,BASIC]). The - rebar with the largest volume ratio in each element plots as a - red line, the next largest as green, and the smallest as blue. - - COMBIN14, COMBIN39, and MASS21 are displayed with a graphics - icon, with the offset determined by the real constants and - KEYOPT settings. - - BEAM188, BEAM189, PIPE288, PIPE289 and ELBOW290 are displayed - as solids with the shape determined via the section-definition - commands (SECTYPE and SECDATA). The arbitrary section option - (Subtype = ASEC) has no definite shape and appears as a thin - rectangle to show orientation. The elements are displayed with - internal lines representing the cross- section mesh. - - SOLID272 and SOLID273 are displayed as solids with the shape - determined via the section-definition commands (SECTYPE and - SECDATA). The 2-D master plane is revolved around the - prescribed axis of symmetry. - - Contour plots are available for these elements in - postprocessing for PowerGraphics only (/GRAPHICS,POWER). To - view 3-D deformed shapes for the elements, issue OUTRES,MISC - or OUTRES,ALL for static or transient analyses. To view 3-D - mode shapes for a modal or eigenvalue buckling analysis, - expand the modes with element results calculation ON (Elcalc = - YES for MXPAND). - - SOURC36, CIRCU124, and TRANS126 elements always plot using - /ESHAPE when PowerGraphics is activated (/GRAPHICS,POWER). - - In most cases, /ESHAPE renders a thickness representation of - your shell, plane and layered elements more readily in - PowerGraphics (/GRAPHICS,POWER). This type of representation - employs PowerGraphics to generate the enhanced representation, - and will often provide no enhancement in Full Graphics - (/GRAPHICS,FULL). This is especially true for POST1 results - displays, where /ESHAPE is not supported for most element - types with FULL graphics. - - When PowerGraphics is active, /ESHAPE may degrade the image if - adjacent elements have overlapping material, such as shell - elements which are not co-planar. Additionally, if adjacent - elements have different thicknesses, the polygons depicting - the connectivity between the "thicker" and "thinner" elements - along the shared element edges may not always be displayed. - - For POST1 results displays (such as PLNSOL), the following - limitations apply: - - Rotational displacements for beam elements are used to create - a more realistic displacement display. When /ESHAPE is active, - displacement plots (via PLNSOL,U,X and PLDISP, for example) - may disagree with your PRNSOL listings. This discrepancy will - become more noticeable when the SCALE value is not equal to - one. - - When shell elements are not co-planar, the resulting PLNSOL - display with /ESHAPE will actually be a PLESOL display as the - non-coincident pseudo-nodes are not averaged. Additionally, - /ESHAPE should not be used with coincident elements because - the plot may incorrectly average the displacements of the - coincident elements. - - When nodes are initially coincident and PowerGraphics is - active, duplicate polygons are eliminated to conserve display - time and disk space. The command may degrade the image if - initially coincident nodes have different displacements. The - tolerance for determining coincidence is 1E-9 times the - model``s bounding box diagonal. - - If you want to view solution results (PLNSOL, etc.) on layered - elements (such as SHELL181, SOLSH190, SOLID185 Layered Solid, - SOLID186 Layered Solid, SHELL208, SHELL209, SHELL281, and - ELBOW290), set KEYOPT(8) = 1 for the layer elements so that - the data for all layers is stored in the results file. - - You can plot the through-thickness temperatures of elements - SHELL131 and SHELL132 regardless of the thermal DOFs in use by - issuing the PLNSOL,TEMP command (with PowerGraphics and - /ESHAPE active). - - The /ESHAPE,1 and /ESHAPE,FAC commands are incompatible with - the /CYCEXPAND command used in cyclic symmetry analyses. - - This command is valid in any processor. - """ - warnings.warn( - "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(vtk=False)`` " - ) - command = f"/ESHAPE,{scale},{key}" - return self.run(command, **kwargs) - def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): r"""Displays only the common lines (“edges”) of an object. @@ -397,71 +157,139 @@ def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): command = f"/EDGE,{wn},{key},{angle}" return self.run(command, **kwargs) - def facet(self, lab: str = "", **kwargs): - r"""Specifies the facet representation used to form solid model displays. + def eshape(self, scale: str = "", key: str = "", **kwargs): + r"""Displays elements with shapes determined from the real constants, section definition, or other + inputs. - Mechanical APDL Command: `/FACET `_ + Mechanical APDL Command: `/ESHAPE `_ + + **Command default:** + + .. _s-ESHAPE_default: + + Use simple display of line and area elements ( ``SCALE`` = 0). Parameters ---------- - lab : str - Valid labels: + scale : int or str + Scaling factor: - * ``FINE`` - Use finer tessellation to increase the number of facets for the display. Provides the best - representation (but decreases speed of operation). + * ``0`` - Use simple display of line and area elements. This value is the default. - * ``NORML`` - Use the basic number of facets for the display (default). + * ``1`` - Use real constants, section definition, or other information to form a solid shape display + of the applicable elements. - * ``COAR`` - Use a limited number of facets for the display. This option will increase the speed of the - operations, but may produce poor representations for some imported models. + * ``FAC`` - Multiply certain real constants, such as thickness, by ``FAC`` (where ``FAC`` > 0.01) + and use them to form a solid shape display of elements. - * ``WIRE`` - Display model with a wireframe representation (fast, but surfaces will not be shown). + key : int or str + Current shell thickness key: + + * ``0`` - Use current thickness in the displaced solid shape display of shell elements (valid for + SHELL181, SHELL208, SHELL209, and SHELL281 ). This value is the default. + + * ``1`` - Use initial thickness in the displaced solid shape display of shell elements. Notes ----- - .. _s-FACET_notes: + .. _s-ESHAPE_notes: - Specifies the facet (or polygon) representation used to form solid model displays. Used only with - the :ref:`aplot`, :ref:`asum`, :ref:`vplot`, and :ref:`vsum` commands. + The :ref:`eshape` command allows beams, shells, current sources, and certain special-purpose + elements or elements with special options to be displayed as solids with the shape determined from + the real constants, section types, or other information. Elements are displayed via the :ref:`eplot` + command. No checks for valid or complete input are made for the display. - This command is valid in any processor. - """ - command = f"/FACET,{lab}" - return self.run(command, **kwargs) + Following are details about using this command with various element types: - def normal(self, wn: str = "", key: int | str = "", **kwargs): - r"""Allows displaying area elements by top or bottom faces. + * COMBIN14, COMBIN39, and MASS21 are displayed with a graphics icon, with the offset determined by + the real constants and KEYOPT settings. - Mechanical APDL Command: `/NORMAL `_ + * BEAM188, BEAM189, PIPE288, PIPE289 and ELBOW290 are displayed as solids with the shape determined + via the section-definition commands ( :ref:`sectype` and :ref:`secdata` ). The arbitrary section + option ( ``Subtype`` = ASEC) has no definite shape and appears as a thin rectangle to indicate the + orientation; the thin side represents the beam Y axis and the thick (longer) side represents the Z + axis. The length of thick side is determined by ``TKz``. If ``TKz`` = 0, the area is used to + determine the length of thick side. The thin side is scaled by the fraction of the thick side, + regardless of ``TKy``. If the offsets are defined via ``CGy`` / ``CGz`` ( :ref:`secdata` or + :ref:`secoffset`,USER, ``OFFSETY``, ``OFFSETZ`` ), they are applied to the plot without scaling. + The elements are displayed with internal lines representing the cross-section mesh. - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + * Reduced-integration and lower-order shells ( SHELL181 and SHELL208 with KEYOPT(3)=0) are displayed + with uniform thickness, evaluated at the centroid, to reflect the element behavior. - key : int or str - Display key: + * SOLID272 and SOLID273 are displayed as solids with the shape determined via the section-definition + commands ( :ref:`sectype` and :ref:`secdata` ). The 2D master plane is revolved around the + prescribed axis of symmetry. - * ``0`` - No face distinction. + * PLANE182, PLANE183, PLANE222, and PLANE223 with KEYOPT(3) = 6 are displayed as - * ``1`` - Show only area elements having their positive normals directed toward the viewing point. + 3D solids with the shape determined by - * ``-1`` - Show only area elements having their positive normals directed away from the viewing point. + nodal locations and displacements at the nodes. - Notes - ----- + * Contour plots are available for these elements in postprocessing for PowerGraphics only ( + :ref:`graphics`,POWER). To view 3D deformed shapes for the elements, issue :ref:`outres`,MISC or + :ref:`outres`,ALL for static or transient analyses. To view 3D mode shapes for a modal or + eigenvalue buckling analysis, expand the modes with element results calculation ON ( ``Elcalc`` = + YES for :ref:`mxpand` ). - .. _s-NORMAL_notes: + * SOURC36, CIRCU124, and TRANS126 elements always plot using :ref:`eshape` when PowerGraphics is + activated ( :ref:`graphics`,POWER). - :ref:`normal` allows you to select area elements and area plots by the top or bottom faces. It is - useful for checking the normal directions on shell elements. The positive normal (element Z - direction) is defined by the right-hand rule following the node I, J, K, L input direction. This - command is available only with raster or hidden-line displays, for WIN32 or X11 2D displays only. + In most cases, :ref:`eshape` renders a thickness representation of your shell, plane and layered + elements more readily in PowerGraphics ( :ref:`graphics`,POWER). This type of representation employs + PowerGraphics to generate the enhanced representation, and will often provide no enhancement in Full + Graphics ( :ref:`graphics`,FULL). This is especially true for POST1 results displays, where + :ref:`eshape` is not supported for most element types with FULL graphics. + + When PowerGraphics is active, :ref:`eshape` may degrade the image if adjacent elements have + overlapping material, such as shell elements which are not co-planar. Additionally, if adjacent + elements have different thicknesses, the polygons depicting the connectivity between the "thicker" + and "thinner" elements along the shared element edges may not always be displayed. + + For POST1 results displays (such as :ref:`plnsol` ), the following limitations apply: + + * If you issue :ref:`rsys`,SOLU before reviewing results for beam or pipe elements, contour plots + for displacement (for example, :ref:`plnsol`,U,X and :ref:`pldisp` ) do not appear in the solution + coordinate system when :ref:`eshape` is active. Instead, the contours appear in the global + Cartesian coordinate system. + + * When shell elements are not co-planar, the resulting :ref:`plnsol` display with :ref:`eshape` will + actually be a :ref:`plesol` display as the non-coincident pseudo-nodes are not averaged. + Additionally, :ref:`eshape` should not be used with coincident elements because the plot may + incorrectly average the displacements of the coincident elements. + + * When nodes are initially coincident and PowerGraphics is active, duplicate polygons are eliminated + to conserve display time and disk space. The command may degrade the image if initially coincident + nodes have different displacements. The tolerance for determining coincidence is 1E-9 times the + model``s bounding box diagonal. + + * If you want to view solution results ( :ref:`plnsol`, etc.) on layered elements (such as SHELL181, + SOLSH190, SOLID185 Layered Solid, SOLID186 Layered Solid, SHELL208, SHELL209, SHELL281, and + ELBOW290 ), set KEYOPT(8) = 1 for the layer elements so that the data for all layers is stored in + the results file. + + * You can plot the through-thickness temperatures of elements SHELL131 and SHELL132 regardless of + the thermal DOFs in use by issuing the :ref:`plnsol`,TEMP command (with PowerGraphics and + :ref:`eshape` active). + + * The :ref:`eshape`,1 and :ref:`eshape`, ``FAC`` commands are incompatible with the :ref:`cycexpand` + command used in cyclic symmetry analyses. + + * The :ref:`eshape`,1 command does not support velocity and acceleration results for elements + PLANE182, PLANE183, PLANE222, or PLANE223 with KEYOPT(3) = 6. + + * For coupled-field elements PLANE222 and PLANE223 with KEYOPT(3) = 6, the :ref:`eshape` command can + be used to visualize structural results. Non-structural results visualization is limited to + gradient and flux displays supported with PowerGraphics. This command is valid in any processor. """ - command = f"/NORMAL,{wn},{key}" + warnings.warn( + "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(vtk=False)`` " + ) + command = f"/ESHAPE,{scale},{key}" return self.run(command, **kwargs) def txtre( @@ -494,17 +322,17 @@ def txtre( * ``File`` - If Lab = File, the command format is :ref:`txtre`, File, ``Key_Index``, ``Fname``, ``Fext``, ``--``, ``Format`` (This variant of the command is applicable to 2D drivers). - * ``Key_Index`` - The texture index associated with the file. If the number fifty-one (51) is used, the imported - bitmap will be used as the window's logo. + * ``Key_Index`` - The texture index associated with the file. If the number fifty-one (51) is used, + the imported bitmap will be used as the window's logo. * ``Fname`` - File name and directory path (248 characters maximum, including the characters needed for the directory path). An unspecified directory path defaults to the working directory; in this case, you can use all 248 characters for the file name. * ``Fext`` - Filename extension (eight-character maximum). - * ``Format`` - The file format. If ``Format`` = 0, the file is a pixmap (Linux) or Bitmap (PC). The file cannot - contain a compressed image, and the PC file must be 8 or 24 bit BI_RGB format. If ``Format`` = 1 or - JPEG, then the file is in JPEG (Joint Photographic Experts Group) format. If ``Format`` = 2 or PNG, - then the file is in PNG (Portable Network Graphics) format. + * ``Format`` - The file format. If ``Format`` = 0, the file is a pixmap (Linux) or Bitmap (PC). The + file cannot contain a compressed image, and the PC file must be 8 or 24 bit BI_RGB format. If + ``Format`` = 1 or JPEG, then the file is in JPEG (Joint Photographic Experts Group) format. If + ``Format`` = 2 or PNG, then the file is in PNG (Portable Network Graphics) format. num : int or str Select the texture index number from the following list: @@ -620,47 +448,138 @@ def txtre( command = f"/TXTRE,{lab},{num},{n1},{n2},{ninc}" return self.run(command, **kwargs) - def slashtype(self, wn: str = "", type_: str = "", **kwargs): - r"""Defines the type of display. + def trlcy( + self, + lab: str = "", + tlevel: str = "", + n1: str = "", + n2: str = "", + ninc: str = "", + **kwargs, + ): + r"""Specifies the level of translucency. - Mechanical APDL Command: `/TYPE `_ + Mechanical APDL Command: `/TRLCY `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - type_ : str - Display type. Defaults to ZBUF for raster mode displays or BASIC for vector mode displays: - - * ``BASIC or 0`` - Basic display (no hidden or section operations). + lab : str + Apply translucency level to the items specified by the following labels: - * ``SECT or 1`` - Section display (plane view). Use the :ref:`cplane` command to define the cutting plane. + * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. - * ``HIDC or 2`` - Centroid hidden display (based on item centroid sort). + * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. - * ``HIDD or 3`` - Face hidden display (based on face centroid sort). + * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. - * ``HIDP or 4`` - Precise hidden display (like HIDD but with more precise checking). Because all facets are sorted, - this mode can be extremely slow, especially for large models. + * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc., value). Translucency varies with + result value, to a maximum of the specified translucency level. - * ``CAP or 5`` - Capped hidden display (same as combined SECT and HIDD with model in front of section plane removed). + * ``CM`` - Component group. Use ``N1`` for component name, ignore ``N2`` and ``NINC``. - * ``ZBUF or 6`` - Z-buffered display (like HIDD but using software Z-buffering). + * ``CURVE`` - Filled areas under curves of line graphs. Use ``N1``, ``N2``, ``NINC`` fields for + curve numbers. - * ``ZCAP or 7`` - Capped Z-buffered display (same as combined SECT and ZBUF with model in front of section plane - removed). + * ``ZCAP`` - If :ref:`slashtype`, ``WN``,ZCAP is the current display type, then :ref:`trlcy`,ZCAP, + ``TLEVEL`` will display the model in window ``WN`` with the portion of the model in front of the + section plane displayed at the translucency level ``TLEVEL``. - * ``ZQSL or 8`` - QSLICE Z-buffered display (same as SECT but the edge lines of the remaining 3D model are shown). + * ``ON, OFF`` - Sets the specified translucency display on or off. All other fields are ignored. - * ``HQSL or 9`` - QSLICE precise hidden display (like ZQSL but using precise hidden). + tlevel : str + Translucency level: 0.0 (opaque) to 1.0 (transparent). - Notes - ----- + n1 : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. - .. _s-TYPE_notes: + n2 : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. - Defines the type of display, such as section display or hidden-line display. Use the :ref:`device` + ninc : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. + + Notes + ----- + + .. _s-TRLCY_notes: + + Specifies the level of translucency for various items. Issue :ref:`trlcy`,DEFA to reset the default + (0) translucency levels. This command is valid only on selected 2D and 3D graphics devices; see + filename="Hlp_G_BAS11_3.html"? in the `Basic Analysis Guide + `_ for more + information on applying translucency. + + For 2D devices, the program displays only the visible faces of the items being displayed. The + information behind the facing planes is not displayed. Issuing the :ref:`shrink` command will force + the hardware to display information behind the translucent items. + + This command is valid in any processor. + """ + command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" + return self.run(command, **kwargs) + + def slashtype(self, wn: str = "", type_: str = "", **kwargs): + r"""Defines the type of display. + + Mechanical APDL Command: `/TYPE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + type_ : str + Display type. Defaults to ZBUF for raster mode displays or BASIC for vector mode displays: + + * ``BASIC or 0`` - Basic display (no hidden or section operations). + + * ``SECT or 1`` - Section display (plane view). Use the :ref:`cplane` command to define the cutting + plane. + + * ``HIDC or 2`` - Centroid hidden display (based on item centroid sort). + + * ``HIDD or 3`` - Face hidden display (based on face centroid sort). + + * ``HIDP or 4`` - Precise hidden display (like HIDD but with more precise checking). Because all + facets are sorted, this mode can be extremely slow, especially for large models. + + * ``CAP or 5`` - Capped hidden display (same as combined SECT and HIDD with model in front of + section plane removed). + + * ``ZBUF or 6`` - Z-buffered display (like HIDD but using software Z-buffering). + + * ``ZCAP or 7`` - Capped Z-buffered display (same as combined SECT and ZBUF with model in front of + section plane removed). + + * ``ZQSL or 8`` - QSLICE Z-buffered display (same as SECT but the edge lines of the remaining 3D + model are shown). + + * ``HQSL or 9`` - QSLICE precise hidden display (like ZQSL but using precise hidden). + + Notes + ----- + + .. _s-TYPE_notes: + + Defines the type of display, such as section display or hidden-line display. Use the :ref:`device` command to specify either raster or vector mode. The SECT, CAP, ZCAP, ZQSL, and HQSL options produce section displays. The section or "cutting" plane @@ -704,152 +623,208 @@ def slashtype(self, wn: str = "", type_: str = "", **kwargs): command = f"/TYPE,{wn},{type_}" return self.run(command, **kwargs) - def trlcy( + def cplane(self, key: int | str = "", **kwargs): + r"""Specifies the cutting plane for section and capped displays. + + Mechanical APDL Command: `/CPLANE `_ + + **Command default:** + + .. _s-CPLANE_default: + + The cutting plane is normal to the viewing vector at the focus point. + + Parameters + ---------- + key : int or str + Specifies the cutting plane: + + * ``0`` - Cutting plane is normal to the viewing vector ( :ref:`view` ) and passes through the focus + point ( :ref:`focus` ) (default). + + * ``1`` - The working plane ( :ref:`wplane` ) is the cutting plane. + + Notes + ----- + + .. _s-CPLANE_notes: + + Defines the cutting plane to be used for section and capped displays ( :ref:`slashtype`,,(1, 5, or + 7)). + + This command is valid in any processor. + """ + command = f"/CPLANE,{key}" + return self.run(command, **kwargs) + + def ctype( self, - lab: str = "", - tlevel: str = "", - n1: str = "", - n2: str = "", - ninc: str = "", + key: int | str = "", + dotd: str = "", + dots: str = "", + dshp: int | str = "", + tlen: str = "", **kwargs, ): - r"""Specifies the level of translucency. + r"""Specifies the type of contour display. - Mechanical APDL Command: `/TRLCY `_ + Mechanical APDL Command: `/CTYPE `_ + + **Command default:** + + .. _s-CTYPE_default: + + Standard contour display. Parameters ---------- - lab : str - Apply translucency level to the items specified by the following labels: - - * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. + key : int or str + Type of display: - * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. + * ``0`` - Standard contour display. - * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. + * ``1`` - Isosurface display. - * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc., value). Translucency varies with result value, to a - maximum of the specified translucency level. + * ``2`` - Particle gradient display. - * ``CM`` - Component group. Use ``N1`` for component name, ignore ``N2`` and ``NINC``. + * ``3`` - Gradient triad display. - * ``CURVE`` - Filled areas under curves of line graphs. Use ``N1``, ``N2``, ``NINC`` fields for curve numbers. + dotd : str + Maximum dot density for particle gradient display ( ``KEY`` = 2). Density is expressed as dots + per screen width (defaults to 30). - * ``ZCAP`` - If :ref:`slashtype`, ``WN``,ZCAP is the current display type, then :ref:`trlcy`,ZCAP, ``TLEVEL`` - will display the model in window ``WN`` with the portion of the model in front of the section plane - displayed at the translucency level ``TLEVEL``. + dots : str + Dot size for particle gradient display ( ``KEY`` = 2). Size is expressed as a fraction of the + screen width (defaults to 0.0 (single dot width)). - * ``ON, OFF`` - Sets the specified translucency display on or off. All other fields are ignored. + dshp : int or str + Spherical dot shape precision for particle gradient display ( ``KEY`` = 2). (3D options are supported only on 3D devices): - tlevel : str - Translucency level: 0.0 (opaque) to 1.0 (transparent). + * ``0`` - Flat 2D circular dot. - n1 : str - Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` - to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, - apply specified translucency level to entire selected range. If ``Lab`` is CM, use component - name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically - pick elements, areas, and volumes. You can then assign translucency levels to the entities via - the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by - picking. + * ``1`` - Flat-sided 3D polyhedron. - n2 : str - Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` - to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, - apply specified translucency level to entire selected range. If ``Lab`` is CM, use component - name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically - pick elements, areas, and volumes. You can then assign translucency levels to the entities via - the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by - picking. + * ``n`` - 3D sphere with ``n`` (>1) polygon divisions per 90° of radius. - ninc : str - Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` - to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, - apply specified translucency level to entire selected range. If ``Lab`` is CM, use component - name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically - pick elements, areas, and volumes. You can then assign translucency levels to the entities via - the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by - picking. + tlen : str + Maximum length of triads for gradient triad display ( ``KEY`` = 3). Value is expressed as a + fraction of the screen width (defaults to 0.067). Notes ----- - .. _s-TRLCY_notes: - - Specifies the level of translucency for various items. Issue :ref:`trlcy`,DEFA to reset the default - (0) translucency levels. This command is valid only on selected 2D and 3D graphics devices; see - filename="Hlp_G_BAS11_3.html"? in the `Basic Analysis Guide - `_ for more - information on applying translucency. + .. _s-CTYPE_notes: - For 2D devices, the program displays only the visible faces of the items being displayed. The - information behind the facing planes is not displayed. Issuing the :ref:`shrink` command will force - the hardware to display information behind the translucent items. + Use :ref:`ctype`,STAT to display the current settings. Only the standard contour display ( + :ref:`ctype`,0) and the isosurface contour display ( :ref:`ctype`,1) are supported by PowerGraphics + ( :ref:`graphics`,POWER). This command is valid in any processor. """ - command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" + command = f"/CTYPE,{key},{dotd},{dots},{dshp},{tlen}" return self.run(command, **kwargs) - def gmface(self, lab: str = "", n: str = "", **kwargs): - r"""Specifies the facet representation used to form solid models. + def normal(self, wn: str = "", key: int | str = "", **kwargs): + r"""Allows displaying area elements by top or bottom faces. - Mechanical APDL Command: `GMFACE `_ + Mechanical APDL Command: `/NORMAL `_ Parameters ---------- - lab : str - Valid Labels: + wn : str + Window number (or ALL) to which command applies (defaults to 1). - * ``FINE`` - Value that determines how coarse the facets will be. + key : int or str + Display key: - n : str - An integer value between one (small) and ten (large) that determines the tolerances that will be - applied to the creation of arcs and surfaces. Ten will create many facets, which may in turn - cause Mechanical APDL to run very slowly. One will create fewer facets, which may in turn cause - larger tolerance errors. + * ``0`` - No face distinction. + + * ``1`` - Show only area elements having their positive normals directed toward the viewing point. + + * ``-1`` - Show only area elements having their positive normals directed away from the viewing + point. + + Notes + ----- + + .. _s-NORMAL_notes: + + :ref:`normal` allows you to select area elements and area plots by the top or bottom faces. It is + useful for checking the normal directions on shell elements. The positive normal (element Z + direction) is defined by the right-hand rule following the node I, J, K, L input direction. This + command is available only with raster or hidden-line displays, for WIN32 or X11 2D displays only. + + This command is valid in any processor. """ - command = f"GMFACE,{lab},{n}" + command = f"/NORMAL,{wn},{key}" return self.run(command, **kwargs) - def gmarker(self, curve: str = "", key: int | str = "", incr: str = "", **kwargs): - r"""Specifies the curve marking style. + def facet(self, lab: str = "", **kwargs): + r"""Specifies the facet representation used to form solid model displays. - Mechanical APDL Command: `/GMARKER `_ + Mechanical APDL Command: `/FACET `_ Parameters ---------- - curve : str - Curve number markers will be applied on (integer value between 1 and 10). + lab : str + Valid labels: - key : int or str - Marker key: + * ``FINE`` - Use finer tessellation to increase the number of facets for the display. Provides the + best representation (but decreases speed of operation). - * ``0`` - No markers will be applied (default). + * ``NORML`` - Use the basic number of facets for the display (default). - * ``1`` - TRIANGLES will be applied. + * ``COAR`` - Use a limited number of facets for the display. This option will increase the speed of + the operations, but may produce poor representations for some imported models. - * ``2`` - SQUARES will be applied. + * ``WIRE`` - Display model with a wireframe representation (fast, but surfaces will not be shown). - * ``3`` - DIAMONDS will be applied. + Notes + ----- - * ``4`` - CROSSES will be applied. + .. _s-FACET_notes: - incr : str - Determines the curve marking frequency. (a whole number value between 1 and 255). If ``INCR`` = - 1, markers are displayed at every data point on the curve. If ``INCR`` = 2 then markers are - displayed at every second data point. If ``INCR`` = 3 then they are displayed at every third - data point. + Specifies the facet (or polygon) representation used to form solid model displays. Used only with + the :ref:`aplot`, :ref:`asum`, :ref:`vplot`, and :ref:`vsum` commands. + + This command is valid in any processor. + """ + command = f"/FACET,{lab}" + return self.run(command, **kwargs) + + def shade(self, wn: str = "", type_: str = "", **kwargs): + r"""Defines the type of surface shading used with Z-buffering. + + Mechanical APDL Command: `/SHADE `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + type_ : str + Shading type: + + * ``FACET or 0`` - Facet shading (one color per area face). + + * ``GOURAUD or 1`` - Gouraud smooth shading (smooth variation of color based on interpolated vertex + colors) (default). + + * ``PHONG or 2`` - Phong smooth shading (smooth variation of color based on interpolated vertex + normals). Notes ----- - .. _s-GMARKER_notes: + .. _s-SHADE_notes: - The user-specified markers will not be drawn when the area under the curve is color-filled ( - :ref:`gropt`, FILL). + Defines the type of surface shading used on area, volume, and PowerGraphics ( :ref:`graphics`,POWER) + displays when software Z-buffering is enabled ( :ref:`slashtype` ). This command is only functional + for 2D display devices. + + This command is valid in any processor. """ - command = f"/GMARKER,{curve},{key},{incr}" + command = f"/SHADE,{wn},{type_}" return self.run(command, **kwargs) def gline(self, wn: str = "", style: int | str = "", **kwargs): @@ -882,44 +857,74 @@ def gline(self, wn: str = "", style: int | str = "", **kwargs): Unless you are using an OpenGL or Starbase driver, the dashed element outline option ( :ref:`gline`, ``WN``,1) is not available in the following situations: - Z-buffered displays ( :ref:`slashtype`, ``WN``,6). - Capped Z-buffered displays ( :ref:`slashtype`, ``WN``,7). - Qslice Z-buffered displays ( :ref:`slashtype`, ``WN``,8). + * Z-buffered displays ( :ref:`slashtype`, ``WN``,6). + + * Capped Z-buffered displays ( :ref:`slashtype`, ``WN``,7). + + * Qslice Z-buffered displays ( :ref:`slashtype`, ``WN``,8). This command is valid in any processor. """ command = f"/GLINE,{wn},{style}" return self.run(command, **kwargs) - def shade(self, wn: str = "", type_: str = "", **kwargs): - r"""Defines the type of surface shading used with Z-buffering. + def gmface(self, lab: str = "", n: str = "", **kwargs): + r"""Specifies the facet representation used to form solid models. - Mechanical APDL Command: `/SHADE `_ + Mechanical APDL Command: `GMFACE `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + lab : str + Valid Labels: - type_ : str - Shading type: + * ``FINE`` - Value that determines how coarse the facets will be. - * ``FACET or 0`` - Facet shading (one color per area face). + n : str + An integer value between one (small) and ten (large) that determines the tolerances that will be + applied to the creation of arcs and surfaces. Ten will create many facets, which may in turn + cause Mechanical APDL to run very slowly. One will create fewer facets, which may in turn cause + larger tolerance errors. + """ + command = f"GMFACE,{lab},{n}" + return self.run(command, **kwargs) + + def gmarker(self, curve: str = "", key: int | str = "", incr: str = "", **kwargs): + r"""Specifies the curve marking style. + + Mechanical APDL Command: `/GMARKER `_ + + Parameters + ---------- + curve : str + Curve number markers will be applied on (integer value between 1 and 10). - * ``GOURAUD or 1`` - Gouraud smooth shading (smooth variation of color based on interpolated vertex colors) (default). + key : int or str + Marker key: - * ``PHONG or 2`` - Phong smooth shading (smooth variation of color based on interpolated vertex normals). + * ``0`` - No markers will be applied (default). + + * ``1`` - TRIANGLES will be applied. + + * ``2`` - SQUARES will be applied. + + * ``3`` - DIAMONDS will be applied. + + * ``4`` - CROSSES will be applied. + + incr : str + Determines the curve marking frequency. (a whole number value between 1 and 255). If ``INCR`` = + 1, markers are displayed at every data point on the curve. If ``INCR`` = 2 then markers are + displayed at every second data point. If ``INCR`` = 3 then they are displayed at every third + data point. Notes ----- - .. _s-SHADE_notes: - - Defines the type of surface shading used on area, volume, and PowerGraphics ( :ref:`graphics`,POWER) - displays when software Z-buffering is enabled ( :ref:`slashtype` ). This command is only functional - for 2D display devices. + .. _s-GMARKER_notes: - This command is valid in any processor. + The user-specified markers will not be drawn when the area under the curve is color-filled ( + :ref:`gropt`, FILL). """ - command = f"/SHADE,{wn},{type_}" + command = f"/GMARKER,{curve},{key},{incr}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/views.py b/src/ansys/mapdl/core/_commands/graphics/views.py index f35ff87c0de..a081955ed0b 100644 --- a/src/ansys/mapdl/core/_commands/graphics/views.py +++ b/src/ansys/mapdl/core/_commands/graphics/views.py @@ -23,190 +23,6 @@ class Views: - def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): - r"""Specifies the viewing distance for magnifications and perspective. - - Mechanical APDL Command: `/DIST `_ - - **Command default:** - - .. _s-DIST_default: - - Distance is automatically calculated to produce full window magnification. - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - dval : str - Distance along the view line from the observer to the focus point (defaults to value producing - full- window display). Distances "too close" to the object will produce excessive - magnifications. If ``DVAL`` = AUTO, zero, or blank, the program will calculate the distance - automatically. If ``DVAL`` = USER, the distance of last display will be used (useful when last - display automatically calculated distance). - - kfact : int or str - ``DVAL`` interpretation key: - - * ``0`` - Interpret numerical ``DVAL`` values as described above. - - * ``1`` - Interpret ``DVAL`` as a multiplier on the current distance ( ``DVAL`` of 2 gives twice the current - distance; 0.5 gives half the current distance, etc.). - - Notes - ----- - - .. _s-DIST_notes: - - The scale factor is relative to the window shape. For example, for objects centered in a square - window and with parallel projection (no perspective), a distance of :math:`` /2 (+10%) producesa - full window magnification, where nbsp :math:`` isthe largest in-plane vertical or horizontal - dimension. See also :ref:`auto` and :ref:`user` commands. - - This command is valid in any processor. - """ - command = f"/DIST,{wn},{dval},{kfact}" - return self.run(command, **kwargs) - - def zoom( - self, - wn: str = "", - lab: str = "", - x1: str = "", - y1: str = "", - x2: str = "", - y2: str = "", - **kwargs, - ): - r"""Zooms a region of a display window. - - Mechanical APDL Command: `/ZOOM `_ - - Parameters - ---------- - wn : str - Window number to which command applies (defaults to 1). - - lab : str - Label to define the desired type of zoom: - - * ``OFF`` - Turns zoom off (refits image of entire model to the window). - - * ``BACK`` - Goes back to previous zoom setting (five successive back ups, maximum). - - * ``SCRN`` - Interprets X1,Y1 as the screen coordinates of the center of a square zoom region; X2,Y2 as the - screen coordinates of a point on one side of that square. - - * ``RECT`` - Interprets X1,Y1 and X2,Y2 as the screen coordinates of two opposite corners of a rectangular zoom - region. - - x1 : str - The description of the argument is missing in the Python function. Please, refer to the `command - documentation - `_ for further - information. - - y1 : str - The description of the argument is missing in the Python function. Please, refer to the `command - documentation - `_ for further - information. - - x2 : str - The description of the argument is missing in the Python function. Please, refer to the `command - documentation - `_ for further - information. - - y2 : str - The description of the argument is missing in the Python function. Please, refer to the `command - documentation - `_ for further - information. - - Notes - ----- - - .. _s-ZOOM_notes: - - Zooms (centers and magnifies) the specified region of a display window. :ref:`zoom` will operate on - a display that has been formed by an explicit graphics action command ( :ref:`aplot`, :ref:`eplot`, - etc.). :ref:`zoom` has no effect on an "immediate" graphics display. When :ref:`zoom` is executed, - the display is automatically replotted such that the specified zoom region is centered and sized to - fill the window. - - Auto resizing is disabled when you issue the :ref:`zoom` command. To restore auto resizing, issue - the :ref:`auto` command, or select FIT from the `Pan, Zoom, Rotate - `_ - box. - - This command is valid in any processor. - """ - command = f"/ZOOM,{wn},{lab},{x1},{y1},{x2},{y2}" - return self.run(command, **kwargs) - - def focus( - self, - wn: str = "", - xf: str = "", - yf: str = "", - zf: str = "", - ktrans: int | str = "", - **kwargs, - ): - r"""Specifies the focus point (center of the window). - - Mechanical APDL Command: `/FOCUS `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - xf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). - - yf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). - - zf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). - - ktrans : int or str - Translate key: - - * ``0`` - Interpret numerical ``XF``, ``YF``, ``ZF`` values as described above. - - * ``1`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the current - position in the screen coordinate system. Example: ``XF`` of 2.4 translates the display - approximately 2.4 half-screens to the left in the screen X (horizontal) direction. - - * ``2`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the current - position in the global Cartesian coordinate system. Example: ``XF`` of 1.5 translates the display - approximately 1.5 half-screens in the global Cartesian X direction of the model. - - Notes - ----- - - .. _s-FOCUS_notes: - - Specifies the location on (or off) the model which is to be located at the focus point (center of - the window). For section and capped displays, the cutting plane is also assumed to pass through this - location (unless the working plane is used via :ref:`cplane` ). See also :ref:`auto` and :ref:`user` - commands. - - This command is valid in any processor. - """ - command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" - return self.run(command, **kwargs) - def xfrm( self, lab: str = "", @@ -234,36 +50,36 @@ def xfrm( lab : str The location or entity (centroid) used to define the center or axis of rotation. - * ``NODE`` - If NODE is chosen for the center of rotation, the node number will be ``X1``. If the rotation is to - be about an axis, then ``X1`` and ``Y1`` define the two nodes between which a line is drawn to - determine the axis. The remaining arguments are ignored. + * ``NODE`` - If NODE is chosen for the center of rotation, the node number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two nodes between which a line is + drawn to determine the axis. The remaining arguments are ignored. - * ``ELEMENT`` - If ELEMENT is chosen for the center of rotation, the element number will be ``X1``. If the rotation - is to be about an axis, then ``X1`` and ``Y1`` define the two elements between which a line is drawn - to determine the axis. The remaining arguments are ignored. + * ``ELEMENT`` - If ELEMENT is chosen for the center of rotation, the element number will be ``X1``. + If the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two elements between which + a line is drawn to determine the axis. The remaining arguments are ignored. - * ``KP`` - If KP is chosen for the center of rotation, the keypoint number will be ``X1``. If the rotation is - to be about an axis, then ``X1`` and ``Y1`` define the two keypoints between which a line is drawn - to determine the axis. The remaining arguments are ignored. + * ``KP`` - If KP is chosen for the center of rotation, the keypoint number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two keypoints between which a + line is drawn to determine the axis. The remaining arguments are ignored. - * ``LINE`` - If LINE is chosen for the center of rotation, the line number will be ``X1``. If the rotation is to - be about an axis, then ``X1`` and ``Y1`` define the two lines between which a line is drawn to - determine the axis. The remaining arguments are ignored. + * ``LINE`` - If LINE is chosen for the center of rotation, the line number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two lines between which a line is + drawn to determine the axis. The remaining arguments are ignored. - * ``AREA`` - If AREA is chosen for the center of rotation, the area number will be ``X1``. If the rotation is to - be about an axis, then ``X1`` and ``Y1`` define the two areas between which a line is drawn to - determine the axis. The remaining arguments are ignored. + * ``AREA`` - If AREA is chosen for the center of rotation, the area number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two areas between which a line is + drawn to determine the axis. The remaining arguments are ignored. - * ``VOLUME`` - If VOLUME is chosen for the center of rotation, the volume number will be ``X1``. If the rotation is - to be about an axis, then ``X1`` and ``Y1`` define the two volumes between which a line is drawn to - determine the axis. The remaining arguments are ignored. + * ``VOLUME`` - If VOLUME is chosen for the center of rotation, the volume number will be ``X1``. If + the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two volumes between which a + line is drawn to determine the axis. The remaining arguments are ignored. - * ``XYZ`` - If XYZ is chosen for the center of rotation, the location of that center is determined by the - coordinates ``X1``, ``Y1``, ``Z1``. If values are specified for ``X2``, ``Y2``, ``Z2``, then the - axis of rotation will be about the line between those two points. + * ``XYZ`` - If XYZ is chosen for the center of rotation, the location of that center is determined + by the coordinates ``X1``, ``Y1``, ``Z1``. If values are specified for ``X2``, ``Y2``, ``Z2``, then + the axis of rotation will be about the line between those two points. - * ``OFF`` - If ``LAB`` = OFF, DEFAULT, FOCUS or if no value is specified, then the center of rotation is set at - the FOCUS point, as defined by the :ref:`focus` command. + * ``OFF`` - If ``LAB`` = OFF, DEFAULT, FOCUS or if no value is specified, then the center of + rotation is set at the FOCUS point, as defined by the :ref:`focus` command. x1 : str The entity number or X coordinate for the center of rotation. @@ -302,50 +118,45 @@ def xfrm( command = f"/XFRM,{lab},{x1},{y1},{z1},{x2},{y2},{z2}" return self.run(command, **kwargs) - def view(self, wn: str = "", xv: str = "", yv: str = "", zv: str = "", **kwargs): - r"""Defines the viewing direction for the display. + def vup(self, wn: str = "", label: str = "", **kwargs): + r"""Specifies the global Cartesian coordinate system reference orientation. - Mechanical APDL Command: `/VIEW `_ + Mechanical APDL Command: `/VUP `_ Parameters ---------- wn : str Window number (or ALL) to which command applies (defaults to 1). - xv : str - The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate - system) to the global coordinate system origin. For section displays, the cutting plane is - assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the - currently defined working plane. Defaults to (0,0,1). + label : str + Orientation: - yv : str - The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate - system) to the global coordinate system origin. For section displays, the cutting plane is - assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the - currently defined working plane. Defaults to (0,0,1). + * ``Y`` - Y vertical upward, X horizontal to the right, Z out from the screen (default). - zv : str - The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate - system) to the global coordinate system origin. For section displays, the cutting plane is - assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the - currently defined working plane. Defaults to (0,0,1). + * ``-Y`` - Y vertical downward, X horizontal to the left, Z out from the screen. + + * ``X`` - X vertical upward, Y horizontal to the left, Z out from the screen. + + * ``-X`` - X vertical downward, Y horizontal to the right, Z out from the screen. + + * ``Z`` - Z vertical upward, Y horizontal to the right, X out from the screen. With this choice, you + should use a view other than the :ref:`view` default of (0,0,1). + + * ``-Z`` - Z vertical downward, Y horizontal to the left, X out from the screen. With this choice, + you should use a view other than the :ref:`view` default of (0,0,1). Notes ----- - .. _s-VIEW_notes: + .. _s-VUP_notes: - The view line is always normal to the screen. The view is selected by defining a point (in the - global Cartesian coordinate system) representing a point along the viewing line. This point, and the - global Cartesian coordinate system origin, define the line along which the object is viewed while - looking toward the origin. Any point along the view line may be used, that is, (1,1,1) and (2,2,2) - give the same view. The display orientation may be changed as desired ( :ref:`angle` ). The display - coordinate system type may be changed (from Cartesian to cylindrical, spherical, toroidal, etc.) - with the :ref:`dsys` command. + Specifies the global Cartesian coordinate system reference orientation. The :ref:`view` and + :ref:`angle` commands may be used to reorient the view and are relative to this reference + orientation. All coordinate systems are right-handed. This command is valid in any processor. """ - command = f"/VIEW,{wn},{xv},{yv},{zv}" + command = f"/VUP,{wn},{label}" return self.run(command, **kwargs) def vcone(self, wn: str = "", phi: str = "", **kwargs): @@ -406,51 +217,102 @@ def vcone(self, wn: str = "", phi: str = "", **kwargs): command = f"/VCONE,{wn},{phi}" return self.run(command, **kwargs) - def vup(self, wn: str = "", label: str = "", **kwargs): - r"""Specifies the global Cartesian coordinate system reference orientation. + def view(self, wn: str = "", xv: str = "", yv: str = "", zv: str = "", **kwargs): + r"""Defines the viewing direction for the display. - Mechanical APDL Command: `/VUP `_ + Mechanical APDL Command: `/VIEW `_ Parameters ---------- wn : str Window number (or ALL) to which command applies (defaults to 1). - label : str - Orientation: + xv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). - * ``Y`` - Y vertical upward, X horizontal to the right, Z out from the screen (default). + yv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). - * ``-Y`` - Y vertical downward, X horizontal to the left, Z out from the screen. + zv : str + The object is viewed along the line from point ``XV``, ``YV``, ``ZV`` (in the global coordinate + system) to the global coordinate system origin. For section displays, the cutting plane is + assumed to be perpendicular to this line. If ``XV`` = WP, modify view to be normal to the + currently defined working plane. Defaults to (0,0,1). - * ``X`` - X vertical upward, Y horizontal to the left, Z out from the screen. + Notes + ----- - * ``-X`` - X vertical downward, Y horizontal to the right, Z out from the screen. + .. _s-VIEW_notes: + + The view line is always normal to the screen. The view is selected by defining a point (in the + global Cartesian coordinate system) representing a point along the viewing line. This point, and the + global Cartesian coordinate system origin, define the line along which the object is viewed while + looking toward the origin. Any point along the view line may be used, that is, (1,1,1) and (2,2,2) + give the same view. The display orientation may be changed as desired ( :ref:`angle` ). The display + coordinate system type may be changed (from Cartesian to cylindrical, spherical, toroidal, etc.) + with the :ref:`dsys` command. + + This command is valid in any processor. + """ + command = f"/VIEW,{wn},{xv},{yv},{zv}" + return self.run(command, **kwargs) - * ``Z`` - Z vertical upward, Y horizontal to the right, X out from the screen. With this choice, you should - use a view other than the :ref:`view` default of (0,0,1). + def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): + r"""Specifies the viewing distance for magnifications and perspective. + + Mechanical APDL Command: `/DIST `_ - * ``-Z`` - Z vertical downward, Y horizontal to the left, X out from the screen. With this choice, you should - use a view other than the :ref:`view` default of (0,0,1). + **Command default:** + + .. _s-DIST_default: + + Distance is automatically calculated to produce full window magnification. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + dval : str + Distance along the view line from the observer to the focus point (defaults to value producing + full- window display). Distances "too close" to the object will produce excessive + magnifications. If ``DVAL`` = AUTO, zero, or blank, the program will calculate the distance + automatically. If ``DVAL`` = USER, the distance of last display will be used (useful when last + display automatically calculated distance). + + kfact : int or str + ``DVAL`` interpretation key: + + * ``0`` - Interpret numerical ``DVAL`` values as described above. + + * ``1`` - Interpret ``DVAL`` as a multiplier on the current distance ( ``DVAL`` of 2 gives twice the + current distance; 0.5 gives half the current distance, etc.). Notes ----- - .. _s-VUP_notes: + .. _s-DIST_notes: - Specifies the global Cartesian coordinate system reference orientation. The :ref:`view` and - :ref:`angle` commands may be used to reorient the view and are relative to this reference - orientation. All coordinate systems are right-handed. + The scale factor is relative to the window shape. For example, for objects centered in a square + window and with parallel projection (no perspective), a distance of :math:`` /2 (+10%) producesa + full window magnification, where nbsp :math:`` isthe largest in-plane vertical or horizontal + dimension. See also :ref:`auto` and :ref:`user` commands. This command is valid in any processor. """ - command = f"/VUP,{wn},{label}" + command = f"/DIST,{wn},{dval},{kfact}" return self.run(command, **kwargs) - def auto(self, wn: str = "", **kwargs): - r"""Resets the focus and distance specifications to "automatically calculated." + def user(self, wn: str = "", **kwargs): + r"""Conveniently resets :ref:`focus` and :ref:`dist` to USER. - Mechanical APDL Command: `/AUTO `_ + Mechanical APDL Command: `/USER `_ Parameters ---------- @@ -460,15 +322,78 @@ def auto(self, wn: str = "", **kwargs): Notes ----- - .. _s-AUTO_notes: + .. _s-USER_notes: - Focus point and distance will be automatically calculated during next display. Settings may still be - changed with the :ref:`focus` and :ref:`dist` commands after this command has been issued. See also - the :ref:`user` command. + Conveniently resets scale parameters to USER on the :ref:`focus` and :ref:`dist` commands. Scale + parameters will be internally respecified to those used for the last display. Convenient when the + last scale parameters were automatically calculated. User specified parameters hold until changed or + removed ( :ref:`auto` ). Parameters may be reset on the individual commands after this command has + been issued. This command is valid in any processor. """ - command = f"/AUTO,{wn}" + command = f"/USER,{wn}" + return self.run(command, **kwargs) + + def focus( + self, + wn: str = "", + xf: str = "", + yf: str = "", + zf: str = "", + ktrans: int | str = "", + **kwargs, + ): + r"""Specifies the focus point (center of the window). + + Mechanical APDL Command: `/FOCUS `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + xf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + yf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + zf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + ktrans : int or str + Translate key: + + * ``0`` - Interpret numerical ``XF``, ``YF``, ``ZF`` values as described above. + + * ``1`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the + current position in the screen coordinate system. Example: ``XF`` of 2.4 translates the display + approximately 2.4 half-screens to the left in the screen X (horizontal) direction. + + * ``2`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the + current position in the global Cartesian coordinate system. Example: ``XF`` of 1.5 translates the + display approximately 1.5 half-screens in the global Cartesian X direction of the model. + + Notes + ----- + + .. _s-FOCUS_notes: + + Specifies the location on (or off) the model which is to be located at the focus point (center of + the window). For section and capped displays, the cutting plane is also assumed to pass through this + location (unless the working plane is used via :ref:`cplane` ). See also :ref:`auto` and :ref:`user` + commands. + + This command is valid in any processor. + """ + command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" return self.run(command, **kwargs) def angle( @@ -518,10 +443,10 @@ def angle( command = f"/ANGLE,{wn},{theta},{axis},{kincr}" return self.run(command, **kwargs) - def user(self, wn: str = "", **kwargs): - r"""Conveniently resets :ref:`focus` and :ref:`dist` to USER. + def auto(self, wn: str = "", **kwargs): + r"""Resets the focus and distance specifications to "automatically calculated." - Mechanical APDL Command: `/USER `_ + Mechanical APDL Command: `/AUTO `_ Parameters ---------- @@ -531,15 +456,90 @@ def user(self, wn: str = "", **kwargs): Notes ----- - .. _s-USER_notes: + .. _s-AUTO_notes: - Conveniently resets scale parameters to USER on the :ref:`focus` and :ref:`dist` commands. Scale - parameters will be internally respecified to those used for the last display. Convenient when the - last scale parameters were automatically calculated. User specified parameters hold until changed or - removed ( :ref:`auto` ). Parameters may be reset on the individual commands after this command has - been issued. + Focus point and distance will be automatically calculated during next display. Settings may still be + changed with the :ref:`focus` and :ref:`dist` commands after this command has been issued. See also + the :ref:`user` command. This command is valid in any processor. """ - command = f"/USER,{wn}" + command = f"/AUTO,{wn}" + return self.run(command, **kwargs) + + def zoom( + self, + wn: str = "", + lab: str = "", + x1: str = "", + y1: str = "", + x2: str = "", + y2: str = "", + **kwargs, + ): + r"""Zooms a region of a display window. + + Mechanical APDL Command: `/ZOOM `_ + + Parameters + ---------- + wn : str + Window number to which command applies (defaults to 1). + + lab : str + Label to define the desired type of zoom: + + * ``OFF`` - Turns zoom off (refits image of entire model to the window). + + * ``BACK`` - Goes back to previous zoom setting (five successive back ups, maximum). + + * ``SCRN`` - Interprets X1,Y1 as the screen coordinates of the center of a square zoom region; X2,Y2 + as the screen coordinates of a point on one side of that square. + + * ``RECT`` - Interprets X1,Y1 and X2,Y2 as the screen coordinates of two opposite corners of a + rectangular zoom region. + + x1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + y1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + x2 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + y2 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + Notes + ----- + + .. _s-ZOOM_notes: + + Zooms (centers and magnifies) the specified region of a display window. :ref:`zoom` will operate on + a display that has been formed by an explicit graphics action command ( :ref:`aplot`, :ref:`eplot`, + etc.). :ref:`zoom` has no effect on an "immediate" graphics display. When :ref:`zoom` is executed, + the display is automatically replotted such that the specified zoom region is centered and sized to + fill the window. + + Auto resizing is disabled when you issue the :ref:`zoom` command. To restore auto resizing, issue + the :ref:`auto` command, or select FIT from the `Pan, Zoom, Rotate + `_ + box. + + This command is valid in any processor. + """ + command = f"/ZOOM,{wn},{lab},{x1},{y1},{x2},{y2}" return self.run(command, **kwargs) From dd042e9a8980da31698c36ea3d3e59ff1cca4a10 Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Fri, 18 Apr 2025 21:20:56 +0200 Subject: [PATCH 07/10] fix: modifying ``int``, ``max``, ``min`` and ``abs`` argument names --- .../mapdl/core/_commands/graphics/labeling.py | 18 +++++++++--------- .../mapdl/core/_commands/graphics/set_up.py | 2 +- .../mapdl/core/_commands/graphics/style.py | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py index 1d0a89fe970..2bc7fdf0650 100644 --- a/src/ansys/mapdl/core/_commands/graphics/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -286,9 +286,9 @@ def pbc( self, item: str = "", key: int | str = "", - min: str = "", - max: str = "", - abs: str = "", + min_: str = "", + max_: str = "", + abs_: str = "", **kwargs, ): r"""Shows boundary condition (BC) symbols and values on displays. @@ -310,7 +310,7 @@ def pbc( * ``ROT`` - Applied rotational constraints (ROTX, ROTY, ROTZ). - * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3...., TTOP). + * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3,..., TTOP). * ``PRES`` - Applied fluid pressures. @@ -330,7 +330,7 @@ def pbc( * ``M or MOME`` - Applied structural moments (MX, MY, MZ). - * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3...., HTOP). + * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3,..., HTOP). * ``FLOW`` - Applied fluid flow. @@ -375,13 +375,13 @@ def pbc( * ``2`` - Plot value next to symbol. - min : str + min_ : str Minimum value in a range of values plotted on screen. - max : str + max_ : str Maximum value in a range of values plotted on screen. - abs : str + abs_ : str Absolute number. If ``KEY`` = 2 and ``ABS`` = 0, a number falling between the ``MIN`` and ``MAX`` is displayed. If ``ABS`` is not specified, it defaults to 0. If ``KEY`` = 2 and ``ABS`` = 1, an absolute value falling between the ``MIN`` and ``MAX`` is displayed. ``ABS`` = 1 lets @@ -425,7 +425,7 @@ def pbc( The :ref:`pbc` command is valid in any processor. """ - command = f"/PBC,{item},,{key},{min},{max},{abs}" + command = f"/PBC,{item},,{key},{min_},{max_},{abs_}" return self.run(command, **kwargs) def plopts(self, label: str = "", key: int | str = "", **kwargs): diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index 1d0158b0b2f..21b50fd9922 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -277,7 +277,7 @@ def device(self, label: str = "", key: int | str = "", **kwargs): parameters. These values are device specific; using the same command input file ( :ref:`input` ) on different machines may yield different results.. The following ``KEY`` values determine the font information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, - JPEG....): + JPEG,...): * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. diff --git a/src/ansys/mapdl/core/_commands/graphics/style.py b/src/ansys/mapdl/core/_commands/graphics/style.py index c9e14063c6c..39d73651cab 100644 --- a/src/ansys/mapdl/core/_commands/graphics/style.py +++ b/src/ansys/mapdl/core/_commands/graphics/style.py @@ -29,7 +29,7 @@ def light( self, wn: str = "", num: int | str = "", - int: str = "", + int_: str = "", xv: str = "", yv: str = "", zv: str = "", @@ -52,7 +52,7 @@ def light( * ``1`` - Directional light. - int : str + int_ : str Light intensity factor (defaults to 0.3 for ambient, 1.0 for directional). This option is valid only for 3D devices). @@ -93,7 +93,7 @@ def light( This command is valid in any processor. """ - command = f"/LIGHT,{wn},{num},{int},{xv},{yv},{zv},{refl}" + command = f"/LIGHT,{wn},{num},{int_},{xv},{yv},{zv},{refl}" return self.run(command, **kwargs) def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): @@ -287,7 +287,7 @@ def eshape(self, scale: str = "", key: str = "", **kwargs): This command is valid in any processor. """ warnings.warn( - "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(vtk=False)`` " + "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(backend=GraphicsBackend.MAPDL)`` " ) command = f"/ESHAPE,{scale},{key}" return self.run(command, **kwargs) From 16c27ced423d671386612b9909d870d16c1698b0 Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:23:02 +0200 Subject: [PATCH 08/10] feat: latest enhancements --- doc/source/mapdl_commands/graphics/index.rst | 16 +- .../core/_commands/graphics/annotation.py | 772 +++---- .../mapdl/core/_commands/graphics/graphs.py | 346 +-- .../mapdl/core/_commands/graphics/labeling.py | 1121 +++++----- .../mapdl/core/_commands/graphics/scaling.py | 128 +- .../mapdl/core/_commands/graphics/set_up.py | 1990 +++++++++-------- .../mapdl/core/_commands/graphics/style.py | 774 ++++--- .../mapdl/core/_commands/graphics/views.py | 453 ++-- 8 files changed, 2800 insertions(+), 2800 deletions(-) diff --git a/doc/source/mapdl_commands/graphics/index.rst b/doc/source/mapdl_commands/graphics/index.rst index ae36816d5cb..830e8cc2a78 100644 --- a/doc/source/mapdl_commands/graphics/index.rst +++ b/doc/source/mapdl_commands/graphics/index.rst @@ -6,23 +6,23 @@ Graphics .. list-table:: - * - :ref:`ref_scaling` + * - :ref:`ref_style` + * - :ref:`ref_annotation` + * - :ref:`ref_labeling` * - :ref:`ref_set_up` * - :ref:`ref_views` * - :ref:`ref_graphs` - * - :ref:`ref_annotation` - * - :ref:`ref_style` - * - :ref:`ref_labeling` + * - :ref:`ref_scaling` .. toctree:: :maxdepth: 1 :hidden: - scaling + style + annotation + labeling set_up views graphs - annotation - style - labeling + scaling diff --git a/src/ansys/mapdl/core/_commands/graphics/annotation.py b/src/ansys/mapdl/core/_commands/graphics/annotation.py index e7753520d59..f9874e7aee5 100644 --- a/src/ansys/mapdl/core/_commands/graphics/annotation.py +++ b/src/ansys/mapdl/core/_commands/graphics/annotation.py @@ -23,214 +23,41 @@ class Annotation: - def slashline( - self, x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs - ): - r"""Creates annotation lines (GUI). - - Mechanical APDL Command: `/LINE `_ - - Parameters - ---------- - x1 : str - Line X starting location (-1.0 < X < 2.0). - - y1 : str - Line Y starting location (-1.0 < Y < 1.0). - - x2 : str - Line X ending location (-1.0 < X < 2.0). - - y2 : str - Line Y ending location (-1.0 < Y < 1.0). - - Notes - ----- - - .. _s-LINE_notes: - - This command defines annotation lines to be written directly onto the display at a specified - location. - - The command is generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file for batch input or for use - with the - :ref:`input` command). - - All lines are shown on subsequent displays unless the annotation is turned off or deleted. Issue - :ref:`lspec` to set the attributes of the line. - - This command is valid in any processor. - """ - command = f"/LINE,{x1},{y1},{x2},{y2}" - return self.run(command, **kwargs) - - def lsymbol( - self, - x: str = "", - y: str = "", - symang: str = "", - symtyp: int | str = "", - symsiz: str = "", - keybmp: str = "", - **kwargs, - ): - r"""Creates annotation symbols (GUI). - - Mechanical APDL Command: `/LSYMBOL `_ - - Parameters - ---------- - x : str - X location for symbol (-1.0 < X < 2.0). - - y : str - Y location for symbol (-1.0 < Y < 1.0). - - symang : str - Symbol orientation angle. - - symtyp : int or str - Symbol type: - - * ``1`` - Arrow. - - * ``2`` - Tee. - - * ``3`` - Circle. - - * ``4`` - Triangle. - - * ``5`` - Star. - - symsiz : str - Symbol size multiplier (0.1 to 20.0). Defaults to 1.0. - - keybmp : str - If ``KEYBMP`` = 1, the annotation is a bitmap. ``SYMTYP`` will then be a number from 1-99, - indicating the bitmap type (see notes), and ``X`` and ``Y`` will define the lower left corner of - the bitmap. The ``SYMANG``, ``SYMSIZ`` arguments are ignored. If ``KEYBMP`` = 0, or blank, then - the argument definitions above apply. - - Notes - ----- - - .. _s-LSYMBOL_notes: - - Defines annotation symbols to be written directly onto the display at a specified location. This is - a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation - is used. This command is not intended to be typed in directly in a Mechanical APDL session (although - it can - be included in an input file for batch input or for use with the :ref:`input` command). - - All symbols are shown on subsequent displays unless the annotation is turned off or deleted. Use the - :ref:`lspec` command to set the attributes of the symbol. - - The ``KEYBMP`` argument reads the symtype argument to determine which bitmap to insert. This bitmap - is defined by an integer between 1 and 99. Numbers 1 through 40 correspond to the standard texture - values found in the :ref:`txtre` command, while numbers 51 through 99 correspond to user supplied - bitmaps, as defined using the Filename option of the :ref:`txtre` command. Numbers 51 through 57 are - predefined (the logos, clamps and arrows available from the GUI) but can be overridden. Numbers 41 - through 50 are reserved. - - This command is valid in any processor. - """ - command = f"/LSYMBOL,{x},{y},{symang},{symtyp},{symsiz},{keybmp}" - return self.run(command, **kwargs) - - def lspec( - self, lcolor: str = "", linstl: int | str = "", xlnwid: str = "", **kwargs - ): - r"""Specifies annotation line attributes (GUI). - - Mechanical APDL Command: `/LSPEC `_ - - Parameters - ---------- - lcolor : str - - linstl : int or str - Line style: - - * ``0`` - Solid line. - - * ``1`` - Dashed line. - - xlnwid : str - Line width multiplier (1.0 to 20.0). Defaults to 1.0. - - Notes - ----- - - .. _s-LSPEC_notes: - - This command specifies annotation line attributes to control certain characteristics of the lines - created via the :ref:`slashline`, :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, - :ref:`pcircle`, and :ref:`pwedge` commands. - - The command is generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file for batch input or for use - with the - :ref:`input` command). - - This command is valid in any processor. - """ - command = f"/LSPEC,{lcolor},{linstl},{xlnwid}" - return self.run(command, **kwargs) - - def slashlarc( - self, - xcentr: str = "", - ycentr: str = "", - xlrad: str = "", - angle1: str = "", - angle2: str = "", - **kwargs, - ): - r"""Creates annotation arcs (GUI). + def pcircle(self, xcentr: str = "", ycentr: str = "", xlrad: str = "", **kwargs): + r"""Creates an annotation circle (GUI). - Mechanical APDL Command: `/LARC `_ + Mechanical APDL Command: `/PCIRCLE `_ Parameters ---------- xcentr : str - Arc X center location (-1.0 < X < 1.0). + Circle X center location (-1.0 < X < 2.0). ycentr : str - Arc Y center location (-1.0 < Y < 1.0). + Circle Y center location (-1.0 < Y < 1.0). xlrad : str - Arc radius length. - - angle1 : str - Starting angle of arc. - - angle2 : str - Ending angle of arc. The arc is drawn counterclockwise from the starting angle, ``ANGLE1``, to - the ending angle, ``ANGLE2``. + Circle radius length. Notes ----- - .. _s-LARC_notes: + .. _s-PCIRCLE_notes: - This command defines annotation arcs to be written directly onto the display at a specified - location. + Creates an annotation circle to be written directly onto the display at a specified location. This + is a command generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. - The command is generated by the Graphical User Interface (GUI) and will appear in the log file ( - :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a - Mechanical APDL session (although it can be included in an input file for batch input or for use - with the - :ref:`input` command). + This command is not intended to be typed in directly in a Mechanical APDL session (although it can + be + included in an input file for batch input or for use with the :ref:`input` command). - All arcs are shown on subsequent displays unless the annotation is turned off or deleted. Issueu - :ref:`lspec` to set the attributes of the arc. + All circles are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the circle. This command is valid in any processor. """ - command = f"/LARC,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" + command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" return self.run(command, **kwargs) def polygon( @@ -253,7 +80,7 @@ def polygon( Parameters ---------- nvert : str - Number of vertices of polygon (3 :math:`` ``NVERT`` :math:`` 8). Use :ref:`pmore` for + Number of vertices of polygon (3 :math:```` ``NVERT`` :math:```` 8). Use :ref:`pmore` for polygons with more than 4 vertices. x1 : str @@ -301,94 +128,6 @@ def polygon( command = f"/POLYGON,{nvert},{x1},{y1},{x2},{y2},{x3},{y3},{x4},{y4}" return self.run(command, **kwargs) - def pcircle(self, xcentr: str = "", ycentr: str = "", xlrad: str = "", **kwargs): - r"""Creates an annotation circle (GUI). - - Mechanical APDL Command: `/PCIRCLE `_ - - Parameters - ---------- - xcentr : str - Circle X center location (-1.0 < X < 2.0). - - ycentr : str - Circle Y center location (-1.0 < Y < 1.0). - - xlrad : str - Circle radius length. - - Notes - ----- - - .. _s-PCIRCLE_notes: - - Creates an annotation circle to be written directly onto the display at a specified location. This - is a command generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. - - This command is not intended to be typed in directly in a Mechanical APDL session (although it can - be - included in an input file for batch input or for use with the :ref:`input` command). - - All circles are shown on subsequent displays unless the annotation is turned off or deleted. Issue - :ref:`lspec` and :ref:`slashpspec` to set the attributes of the circle. - - This command is valid in any processor. - """ - command = f"/PCIRCLE,{xcentr},{ycentr},{xlrad}" - return self.run(command, **kwargs) - - def pwedge( - self, - xcentr: str = "", - ycentr: str = "", - xlrad: str = "", - angle1: str = "", - angle2: str = "", - **kwargs, - ): - r"""Creates an annotation wedge (GUI). - - Mechanical APDL Command: `/PWEDGE `_ - - Parameters - ---------- - xcentr : str - Wedge X center location (-1.0 < X < 2.0). - - ycentr : str - Wedge Y center location (-1.0 < Y < 1.0). - - xlrad : str - Wedge radius length. - - angle1 : str - Starting angle of wedge. - - angle2 : str - Ending angle of wedge. The wedge is drawn counterclockwise from the starting angle, ``ANGLE1``, - to the ending angle, ``ANGLE2``. - - Notes - ----- - - .. _s-PWEDGE_notes: - - Creates an annotation wedge to be written directly onto the display at a specified location. This is - a command generated by the Graphical User Interface (GUI) and will appear in the log file ( - :file:`Jobname.LOG` ) if annotation is used. - - The command is not intended to be typed in directly in a Mechanical APDL session (although it can be - included in an input file for batch input or for use with :ref:`input` ). - - All wedges are shown on subsequent displays unless the annotation is disabled or deleted. Issue - :ref:`lspec` and :ref:`slashpspec` to set the attributes of the wedge. - - This command is valid in any processor. - """ - command = f"/PWEDGE,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" - return self.run(command, **kwargs) - def slashpspec( self, pcolor: int | str = "", @@ -403,7 +142,7 @@ def slashpspec( Parameters ---------- pcolor : int or str - Polygon color (0 :math:`` ``PCOLOR`` :math:`` 15): + Polygon color (0 :math:```` ``PCOLOR`` :math:```` 15): * ``0`` - Black. @@ -470,6 +209,57 @@ def slashpspec( command = f"/PSPEC,{pcolor},{kfill},{kbordr}" return self.run(command, **kwargs) + def pwedge( + self, + xcentr: str = "", + ycentr: str = "", + xlrad: str = "", + angle1: str = "", + angle2: str = "", + **kwargs, + ): + r"""Creates an annotation wedge (GUI). + + Mechanical APDL Command: `/PWEDGE `_ + + Parameters + ---------- + xcentr : str + Wedge X center location (-1.0 < X < 2.0). + + ycentr : str + Wedge Y center location (-1.0 < Y < 1.0). + + xlrad : str + Wedge radius length. + + angle1 : str + Starting angle of wedge. + + angle2 : str + Ending angle of wedge. The wedge is drawn counterclockwise from the starting angle, ``ANGLE1``, + to the ending angle, ``ANGLE2``. + + Notes + ----- + + .. _s-PWEDGE_notes: + + Creates an annotation wedge to be written directly onto the display at a specified location. This is + a command generated by the Graphical User Interface (GUI) and will appear in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + All wedges are shown on subsequent displays unless the annotation is disabled or deleted. Issue + :ref:`lspec` and :ref:`slashpspec` to set the attributes of the wedge. + + This command is valid in any processor. + """ + command = f"/PWEDGE,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" + return self.run(command, **kwargs) + def pmore( self, x5: str = "", @@ -516,55 +306,228 @@ def pmore( Notes ----- - .. _s-PMORE_notes: + .. _s-PMORE_notes: + + Defines the 5th through 8th vertices of an annotation polygon ( :ref:`polygon` ). This is a command + generated by the Graphical User Interface (GUI) and appears in the log file ( :file:`Jobname.LOG` ) + if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with the :ref:`input` command). + + This command is valid in any processor. + """ + command = f"/PMORE,,{x5},{y5},{x6},{y6},{x7},{y7},{x8},{y8}" + return self.run(command, **kwargs) + + def lsymbol( + self, + x: str = "", + y: str = "", + symang: str = "", + symtyp: int | str = "", + symsiz: str = "", + keybmp: str = "", + **kwargs, + ): + r"""Creates annotation symbols (GUI). + + Mechanical APDL Command: `/LSYMBOL `_ + + Parameters + ---------- + x : str + X location for symbol (-1.0 < X < 2.0). + + y : str + Y location for symbol (-1.0 < Y < 1.0). + + symang : str + Symbol orientation angle. + + symtyp : int or str + Symbol type: + + * ``1`` - Arrow. + + * ``2`` - Tee. + + * ``3`` - Circle. + + * ``4`` - Triangle. + + * ``5`` - Star. + + symsiz : str + Symbol size multiplier (0.1 to 20.0). Defaults to 1.0. + + keybmp : str + If ``KEYBMP`` = 1, the annotation is a bitmap. ``SYMTYP`` will then be a number from 1-99, + indicating the bitmap type (see notes), and ``X`` and ``Y`` will define the lower left corner of + the bitmap. The ``SYMANG``, ``SYMSIZ`` arguments are ignored. If ``KEYBMP`` = 0, or blank, then + the argument definitions above apply. + + Notes + ----- + + .. _s-LSYMBOL_notes: + + Defines annotation symbols to be written directly onto the display at a specified location. This is + a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation + is used. This command is not intended to be typed in directly in a Mechanical APDL session (although + it can + be included in an input file for batch input or for use with the :ref:`input` command). + + All symbols are shown on subsequent displays unless the annotation is turned off or deleted. Use the + :ref:`lspec` command to set the attributes of the symbol. + + The ``KEYBMP`` argument reads the symtype argument to determine which bitmap to insert. This bitmap + is defined by an integer between 1 and 99. Numbers 1 through 40 correspond to the standard texture + values found in the :ref:`txtre` command, while numbers 51 through 99 correspond to user supplied + bitmaps, as defined using the Filename option of the :ref:`txtre` command. Numbers 51 through 57 are + predefined (the logos, clamps and arrows available from the GUI) but can be overridden. Numbers 41 + through 50 are reserved. + + This command is valid in any processor. + """ + command = f"/LSYMBOL,{x},{y},{symang},{symtyp},{symsiz},{keybmp}" + return self.run(command, **kwargs) + + def slashline( + self, x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs + ): + r"""Creates annotation lines (GUI). + + Mechanical APDL Command: `/LINE `_ + + Parameters + ---------- + x1 : str + Line X starting location (-1.0 < X < 2.0). + + y1 : str + Line Y starting location (-1.0 < Y < 1.0). + + x2 : str + Line X ending location (-1.0 < X < 2.0). + + y2 : str + Line Y ending location (-1.0 < Y < 1.0). + + Notes + ----- + + .. _s-LINE_notes: + + This command defines annotation lines to be written directly onto the display at a specified + location. + + The command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + All lines are shown on subsequent displays unless the annotation is turned off or deleted. Issue + :ref:`lspec` to set the attributes of the line. + + This command is valid in any processor. + """ + command = f"/LINE,{x1},{y1},{x2},{y2}" + return self.run(command, **kwargs) + + def slashlarc( + self, + xcentr: str = "", + ycentr: str = "", + xlrad: str = "", + angle1: str = "", + angle2: str = "", + **kwargs, + ): + r"""Creates annotation arcs (GUI). + + Mechanical APDL Command: `/LARC `_ + + Parameters + ---------- + xcentr : str + Arc X center location (-1.0 < X < 1.0). + + ycentr : str + Arc Y center location (-1.0 < Y < 1.0). + + xlrad : str + Arc radius length. + + angle1 : str + Starting angle of arc. + + angle2 : str + Ending angle of arc. The arc is drawn counterclockwise from the starting angle, ``ANGLE1``, to + the ending angle, ``ANGLE2``. + + Notes + ----- + + .. _s-LARC_notes: - Defines the 5th through 8th vertices of an annotation polygon ( :ref:`polygon` ). This is a command - generated by the Graphical User Interface (GUI) and appears in the log file ( :file:`Jobname.LOG` ) - if annotation is used. + This command defines annotation arcs to be written directly onto the display at a specified + location. - The command is not intended to be typed in directly in a Mechanical APDL session (although it can be - included in an input file for batch input or for use with the :ref:`input` command). + The command is generated by the Graphical User Interface (GUI) and will appear in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). + + All arcs are shown on subsequent displays unless the annotation is turned off or deleted. Issueu + :ref:`lspec` to set the attributes of the arc. This command is valid in any processor. """ - command = f"/PMORE,,{x5},{y5},{x6},{y6},{x7},{y7},{x8},{y8}" + command = f"/LARC,{xcentr},{ycentr},{xlrad},{angle1},{angle2}" return self.run(command, **kwargs) - def tlabel(self, xloc: str = "", yloc: str = "", text: str = "", **kwargs): - r"""Creates annotation text (GUI). + def lspec( + self, lcolor: str = "", linstl: int | str = "", xlnwid: str = "", **kwargs + ): + r"""Specifies annotation line attributes (GUI). - Mechanical APDL Command: `/TLABEL `_ + Mechanical APDL Command: `/LSPEC `_ Parameters ---------- - xloc : str - Text ``X`` starting location (-1.0 < ``X`` < 1.6). + lcolor : str - yloc : str - Text Y starting location (-1.0 < ``Y`` < 1.0). + linstl : int or str + Line style: - text : str - Text string (60 characters maximum). Parameter substitution may be forced within the text by - enclosing the parameter name or parametric expression within percent (%) signs. + * ``0`` - Solid line. + + * ``1`` - Dashed line. + + xlnwid : str + Line width multiplier (1.0 to 20.0). Defaults to 1.0. Notes ----- - .. _s-TLABEL_notes: - - Defines annotation text to be written directly onto the display at a specified location. This - command is generated by the Graphical User Interface (GUI) and appears in the log file ( - :file:`Jobname.LOG` ) if annotation is used. + .. _s-LSPEC_notes: - The command is not intended to be typed in directly in a Mechanical APDL session (although it can be - included in an input file for batch input or for use with :ref:`input` ). + This command specifies annotation line attributes to control certain characteristics of the lines + created via the :ref:`slashline`, :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, + :ref:`pcircle`, and :ref:`pwedge` commands. - All text is shown on subsequent displays unless the annotation is disabled or deleted. Issue - :ref:`tspec` to set the attributes of the text. + The command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. It is not intended to be typed in directly in a + Mechanical APDL session (although it can be included in an input file for batch input or for use + with the + :ref:`input` command). This command is valid in any processor. """ - command = f"/TLABEL,{xloc},{yloc},{text}" + command = f"/LSPEC,{lcolor},{linstl},{xlnwid}" return self.run(command, **kwargs) def tspec( @@ -583,7 +546,7 @@ def tspec( Parameters ---------- tcolor : int or str - Text color (0 :math:`` ``TCOLOR`` :math:`` 15): + Text color (0 :math:```` ``TCOLOR`` :math:```` 15): * ``0`` - Black. @@ -654,68 +617,92 @@ def tspec( command = f"/TSPEC,{tcolor},{tsize},{txthic},{pangle},{iangle}" return self.run(command, **kwargs) - def anum( - self, - num: str = "", - type_: int | str = "", - xhot: str = "", - yhot: str = "", - **kwargs, - ): - r"""Specifies the annotation number, type, and hot spot (GUI). + def tlabel(self, xloc: str = "", yloc: str = "", text: str = "", **kwargs): + r"""Creates annotation text (GUI). - Mechanical APDL Command: `/ANUM `_ + Mechanical APDL Command: `/TLABEL `_ - **Command default:** + Parameters + ---------- + xloc : str + Text ``X`` starting location (-1.0 < ``X`` < 1.6). - .. _s-ANUM_default: + yloc : str + Text Y starting location (-1.0 < ``Y`` < 1.0). - Number, type, and hot spot are automatically determined. + text : str + Text string (60 characters maximum). Parameter substitution may be forced within the text by + enclosing the parameter name or parametric expression within percent (%) signs. + + Notes + ----- + + .. _s-TLABEL_notes: + + Defines annotation text to be written directly onto the display at a specified location. This + command is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if annotation is used. + + The command is not intended to be typed in directly in a Mechanical APDL session (although it can be + included in an input file for batch input or for use with :ref:`input` ). + + All text is shown on subsequent displays unless the annotation is disabled or deleted. Issue + :ref:`tspec` to set the attributes of the text. + + This command is valid in any processor. + """ + command = f"/TLABEL,{xloc},{yloc},{text}" + return self.run(command, **kwargs) + + def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): + r"""Activates graphics for annotating displays (GUI). + + Mechanical APDL Command: `/ANNOT `_ Parameters ---------- - num : str - Annotation number. Mechanical APDL automatically assigns the lowest available number. You cannot - assign a higher number if a lower number is available; the program substitutes the lowest - available number in place of any user-specified higher number. - - type_ : int or str - Annotation internal type number. If ``TYPE`` = DELE, delete annotation ``NUM``. + lab : str + Annotation control key: - * ``1`` - Text + * ``OFF`` - Turns off annotation for each subsequent display (default). - * ``2`` - Block text (not available in GUI) + * ``ON`` - Turns on annotation for each subsequent display. - * ``3`` - Dimensions + * ``DELE`` - Deletes all annotation. - * ``4`` - Lines + * ``SAVE`` - Saves annotation on a file. Use ``VAL1`` for file name (defaults to :file:`Jobname` ) + and ``VAL2`` for the extension (defaults to ANO). - * ``5`` - Rectangles + * ``SCALE`` - Sets annotation scale factor (direct input only). Use ``VAL1`` for value (0.1 to 10.0) + (defaults to 1.0). - * ``6`` - Circles + * ``XORIG`` - Sets the annotation x origin (direct input only). Use ``VAL1`` for value (-3.0 to + 3.0). - * ``7`` - Polygons + * ``YORIG`` - Sets annotation y origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). - * ``8`` - Arcs + * ``SNAP`` - Sets annotation snap (menu button input only). Use ``VAL1`` for value (0.002 to 0.2) + (defaults to 0.002). - * ``9`` - Wedges, pies + * ``STAT`` - Displays current annotation status. - * ``11`` - Symbols + * ``DEFA`` - Sets annotation specifications to the default values. - * ``12`` - Arrows + * ``REFR`` - Redisplays annotation graphics. - * ``13`` - Bitmap + * ``TMOD`` - Sets the annotation text mode. If ``VAL1`` = 1, annotation text will be drawn in + scalable bitmap fonts (default). If ``VAL1`` = 0, annotation text will be drawn with stroke text. - xhot : str - X hot spot (-1.0 < X < 2.0). Used for menu button item delete. + val1 : str + Value (or file name) as noted with label above. - yhot : str - Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. + val2 : str + Value (or file name extension) as noted with label above. Notes ----- - .. _s-ANUM_notes: + .. _s-ANNOT_notes: This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation is used. This command is not intended to be typed in directly in a Mechanical APDL @@ -723,12 +710,21 @@ def anum( (although it can be included in an input file for batch input or for use with the :ref:`input` command). - Type 13 (bitmap) annotation applies user defined bitmaps defined using the FILE option of the - :ref:`txtre` command. + You cannot use the "!" and "$" characters in Mechanical APDL text annotation. + + :ref:`annot` activates annotation graphics for adding annotation to displays. Commands representing + the annotation instructions are automatically created by the annotation functions in the GUI and + written to :file:`JobnameLOG`. + + The annotation commands are :ref:`annot`, :ref:`anum`, :ref:`tlabel`, :ref:`slashline`, + :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, :ref:`pwedge`, + :ref:`tspec`, :ref:`lspec`, and :ref:`slashpspec`. Annotation graphics are relative to the full + Graphics Window and are not affected by Mechanical APDL window-specific commands ( :ref:`window`, + :ref:`view`, etc.). This command is valid in any processor. """ - command = f"/ANUM,{num},{type_},{xhot},{yhot}" + command = f"/ANNOT,{lab},{val1},{val2}" return self.run(command, **kwargs) def an3d(self, **kwargs): @@ -775,55 +771,68 @@ def an3d(self, **kwargs): command = "/AN3D" return self.run(command, **kwargs) - def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): - r"""Activates graphics for annotating displays (GUI). + def anum( + self, + num: str = "", + type_: int | str = "", + xhot: str = "", + yhot: str = "", + **kwargs, + ): + r"""Specifies the annotation number, type, and hot spot (GUI). - Mechanical APDL Command: `/ANNOT `_ + Mechanical APDL Command: `/ANUM `_ + + **Command default:** + + .. _s-ANUM_default: + + Number, type, and hot spot are automatically determined. Parameters ---------- - lab : str - Annotation control key: + num : str + Annotation number. Mechanical APDL automatically assigns the lowest available number. You cannot + assign a higher number if a lower number is available; the program substitutes the lowest + available number in place of any user-specified higher number. - * ``OFF`` - Turns off annotation for each subsequent display (default). + type_ : int or str + Annotation internal type number. If ``TYPE`` = DELE, delete annotation ``NUM``. - * ``ON`` - Turns on annotation for each subsequent display. + * ``1`` - Text - * ``DELE`` - Deletes all annotation. + * ``2`` - Block text (not available in GUI) - * ``SAVE`` - Saves annotation on a file. Use ``VAL1`` for file name (defaults to :file:`Jobname` ) - and ``VAL2`` for the extension (defaults to ANO). + * ``3`` - Dimensions - * ``SCALE`` - Sets annotation scale factor (direct input only). Use ``VAL1`` for value (0.1 to 10.0) - (defaults to 1.0). + * ``4`` - Lines - * ``XORIG`` - Sets the annotation x origin (direct input only). Use ``VAL1`` for value (-3.0 to - 3.0). + * ``5`` - Rectangles - * ``YORIG`` - Sets annotation y origin (direct input only). Use ``VAL1`` for value (-3.0 to 3.0). + * ``6`` - Circles - * ``SNAP`` - Sets annotation snap (menu button input only). Use ``VAL1`` for value (0.002 to 0.2) - (defaults to 0.002). + * ``7`` - Polygons - * ``STAT`` - Displays current annotation status. + * ``8`` - Arcs - * ``DEFA`` - Sets annotation specifications to the default values. + * ``9`` - Wedges, pies - * ``REFR`` - Redisplays annotation graphics. + * ``11`` - Symbols - * ``TMOD`` - Sets the annotation text mode. If ``VAL1`` = 1, annotation text will be drawn in - scalable bitmap fonts (default). If ``VAL1`` = 0, annotation text will be drawn with stroke text. + * ``12`` - Arrows - val1 : str - Value (or file name) as noted with label above. + * ``13`` - Bitmap - val2 : str - Value (or file name extension) as noted with label above. + xhot : str + X hot spot (-1.0 < X < 2.0). Used for menu button item delete. + + yhot : str + Y hot spot (-1.0 < Y < 1.0). Used for menu button item delete. Notes ----- - .. _s-ANNOT_notes: + .. _s-ANUM_notes: This is a command generated by the GUI and will appear in the log file ( :file:`Jobname.LOG` ) if annotation is used. This command is not intended to be typed in directly in a Mechanical APDL @@ -831,19 +840,10 @@ def annot(self, lab: str = "", val1: str = "", val2: str = "", **kwargs): (although it can be included in an input file for batch input or for use with the :ref:`input` command). - You cannot use the "!" and "$" characters in Mechanical APDL text annotation. - - :ref:`annot` activates annotation graphics for adding annotation to displays. Commands representing - the annotation instructions are automatically created by the annotation functions in the GUI and - written to :file:`Jobname.LOG`. - - The annotation commands are :ref:`annot`, :ref:`anum`, :ref:`tlabel`, :ref:`slashline`, - :ref:`slashlarc`, :ref:`lsymbol`, :ref:`polygon`, :ref:`pmore`, :ref:`pcircle`, :ref:`pwedge`, - :ref:`tspec`, :ref:`lspec`, and :ref:`slashpspec`. Annotation graphics are relative to the full - Graphics Window and are not affected by Mechanical APDL window-specific commands ( :ref:`window`, - :ref:`view`, etc.). + Type 13 (bitmap) annotation applies user defined bitmaps defined using the FILE option of the + :ref:`txtre` command. This command is valid in any processor. """ - command = f"/ANNOT,{lab},{val1},{val2}" + command = f"/ANUM,{num},{type_},{xhot},{yhot}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/graphs.py b/src/ansys/mapdl/core/_commands/graphics/graphs.py index d97fac9ab6f..cfc6d934711 100644 --- a/src/ansys/mapdl/core/_commands/graphics/graphs.py +++ b/src/ansys/mapdl/core/_commands/graphics/graphs.py @@ -23,179 +23,6 @@ class Graphs: - def xrange(self, xmin: str = "", xmax: str = "", **kwargs): - r"""Specifies a linear abscissa (X) scale range. - - Mechanical APDL Command: `/XRANGE `_ - - Parameters - ---------- - xmin : str - Minimum abscissa scale value. - - xmax : str - Maximum abscissa scale value. - - Notes - ----- - - .. _s-XRANGE_notes: - - Specifies a linear abscissa (X) scale range for the line graph display. Use :ref:`xrange`,DEFAULT to - return to automatic scaling. - - Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, - LOGX). - - This command is valid in any processor. - """ - command = f"/XRANGE,{xmin},{xmax}" - return self.run(command, **kwargs) - - def yrange(self, ymin: str = "", ymax: str = "", num: str = "", **kwargs): - r"""Specifies a linear ordinate (Y) scale range. - - Mechanical APDL Command: `/YRANGE `_ - - Parameters - ---------- - ymin : str - Minimum ordinate scale value. - - ymax : str - Maximum ordinate scale value. - - num : str - Y-axis number to which range applies (defaults to 1). Valid numbers are 1 to 3 for - :ref:`grtyp`,2 and 1 to 6 for :ref:`grtyp`,3. If ALL, apply to all Y-axes. - - Notes - ----- - - .. _s-YRANGE_notes: - - Specifies a linear ordinate (Y) scale range for the line graph display. Use :ref:`yrange`,DEFAULT to - return to automatic scaling. For multiple Y-axes graphs ( :ref:`grtyp` ), see :ref:`gropt`, ASCAL to - automatically scale the additional Y-axes. - - Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, - LOGY). - - This command is valid in any processor. - """ - command = f"/YRANGE,{ymin},{ymax},{num}" - return self.run(command, **kwargs) - - def axlab(self, axis: str = "", lab: str = "", **kwargs): - r"""Labels the X and Y axes on graph displays. - - Mechanical APDL Command: `/AXLAB `_ - - **Command default:** - - .. _s-AXLAB_default: - - Labels are determined by the program. - - Parameters - ---------- - axis : str - Axis specifier: - - * ``X`` - Apply label to X axis. - - * ``Y`` - Apply label to Y axis. - - lab : str - Axis label (user defined text up to 30 characters long). Leave blank to reestablish the default - for ``Axis`` axis. - - Notes - ----- - - .. _s-AXLAB_notes: - - This command is valid in any processor. - """ - command = f"/AXLAB,{axis},{lab}" - return self.run(command, **kwargs) - - def grtyp(self, kaxis: int | str = "", **kwargs): - r"""Selects single or multiple Y-axes graph displays. - - Mechanical APDL Command: `/GRTYP `_ - - Parameters - ---------- - kaxis : int or str - Axis selection key: - - * ``0 or 1`` - Single Y-axis. Up to 10 curves scaled to a single Y-axis. - - * ``2`` - Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves - with widely differing numbering ranges. - - * ``3`` - Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves - maximum). Allows clearer display with an isometric view. The default view when ``KAXIS`` = 3 is - View,1,1,2,3. - - Notes - ----- - - .. _s-GRTYP_notes: - - The basic line graph has one or more curves plotted against the same Y and X axes. Multiple curve - graphs can also be plotted with individual Y axes and the same X axis. The Y axis of the first curve - is referred to as the base Y-axis and the Y axes of the other curves as additional Y axes. Curves - are numbered sequentially from 1 (the base curve) in the order in which they are displayed. See the - :ref:`axlab`, :ref:`gropt`, :ref:`grid`, and :ref:`gthk` commands for other display options. - - This command is valid in any processor. - """ - command = f"/GRTYP,{kaxis}" - return self.run(command, **kwargs) - - def gthk(self, label: str = "", thick: int | str = "", **kwargs): - r"""Sets line thicknesses for graph lines. - - Mechanical APDL Command: `/GTHK `_ - - Parameters - ---------- - label : str - Apply thicknesses as selected from the following labels: - - * ``AXIS`` - Modify thickness of ordinate and abscissa axes on graph displays. - - * ``GRID`` - Modify thickness of grid lines on graph displays. - - * ``CURVE`` - Modify thickness of curve lines (when no area fill ( :ref:`gropt` )). - - thick : int or str - Thickness ratio (whole numbers only, from -1 to 10): - - * ``-1`` - Do not draw the curve, but show only the markers specified by :ref:`gmarker`. - - * ``0 or 1`` - Thin lines. - - * ``2`` - The default thickness. - - * ``3`` - 1.5 times the default thickness. - - * ``etc.`` - (up to 10) - - Notes - ----- - - .. _s-GTHK_notes: - - Sets line thicknesses for graph lines (in raster mode only). Use :ref:`gthk`,STAT to show settings. - - This command is valid in any processor. - """ - command = f"/GTHK,{label},{thick}" - return self.run(command, **kwargs) - def gropt(self, lab: str = "", key: str = "", **kwargs): r"""Sets various line graph display options. @@ -307,6 +134,82 @@ def gropt(self, lab: str = "", key: str = "", **kwargs): command = f"/GROPT,{lab},{key}" return self.run(command, **kwargs) + def gthk(self, label: str = "", thick: int | str = "", **kwargs): + r"""Sets line thicknesses for graph lines. + + Mechanical APDL Command: `/GTHK `_ + + Parameters + ---------- + label : str + Apply thicknesses as selected from the following labels: + + * ``AXIS`` - Modify thickness of ordinate and abscissa axes on graph displays. + + * ``GRID`` - Modify thickness of grid lines on graph displays. + + * ``CURVE`` - Modify thickness of curve lines (when no area fill ( :ref:`gropt` )). + + thick : int or str + Thickness ratio (whole numbers only, from -1 to 10): + + * ``-1`` - Do not draw the curve, but show only the markers specified by :ref:`gmarker`. + + * ``0 or 1`` - Thin lines. + + * ``2`` - The default thickness. + + * ``3`` - 1.5 times the default thickness. + + * ``etc.`` - (up to 10) + + Notes + ----- + + .. _s-GTHK_notes: + + Sets line thicknesses for graph lines (in raster mode only). Use :ref:`gthk`,STAT to show settings. + + This command is valid in any processor. + """ + command = f"/GTHK,{label},{thick}" + return self.run(command, **kwargs) + + def grtyp(self, kaxis: int | str = "", **kwargs): + r"""Selects single or multiple Y-axes graph displays. + + Mechanical APDL Command: `/GRTYP `_ + + Parameters + ---------- + kaxis : int or str + Axis selection key: + + * ``0 or 1`` - Single Y-axis. Up to 10 curves scaled to a single Y-axis. + + * ``2`` - Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves + with widely differing numbering ranges. + + * ``3`` - Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves + maximum). Allows clearer display with an isometric view. The default view when ``KAXIS`` = 3 is + View,1,1,2,3. + + Notes + ----- + + .. _s-GRTYP_notes: + + The basic line graph has one or more curves plotted against the same Y and X axes. Multiple curve + graphs can also be plotted with individual Y axes and the same X axis. The Y axis of the first curve + is referred to as the base Y-axis and the Y axes of the other curves as additional Y axes. Curves + are numbered sequentially from 1 (the base curve) in the order in which they are displayed. See the + :ref:`axlab`, :ref:`gropt`, :ref:`grid`, and :ref:`gthk` commands for other display options. + + This command is valid in any processor. + """ + command = f"/GRTYP,{kaxis}" + return self.run(command, **kwargs) + def grid(self, key: str = "", **kwargs): r"""Selects the type of grid on graph displays. @@ -339,3 +242,100 @@ def grid(self, key: str = "", **kwargs): """ command = f"/GRID,{key}" return self.run(command, **kwargs) + + def yrange(self, ymin: str = "", ymax: str = "", num: str = "", **kwargs): + r"""Specifies a linear ordinate (Y) scale range. + + Mechanical APDL Command: `/YRANGE `_ + + Parameters + ---------- + ymin : str + Minimum ordinate scale value. + + ymax : str + Maximum ordinate scale value. + + num : str + Y-axis number to which range applies (defaults to 1). Valid numbers are 1 to 3 for + :ref:`grtyp`,2 and 1 to 6 for :ref:`grtyp`,3. If ALL, apply to all Y-axes. + + Notes + ----- + + .. _s-YRANGE_notes: + + Specifies a linear ordinate (Y) scale range for the line graph display. Use :ref:`yrange`,DEFAULT to + return to automatic scaling. For multiple Y-axes graphs ( :ref:`grtyp` ), see :ref:`gropt`, ASCAL to + automatically scale the additional Y-axes. + + Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, + LOGY). + + This command is valid in any processor. + """ + command = f"/YRANGE,{ymin},{ymax},{num}" + return self.run(command, **kwargs) + + def xrange(self, xmin: str = "", xmax: str = "", **kwargs): + r"""Specifies a linear abscissa (X) scale range. + + Mechanical APDL Command: `/XRANGE `_ + + Parameters + ---------- + xmin : str + Minimum abscissa scale value. + + xmax : str + Maximum abscissa scale value. + + Notes + ----- + + .. _s-XRANGE_notes: + + Specifies a linear abscissa (X) scale range for the line graph display. Use :ref:`xrange`,DEFAULT to + return to automatic scaling. + + Automatic scaling will often yield inappropriate range values for logarithmic scales ( :ref:`gropt`, + LOGX). + + This command is valid in any processor. + """ + command = f"/XRANGE,{xmin},{xmax}" + return self.run(command, **kwargs) + + def axlab(self, axis: str = "", lab: str = "", **kwargs): + r"""Labels the X and Y axes on graph displays. + + Mechanical APDL Command: `/AXLAB `_ + + **Command default:** + + .. _s-AXLAB_default: + + Labels are determined by the program. + + Parameters + ---------- + axis : str + Axis specifier: + + * ``X`` - Apply label to X axis. + + * ``Y`` - Apply label to Y axis. + + lab : str + Axis label (user defined text up to 30 characters long). Leave blank to reestablish the default + for ``Axis`` axis. + + Notes + ----- + + .. _s-AXLAB_notes: + + This command is valid in any processor. + """ + command = f"/AXLAB,{axis},{lab}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py index 2bc7fdf0650..94b07f2d6c2 100644 --- a/src/ansys/mapdl/core/_commands/graphics/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -23,107 +23,101 @@ class Labeling: - def psymb(self, label: str = "", key: int | str = "", **kwargs): - r"""Shows various symbols on displays. + def plopts(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls graphics options on subsequent displays. - Mechanical APDL Command: `/PSYMB `_ + Mechanical APDL Command: `/PLOPTS `_ + + **Command default:** + + .. _s-PLOPTS_default: + + See individual label defaults. + + The Multi-legend mode ( :ref:`plopts`,INFO,3) is the default for contour legend displays. Parameters ---------- label : str - Show symbols as selected from the following labels: + Apply display items as selected from the following labels: - * ``CS`` - Local coordinate systems. + * ``INFO`` - Controls the display of the legend (ON or OFF) and allows the choice of preset or + Multi-legend placement. Control is provided by the ``KEY`` values. (Defaults to ``KEY`` =3 when the + GUI is on. Defaults to ``KEY`` = 2 otherwise.) - * ``NDIR`` - Nodal coordinate systems (on rotated nodes only). + * ``LEG1`` - Header portion of legend column (defaults to ON). - * ``ESYS`` - Element coordinate systems (element displays only). + * ``LEG2`` - View portion of legend column (defaults to ON (except off with contour displays)). - * ``LDIR`` - Line directions (line displays only). + * ``LEG3`` - View the contour section of the legend column (defaults to ON). - * ``LDIV`` - Controls the display of element divisions on lines. + * ``FRAME`` - Frame border lines around windows (defaults to ON). - * ``ADIR`` - Area direction symbol (for keypoint, line, area and volume plots). + * ``TITLE`` - Title (bottom left text) (defaults to ON). - * ``LAYR`` - Layer orientations (relative to the projected element x-axis) or fiber orientations in - smeared reinforcing elements. Used only within an element display. Use ``KEY`` to specify the layer - number. + * ``MINM`` - Min-Max symbols on contour displays (defaults to ON). - * ``ECON`` - Element mesh symbols on keypoints and lines. + * ``LOGO`` - Ansys logo (defaults to OFF (displayed as text at top of legend column)). If + ``KEY`` = ON, the text is removed from legend column but the logo symbol is displayed in whichever + active window is either in the uppermost right corner and on top, or if there is no window in that + location, then in the window to the furthest right of the screen. Version information remains in the + legend column. - * ``DOT`` - Larger symbols displayed for node and keypoint locations. When ``Label`` = DOT, ``KEY`` - = 1 by default. + * ``WINS`` - Controls whether graphics windows automatically stretch or shrink to adjust to screen + size as the legend column is turned off or on ( :ref:`plopts`,INFO) (defaults to ON). If WINS is on + and the legend column is changed from off to on, all windows are shrunk regardless of what their + correct size is. - * ``XNOD`` - Extra node of surface or circuit elements. + * ``WP`` - Working plane (defaults to OFF). The working plane is drawn as part of the display ( not + just an overlaid image as in :ref:`wpstyl` ). This option is best used in combination with a hidden- + line technique ( :ref:`slashtype` ). - * ``FBCS`` - Force boundary condition scaling. Subsequent ``KEY`` value determines whether or not to - scale the applied and derived forces/moments to the same maximum value. + * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the display as follows: - * ``DEFA`` - Resets the symbol keys so that Mechanical APDL displays none of the symbols controlled by the - :ref:`psymb` command. The value of the ``KEY`` field is ignored. + * 0 – No date or time displays are included in your legend. + * 1 – Only the date is shown. + * 2 – Both the date and time are shown (default). - * ``STAT`` - Prints the status of the settings of the symbol keys controlled by the :ref:`psymb` - command. The ``KEY`` field is ignored. + * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the display as follows: - * ``MARK`` - Controls the marker size ( :ref:`gmarker` ). When ``Label`` = MARK, ``KEY`` = 10 by - default. + * 0 – The Mechanical APDL jobname is not included in your legend (default). + * 1 – The Mechanical APDL jobname is included in your legend. key : int or str - Symbol key: - - * ``-1`` - Effective only if ``Label`` = LAYR and solid shape element display ( :ref:`eshape` ) is - active. Orientation of all layers appears with the solid shape element display. + Switch: - * ``0`` - No symbol (default). If ``Label`` = LDIV, then ``KEY`` = 0 indicates that the displayed - element divisions will correspond to the existing mesh (the word MESHED or EXISTING can also be - substituted). Also, for ``Label`` = LDIV, if you execute any meshing command (such as :ref:`amesh` - or :ref:`vmesh` ), ``KEY`` is set to 0 (MESHED) automatically. If ``Label`` = FBCS, then ``KEY`` = 0 - indicates that boundary condition scaling will not be common. The applied and derived forces/moments - will be scaled to their respective maximum values. + * ``OFF or 0`` - Do not apply this display item. For ``Label`` = DATE, no time or date are + displayed. - * ``1`` - Include symbol. If ``Label`` = LDIV, then ``KEY`` = 1 indicates that the displayed line - divisions will correspond to the value assigned by :ref:`lesize` (the word LESIZE can also be - substituted). Also, for ``Label`` = LDIV, if you execute the :ref:`lesize` command, ``KEY`` is set - to 1 (LESIZE) automatically. If ``Label`` = FBCS, then ``KEY`` = 1 indicates that boundary condition - scaling will be common. The applied and derived forces/moments will be scaled to the same maximum - value. + * ``ON or 1`` - Apply this display item. For ``Label`` = DATE, show only the date. - * ``N`` - If ``Label`` = LAYR, then ``N`` is equal to the layer number. If ``Label`` = DOT, then - ``N`` can be equal to 0,1,.....15, indicating the dot size. If ``Label`` = MARK, then ``N`` can be - equal to 1,.....10, indicating the marker size. If + * ``AUTO or 2`` - For ``Label`` = INFO, initiate Auto-legend mode. If the display has contours, the + legend is ON; if the display has no contours, the legend is OFF. For ``Label`` = DATE, display both + the date and time. - ``Label`` = LDIV, then ``KEY`` = -1, indicates that no element divisions will be displayed (the - word OFF can also be substituted). + * ``3`` - For ``Label`` = INFO, switch to Multi-legend mode. See the :ref:`udoc` command for the + available legend configurations. Notes ----- - .. _s-PSYMB_notes: - - Includes various symbols on the display. Triads are right-handed with x displayed as the longest - leg. Where color is displayed, x is white, y is green, and z is blue. For beams, x is always along - the length of the element. For lines, an arrow represents the direction of a line, from the - beginning keypoint to the end keypoint. See :ref:`plopts` command for additional display options. - Use :ref:`pstatus` or :ref:`psymb`,STAT to display settings. Use :ref:`psymb`,DEFA to reset all - specifications back to their defaults. The command :ref:`psymb`,ECON,1 causes the symbol "M" to be - displayed on keypoints and lines associated with meshed entities. When you issue the command - :ref:`psymb`,DOT,1, a larger symbol is displayed for each node and keypoint location. Using - :ref:`psymb`,MARK,1, a smaller marker size can be displayed. + .. _s-PLOPTS_notes: - PowerGraphics ( :ref:`graphics`,POWER) does not support :ref:`psymb`,ESYS and :ref:`psymb`,LAYR. + Use :ref:`plopts`,STAT to display settings. Use :ref:`plopts`,DEFA to reset all specifications back + to their defaults. - If ``KEY`` = ``N`` and PowerGraphics is off, the centroid of the surface elements is connected to - the extra node using a gray line. However, if PowerGraphics is on, the color of the line connecting - the centroid to the extra node is the same as that for the elements themselves (as determined by - :ref:`pnum` ). + When you perform multiple results displays, contours on the legend column may be truncated. To avoid + this, specify :ref:`plopts`,LEG1,0. - When ``Label`` = LAYR, the layer systems can be visualized with all current-technology layered - elements and the smeared reinforcing element REINF265. To use :ref:`psymb`,LAYR with REINF265, first - set the vector-mode graphics option ( :ref:`device`,VECTOR,1). + The Multi-legend mode provides a number of legend data item priority and placement options. These + options are accessed via the GUI at Utility Menu> PlotCtrls> Window Controls> Window Options. The + :ref:`udoc` command provides command line o ptions for this capability. This command is valid in any processor. + + This command is not available for Academic Research or Teaching level products """ - command = f"/PSYMB,{label},{key}" + command = f"/PLOPTS,{label},{key}" return self.run(command, **kwargs) def pbf(self, item: str = "", key: int | str = "", **kwargs): @@ -194,94 +188,6 @@ def pbf(self, item: str = "", key: int | str = "", **kwargs): command = f"/PBF,{item},,{key}" return self.run(command, **kwargs) - def pnum(self, label: str = "", key: int | str = "", **kwargs): - r"""Controls entity numbering/coloring on plots. - - Mechanical APDL Command: `/PNUM `_ - - Parameters - ---------- - label : str - Type of numbering/coloring: - - * ``NODE`` - Node numbers on node and element plots. - - * ``ELEM`` - Element numbers and colors on element plots. - - * ``SEC`` - Section numbers and colors on element and solid model plots (see :ref:`s-PNUM.notes`). - - * ``MAT`` - Material set numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). - - * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). - - * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). - - * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see - :ref:`s-PNUM.notes`). - - * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. - - LOC and ELEM numbers will be the same unless the model has been reordered. - - * ``KP`` - Keypoint numbers on solid model plots. - - * ``LINE`` - Line numbers on solid model plots (both numbers and colors on line plots). - - * ``AREA`` - Area numbers on solid model plots (both numbers and colors on area plots). - - * ``VOLU`` - Volume numbers on solid model plots (both numbers and colors on volume plots). - - * ``SVAL`` - Stress (or any contour) values on postprocessing plots, and surface load values and - colors on model plots when surface load symbols are on ( :ref:`psf` ). For tabular boundary - conditions, the table- evaluated values will be displayed on node, element, or contour displays in - POST1 when load symbols ( :ref:`pbf`, :ref:`psf`, :ref:`pbc` ) are on and TABNAM is OFF. - - * ``TABNAM`` - Table names for tabular boundary conditions. If this label is turned on, the table - name appears next to the appropriate symbol, arrow, face outline, or contour as dictated by the - :ref:`psf`, :ref:`pbc`, and :ref:`pbf` commands. - - * ``STAT`` - Shows current settings for :ref:`pnum`. - - * ``DEFA`` - Resets all :ref:`pnum` specifications back to default. - - key : int or str - Switch: - - * ``0`` - Turns OFF numbers/colors for specified label. - - * ``1`` - Turns ON numbers/colors for specified label. - - Notes - ----- - - .. _s-PNUM_notes: - - This command specifies entity numbering and coloring for subsequent plots. - - The MAT, TYPE, REAL, and ESYS labels activate both the numbering and coloring of the corresponding - attributes for :ref:`eplot`, :ref:`kplot`, :ref:`lplot`, :ref:`aplot`, and :ref:`vplot`. The ELEM, - MAT, TYPE, REAL, ESYS, and LOC labels are mutually exclusive, that is, only one can be specified at - a time. Also, turning on a LINE, AREA, or VOLU label will turn off the MAT, TYPE, and REAL labels. - - PowerGraphics ( :ref:`graphics`,POWER) displays for :ref:`pnum` can be problematic. :ref:`pnum`,ELEM - will display erratically depending on other display command specifications, while :ref:`pnum`,LOC - and :ref:`pnum`,ESYS are not supported. - - Element and volume numbers are not visible for 3D elements and volumes when Z-buffering is turned on - ( :ref:`slashtype`,,[6,7, or 8]). - - Use :ref:`pstatus` or :ref:`pnum`,STAT to show settings. Use :ref:`pnum`,DEFA to reset all - specifications back to default. Use the :ref:`number` command to control whether numbers and colors - are displayed together. - - This command is valid in any processor - """ - command = f"/PNUM,{label},{key}" - return self.run(command, **kwargs) - def pbc( self, item: str = "", @@ -310,7 +216,7 @@ def pbc( * ``ROT`` - Applied rotational constraints (ROTX, ROTY, ROTZ). - * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3,..., TTOP). + * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3...., TTOP). * ``PRES`` - Applied fluid pressures. @@ -330,7 +236,7 @@ def pbc( * ``M or MOME`` - Applied structural moments (MX, MY, MZ). - * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3,..., HTOP). + * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3...., HTOP). * ``FLOW`` - Applied fluid flow. @@ -428,145 +334,48 @@ def pbc( command = f"/PBC,{item},,{key},{min_},{max_},{abs_}" return self.run(command, **kwargs) - def plopts(self, label: str = "", key: int | str = "", **kwargs): - r"""Controls graphics options on subsequent displays. + def psf( + self, + item: str = "", + comp: str = "", + key: int | str = "", + kshell: int | str = "", + color: str = "", + **kwargs, + ): + r"""Shows surface load symbols on model displays. - Mechanical APDL Command: `/PLOPTS `_ + Mechanical APDL Command: `/PSF `_ **Command default:** - .. _s-PLOPTS_default: - - See individual label defaults. + .. _s-PSF_default: - The Multi-legend mode ( :ref:`plopts`,INFO,3) is the default for contour legend displays. + No surface load symbols are displayed. Parameters ---------- - label : str - Apply display items as selected from the following labels: + item : str + Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. - * ``INFO`` - Controls the display of the legend (ON or OFF) and allows the choice of preset or - Multi-legend placement. Control is provided by the ``KEY`` values. (Defaults to ``KEY`` =3 when the - GUI is on. Defaults to ``KEY`` = 2 otherwise.) + comp : str + Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. - * ``LEG1`` - Header portion of legend column (defaults to ON). + key : int or str + Key to turn surface load symbols on or off: - * ``LEG2`` - View portion of legend column (defaults to ON (except off with contour displays)). + * ``0`` - Off (default). - * ``LEG3`` - View the contour section of the legend column (defaults to ON). + * ``1`` - On, shown as face outlines. Line surface loads ( :ref:`sfl` ) on solid model plots are + shown as arrows. - * ``FRAME`` - Frame border lines around windows (defaults to ON). + * ``2`` - On, shown as arrows. - * ``TITLE`` - Title (bottom left text) (defaults to ON). + * ``3`` - On, shown as color filled surfaces. Line and area surface loads ( :ref:`sfl` and + :ref:`sfa` ) on solid model plots are shown as arrows. - * ``MINM`` - Min-Max symbols on contour displays (defaults to ON). - - * ``LOGO`` - Ansys logo (defaults to OFF (displayed as text at top of legend column)). If - ``KEY`` = ON, the text is removed from legend column but the logo symbol is displayed in whichever - active window is either in the uppermost right corner and on top, or if there is no window in that - location, then in the window to the furthest right of the screen. Version information remains in the - legend column. - - * ``WINS`` - Controls whether graphics windows automatically stretch or shrink to adjust to screen - size as the legend column is turned off or on ( :ref:`plopts`,INFO) (defaults to ON). If WINS is on - and the legend column is changed from off to on, all windows are shrunk regardless of what their - correct size is. - - * ``WP`` - Working plane (defaults to OFF). The working plane is drawn as part of the display ( not - just an overlaid image as in :ref:`wpstyl` ). This option is best used in combination with a hidden- - line technique ( :ref:`slashtype` ). - - * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the display as follows: - - * 0 – No date or time displays are included in your legend. - * 1 – Only the date is shown. - * 2 – Both the date and time are shown (default). - - * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the display as follows: - - * 0 – The Mechanical APDL jobname is not included in your legend (default). - * 1 – The Mechanical APDL jobname is included in your legend. - - key : int or str - Switch: - - * ``OFF or 0`` - Do not apply this display item. For ``Label`` = DATE, no time or date are - displayed. - - * ``ON or 1`` - Apply this display item. For ``Label`` = DATE, show only the date. - - * ``AUTO or 2`` - For ``Label`` = INFO, initiate Auto-legend mode. If the display has contours, the - legend is ON; if the display has no contours, the legend is OFF. For ``Label`` = DATE, display both - the date and time. - - * ``3`` - For ``Label`` = INFO, switch to Multi-legend mode. See the :ref:`udoc` command for the - available legend configurations. - - Notes - ----- - - .. _s-PLOPTS_notes: - - Use :ref:`plopts`,STAT to display settings. Use :ref:`plopts`,DEFA to reset all specifications back - to their defaults. - - When you perform multiple results displays, contours on the legend column may be truncated. To avoid - this, specify :ref:`plopts`,LEG1,0. - - The Multi-legend mode provides a number of legend data item priority and placement options. These - options are accessed via the GUI at Utility Menu> PlotCtrls> Window Controls> Window Options. The - :ref:`udoc` command provides command line o ptions for this capability. - - This command is valid in any processor. - - This command is not available for Academic Research or Teaching level products - """ - command = f"/PLOPTS,{label},{key}" - return self.run(command, **kwargs) - - def psf( - self, - item: str = "", - comp: str = "", - key: int | str = "", - kshell: int | str = "", - color: str = "", - **kwargs, - ): - r"""Shows surface load symbols on model displays. - - Mechanical APDL Command: `/PSF `_ - - **Command default:** - - .. _s-PSF_default: - - No surface load symbols are displayed. - - Parameters - ---------- - item : str - Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. - - comp : str - Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. - - key : int or str - Key to turn surface load symbols on or off: - - * ``0`` - Off (default). - - * ``1`` - On, shown as face outlines. Line surface loads ( :ref:`sfl` ) on solid model plots are - shown as arrows. - - * ``2`` - On, shown as arrows. - - * ``3`` - On, shown as color filled surfaces. Line and area surface loads ( :ref:`sfl` and - :ref:`sfa` ) on solid model plots are shown as arrows. - - kshell : int or str - Visibility key for shell elements. + kshell : int or str + Visibility key for shell elements. * ``0`` - Off (default), surface load symbols are displayed only on visible load faces. @@ -618,10 +427,10 @@ def psf( contour legend. The length of these arrows does, however, correlate to the relative magnitude of the pressures. - For elements SURF159, SOLID272, SOLID273, PIPE288 and PIPE289, :ref:`psf` is not available when - displaying elements with shapes determined from the real constants or section definition ( - :ref:`eshape` ). For PIPE288 and PIPE289, only external loads applied via :ref:`sfbeam` are - displayed. + For elements ``SURF159``, ``SOLID272``, ``SOLID273``, ``PIPE288``and ``PIPE289``, :ref:`psf` is not + available when displaying elements with shapes determined from the real constants or section + definition ( :ref:`eshape` ). For ``PIPE288``and ``PIPE289``, only external loads applied via + :ref:`sfbeam` are displayed. This command is valid in any processor. @@ -639,10 +448,10 @@ def psf( * - :rspan:`14` PRES [ :ref:`psf.labels.fn.1`] - NORM (or blank) - Applied pressure normal to the face (real component only). - - For element types other than SURF153, SURF154 and SURF156. + - For element types other than ``SURF153``, ``SURF154``and ``SURF156``. * - NORM - Applied pressure normal to the face (real component). - - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ :ref:`psf.labels.fn.2`] + - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ :ref:`psf.labels.fn.2`] * - TANX - Applied pressure in the element tangential x direction (real component). * - TANY @@ -655,7 +464,7 @@ def psf( - Applied pressure in the element tangential y direction (imaginary component). * - LOCX - Applied pressure in the local x direction (real component). - - :rspan:`5` For element types SURF153, SURF154 and SURF156 with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ :ref:`psf.labels.fn.2`] + - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ :ref:`psf.labels.fn.2`] * - LOCY - Applied pressure in the local y direction (real component). * - LOCZ @@ -740,297 +549,193 @@ def psf( command = f"/PSF,{item},{comp},{key},{kshell},{color}" return self.run(command, **kwargs) - def triad(self, lab: str = "", **kwargs): - r"""Shows the global XYZ coordinate triad on displays. + def psymb(self, label: str = "", key: int | str = "", **kwargs): + r"""Shows various symbols on displays. - Mechanical APDL Command: `/TRIAD `_ + Mechanical APDL Command: `/PSYMB `_ Parameters ---------- - lab : str - Display triad as follows: - - * ``ORIG`` - Display triad at global origin (default). - - * ``OFF`` - Turn off triad display. - - * ``LBOT`` - Display triad in lower left screen corner. - - * ``RBOT`` - Display triad in lower right screen corner. + label : str + Show symbols as selected from the following labels: - * ``LTOP`` - Display triad in upper left screen corner. + * ``CS`` - Local coordinate systems. - * ``RTOP`` - Display triad in upper right screen corner. + * ``NDIR`` - Nodal coordinate systems (on rotated nodes only). - Notes - ----- + * ``ESYS`` - Element coordinate systems (element displays only). - .. _s-TRIAD_notes: + * ``LDIR`` - Line directions (line displays only). - For efficiency, Mechanical APDL maintains a single data structure (segment) which includes the triad - as a - 3D data object. + * ``LDIV`` - Controls the display of element divisions on lines. - If a 3D device is involved ( :ref:`show`,3D) and the graphics are not being displayed as multi- - plots, the triad location is determined by the view settings for window #1. + * ``ADIR`` - Area direction symbol (for keypoint, line, area and volume plots). - A request for triad display anywhere except for the origin may yield an improper display in windows - 2 through 5. + * ``LAYR`` - Layer orientations (relative to the projected element x-axis) or fiber orientations in + smeared reinforcing elements. Used only within an element display. Use ``KEY`` to specify the layer + number. - The program displays the same segment in all windows. The view settings of each window constitute - the only difference in the display in the active windows. + * ``ECON`` - Element mesh symbols on keypoints and lines. - This command is valid in any processor. - """ - command = f"/TRIAD,{lab}" - return self.run(command, **kwargs) + * ``DOT`` - Larger symbols displayed for node and keypoint locations. When ``Label`` = DOT, ``KEY`` + = 1 by default. - def contour( - self, - wn: str = "", - ncont: str = "", - vmin: str = "", - vinc: str = "", - vmax: str = "", - **kwargs, - ): - r"""Specifies the uniform contour values on stress displays. + * ``XNOD`` - Extra node of surface or circuit elements. - Mechanical APDL Command: `/CONTOUR `_ + * ``FBCS`` - Force boundary condition scaling. Subsequent ``KEY`` value determines whether or not to + scale the applied and derived forces/moments to the same maximum value. - **Command default:** + * ``DEFA`` - Resets the symbol keys so that Mechanical APDL displays none of the symbols controlled by the + :ref:`psymb` command. The value of the ``KEY`` field is ignored. - .. _s-CONTOUR_default: + * ``STAT`` - Prints the status of the settings of the symbol keys controlled by the :ref:`psymb` + command. The ``KEY`` field is ignored. - Nine contour values uniformly spaced between the extreme values, or no contours if the ratio of - range to minimum value (or range to maximum if minimum = 0) is less than 0.001. + * ``MARK`` - Controls the marker size ( :ref:`gmarker` ). When ``Label`` = MARK, ``KEY`` = 10 by + default. - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + key : int or str + Symbol key: - ncont : str - Number of contour values. ``NCONT`` defaults to 9 for X11 or WIN32 and to 128 for X11c or - WIN32C. The default graphics window display for 3D devices is a smooth continuous shading effect - that spans the maximum of 128 contours available. Use the :ref:`dv3d` command to create defined - banding for your contour values (values of 9 and 128 are displayed in smooth shading only). The - legend, however, will display only nine color boxes, which span the full range of colors - displayed in the graphics window. + * ``-1`` - Effective only if ``Label`` = LAYR and solid shape element display ( :ref:`eshape` ) is + active. Orientation of all layers appears with the solid shape element display. - vmin : str - Minimum contour value. If ``VMIN`` = AUTO, automatically calculate contour values based upon - ``NCONT`` uniformly spaced values over the min-max extreme range. Or, if ``VMIN`` = USER, set - contour values to those of the last display (useful when last display automatically calculated - contours). + * ``0`` - No symbol (default). If ``Label`` = LDIV, then ``KEY`` = 0 indicates that the displayed + element divisions will correspond to the existing mesh (the word MESHED or EXISTING can also be + substituted). Also, for ``Label`` = LDIV, if you execute any meshing command (such as :ref:`amesh` + or :ref:`vmesh` ), ``KEY`` is set to 0 (MESHED) automatically. If ``Label`` = FBCS, then ``KEY`` = 0 + indicates that boundary condition scaling will not be common. The applied and derived forces/moments + will be scaled to their respective maximum values. - vinc : str - Value increment (positive) between contour values. Defaults to ( ``VMAX`` - ``VMIN`` ) - ``/NCONT``. + * ``1`` - Include symbol. If ``Label`` = LDIV, then ``KEY`` = 1 indicates that the displayed line + divisions will correspond to the value assigned by :ref:`lesize` (the word LESIZE can also be + substituted). Also, for ``Label`` = LDIV, if you execute the :ref:`lesize` command, ``KEY`` is set + to 1 (LESIZE) automatically. If ``Label`` = FBCS, then ``KEY`` = 1 indicates that boundary condition + scaling will be common. The applied and derived forces/moments will be scaled to the same maximum + value. - vmax : str - Maximum contour value. Ignored if both ``VMIN`` and ``VINC`` are specified. + * ``N`` - If ``Label`` = LAYR, then ``N`` is equal to the layer number. If ``Label`` = DOT, then + ``N`` can be equal to 0,1,.....15, indicating the dot size. If ``Label`` = MARK, then ``N`` can be + equal to 1,.....10, indicating the marker size. If ``Label`` = LDIV, then ``KEY`` = -1, indicates that + no element divisions will be displayed (the word OFF can also be substituted). Notes ----- - .. _s-CONTOUR_notes: - - Values represent contour lines in vector mode, and the algebraic maximum of contour bands in raster - mode. + .. _s-PSYMB_notes: - Regardless of how many contours ( ``NCONT`` ) are specified, the actual number of contours appearing - on your display depends also on the device name, whether the display is directed to the screen or to - a file, the display mode (vector or raster), and the number of color planes. (All of those items are - controlled via :ref:`show`.) In any case, regardless of whether they are smoothed or banded, only - 128 contours can be displayed. + Includes various symbols on the display. Triads are right-handed with x displayed as the longest + leg. Where color is displayed, x is white, y is green, and z is blue. For beams, x is always along + the length of the element. For lines, an arrow represents the direction of a line, from the + beginning keypoint to the end keypoint. See :ref:`plopts` command for additional display options. + Use :ref:`pstatus` or :ref:`psymb`,STAT to display settings. Use :ref:`psymb`,DEFA to reset all + specifications back to their defaults. The command :ref:`psymb`,ECON,1 causes the symbol "M" to be + displayed on keypoints and lines associated with meshed entities. When you issue the command + :ref:`psymb`,DOT,1, a larger symbol is displayed for each node and keypoint location. Using + :ref:`psymb`,MARK,1, a smaller marker size can be displayed. - For more information about changing the number of contours, see `Creating Geometric Results Displays - `_. + PowerGraphics ( :ref:`graphics`,POWER) does not support :ref:`psymb`,ESYS and :ref:`psymb`,LAYR. - When the current Mechanical APDL graphics are not displayed as Multi-Plots: + If ``KEY`` = ``N`` and PowerGraphics is off, the centroid of the surface elements is connected to + the extra node using a gray line. However, if PowerGraphics is on, the color of the line connecting + the centroid to the extra node is the same as that for the elements themselves (as determined by + :ref:`pnum` ). - * If the current device is a 3D device ( :ref:`show`,3D), the model contours in all active windows - are the same, even if separate :ref:`contour` commands are issued for each active window. - * Mechanical APDL maintains a single data structure (segment) containing one set of contours. The - program - displays the same segment in all windows. The view settings of each window constitute the only - differences in the contour plots in the active windows. + When ``Label`` = LAYR, the layer systems can be visualized with all current-technology layered + elements and the smeared reinforcing element ``REINF265``. To use :ref:`psymb`,LAYR with + ``REINF265``, first set the vector-mode graphics option ( :ref:`device`,VECTOR,1). This command is valid in any processor. - - For alternate specifications, see :ref:`cval`. """ - command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" + command = f"/PSYMB,{label},{key}" return self.run(command, **kwargs) - def clabel(self, wn: str = "", key: int | str = "", **kwargs): - r"""Specifies contour labeling. - - Mechanical APDL Command: `/CLABEL `_ - - **Command default:** - - .. _s-CLABEL_default: + def pnum(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls entity numbering/coloring on plots. - Show contour line labels. + Mechanical APDL Command: `/PNUM `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - key : int or str - Labeling key: - - * ``0 or 1`` - Label contours with legend or color (default). - - * ``-1`` - No contour labeling. - - * ``N`` - Same as 1 except show alphabetic legend only on every ``N`` th element. - - Notes - ----- - - .. _s-CLABEL_notes: - - Labels contours for identification with alphabetic legend for vector displays and color for raster - displays. Number of contours is automatically reduced to 9 (or fewer) for clarity. Use - :ref:`contour` command to increase (24 maximum for alphabetic labeling; no limit for color - labeling). - - This command is valid in any processor. - """ - command = f"/CLABEL,{wn},{key}" - return self.run(command, **kwargs) - - def cval( - self, - wn: str = "", - v1: str = "", - v2: str = "", - v3: str = "", - v4: str = "", - v5: str = "", - v6: str = "", - v7: str = "", - v8: str = "", - **kwargs, - ): - r"""Specifies nonuniform contour values on stress displays. - - Mechanical APDL Command: `/CVAL `_ + label : str + Type of numbering/coloring: - **Command default:** + * ``NODE`` - Node numbers on node and element plots. - .. _s-CVAL_default: + * ``ELEM`` - Element numbers and colors on element plots. - Nine contour values uniformly spaced between the extreme values. + * ``SEC`` - Section numbers and colors on element and solid model plots (see :ref:`s-PNUM.notes`). - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + * ``MAT`` - Material set numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - v1 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - v2 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see + :ref:`s-PNUM.notes`). - v3 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see + :ref:`s-PNUM.notes`). - v4 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. - v5 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + LOC and ELEM numbers will be the same unless the model has been reordered. - v6 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``KP`` - Keypoint numbers on solid model plots. - v7 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``LINE`` - Line numbers on solid model plots (both numbers and colors on line plots). - v8 : str - Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be - the last value specified. If no values are specified, all contour specifications are erased and - contours are automatically calculated. + * ``AREA`` - Area numbers on solid model plots (both numbers and colors on area plots). - Notes - ----- + * ``VOLU`` - Volume numbers on solid model plots (both numbers and colors on volume plots). - .. _s-CVAL_notes: + * ``SVAL`` - Stress (or any contour) values on postprocessing plots, and surface load values and + colors on model plots when surface load symbols are on ( :ref:`psf` ). For tabular boundary + conditions, the table- evaluated values will be displayed on node, element, or contour displays in + POST1 when load symbols ( :ref:`pbf`, :ref:`psf`, :ref:`pbc` ) are on and TABNAM is OFF. - This command is similar to the :ref:`contour` command. With :ref:`cval`, however, you define the - upper level of each contour band instead of having the contours uniformly distributed over the - range. The minimum value (including a zero value for the first band) for a contour band cannot be - specified. If you use both :ref:`contour` and :ref:`cval`, the last command issued takes precedence. + * ``TABNAM`` - Table names for tabular boundary conditions. If this label is turned on, the table + name appears next to the appropriate symbol, arrow, face outline, or contour as dictated by the + :ref:`psf`, :ref:`pbc`, and :ref:`pbf` commands. - This command is valid in any processor. - """ - command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" - return self.run(command, **kwargs) + * ``STAT`` - Shows current settings for :ref:`pnum`. - def cformat(self, nfirst: str = "", nlast: str = "", **kwargs): - r"""Controls the graphical display of alphanumeric character strings for parameters, components, - assemblies, and tables. + * ``DEFA`` - Resets all :ref:`pnum` specifications back to default. - Mechanical APDL Command: `/CFORMAT `_ + key : int or str + Switch: - Parameters - ---------- - nfirst : str - Display the first ``n`` characters of the parameter, component, assembly, or table name, up to - 32. Defaults to 32. + * ``0`` - Turns OFF numbers/colors for specified label. - nlast : str - Display the last ``n`` characters of the parameter, component, assembly, or table name, up to - 32. Defaults to 0. + * ``1`` - Turns ON numbers/colors for specified label. Notes ----- - .. _s-CFORMAT_notes: - - Use this command to control the length of the character string that is shown in the graphics window - for a parameter, component, assembly, or table name. - - The total number of characters ( ``NFIRST`` + ``NLAST`` +3) cannot exceed 32. + .. _s-PNUM_notes: - If ``NFIRST`` is greater than zero and ``NLAST`` = 0, only the ``NFIRST`` characters are displayed, - followed by an ellipsis. + This command specifies entity numbering and coloring for subsequent plots. - If ``NFIRST`` = 0 and ``NLAST`` is greater than zero, only the ``NLAST`` characters are displayed, - preceded by an ellipsis (...). + The MAT, TYPE, REAL, and ESYS labels activate both the numbering and coloring of the corresponding + attributes for :ref:`eplot`, :ref:`kplot`, :ref:`lplot`, :ref:`aplot`, and :ref:`vplot`. The ELEM, + MAT, TYPE, REAL, ESYS, and LOC labels are mutually exclusive, that is, only one can be specified at + a time. Also, turning on a LINE, AREA, or VOLU label will turn off the MAT, TYPE, and REAL labels. - If both ``NFIRST`` and ``NLAST`` are greater than zero, the name will be shown as ``NFIRST``, - followed by an ellipsis (...), followed by ``NLAST``, up to a maximum of 32 characters. + PowerGraphics ( :ref:`graphics`,POWER) displays for :ref:`pnum` can be problematic. :ref:`pnum`,ELEM + will display erratically depending on other display command specifications, while :ref:`pnum`,LOC + and :ref:`pnum`,ESYS are not supported. - For example, if ``NFIRST`` = 6 and ``NLAST`` = 3, and the character string is LENGTHOFSIDEONE, then - it will appear in the graphics window as LENGTH...ONE. + Element and volume numbers are not visible for 3D elements and volumes when Z-buffering is turned on + ( :ref:`slashtype`,,[6,7, or 8]). - If the actual length of the character string is less than the specified combination of ``NFIRST`` + - ``NLAST`` +3, then the actual string will be used. + Use :ref:`pstatus` or :ref:`pnum`,STAT to show settings. Use :ref:`pnum`,DEFA to reset all + specifications back to default. Use the :ref:`number` command to control whether numbers and colors + are displayed together. - This command is valid in any processor. + This command is valid in any processor """ - command = f"/CFORMAT,{nfirst},{nlast}" + command = f"/PNUM,{label},{key}" return self.run(command, **kwargs) def udoc(self, wind: str = "", class_: str = "", key: str = "", **kwargs): @@ -1091,7 +796,8 @@ class is shown by default in all plots which contain :ref:`pbc` information. key : str Switch: - InformalTables need to be added. + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. Notes ----- @@ -1122,68 +828,120 @@ class is shown by default in all plots which contain :ref:`pbc` information. command = f"/UDOC,{wind},{class_},{key}" return self.run(command, **kwargs) - def hbc(self, wn: str = "", key: str = "", **kwargs): - r"""Determines how boundary condition symbols are displayed in a display window. + def gformat(self, ftype: str = "", nwidth: str = "", dsignf: str = "", **kwargs): + r"""Specifies the format for the graphical display of numbers. - Mechanical APDL Command: `/HBC `_ + Mechanical APDL Command: `/GFORMAT `_ Parameters ---------- - wn : str - Window reference number. This number can be any window numbered 1 to 5, or ALL (for all active - windows). Default = 1. + ftype : str + FORTRAN format types (G is the default if this field is left blank.) - key : str - Controls hidden-surface boundary condition display behavior: + * ``G`` - G ``xx``. ``yy``. ``xx`` and ``yy`` are described below. - ON, YES or 1 = Enable - Your boundary condition symbols are processed by the hidden-surface - algorithm (for 2D graphics devices) and use an improved pressure-contour display (for 2D and 3D - graphics devices). + * ``F`` - F ``xx``. ``yy`` - OFF, NO or 0 (default) = Disable (default) - Your boundary condition symbols are not processed - by the hidden-surface algorithm.. + * ``E`` - E ``xx``. ``yy`` + + nwidth : str + Total width (12 maximum) of the field (the ``xx`` in ``Ftype`` ). Defaults to 12. + + dsignf : str + Number of digits after the decimal point ( ``yy`` in F or E format) or number of significant + digits in G format. Range is 1 to ``xx`` -6 for ``Ftype`` = G or E; and 0 to ``xx`` -3 for + ``Ftype`` = F. The default is a function of ``Ftype`` and ``NWIDTH``. Notes ----- - .. _s-HBC_notes: + .. _s-GFORMAT_notes: - With :ref:`hbc`, ``WN``,ON in effect, Mechanical APDL does not display symbols obscured by the model - in the - current view (that is, symbols inside of or behind the model are not drawn). This behavior lessens - display clutter. + Enables you to control the format of the graphical display of floating point numbers. + + To display the current settings, issue :ref:`gformat`,STAT.. + + To allow Mechanical APDL to select the format for the graphical display of floating numbers, issue + :ref:`gformat`,DEFA. + + This command is valid in any processor. """ - command = f"/HBC,{wn},{key}" + command = f"/GFORMAT,{ftype},{nwidth},{dsignf}" return self.run(command, **kwargs) - def number(self, nkey: int | str = "", **kwargs): - r"""Specifies whether numbers, colors, or both are used for displays. + def triad(self, lab: str = "", **kwargs): + r"""Shows the global XYZ coordinate triad on displays. - Mechanical APDL Command: `/NUMBER `_ + Mechanical APDL Command: `/TRIAD `_ Parameters ---------- - nkey : int or str - Numbering style: + lab : str + Display triad as follows: - * ``0`` - Color (terminal dependent) the numbered items and show numbers. + * ``ORIG`` - Display triad at global origin (default). - * ``1`` - Color the numbered items. Do not show the numbers. + * ``OFF`` - Turn off triad display. - * ``2`` - Show the numbers. Do not color the items. + * ``LBOT`` - Display triad in lower left screen corner. - * ``-1`` - Do not color the items or show the numbers. For contour plots, the resulting display will - vary (see below). + * ``RBOT`` - Display triad in lower right screen corner. + + * ``LTOP`` - Display triad in upper left screen corner. + + * ``RTOP`` - Display triad in upper right screen corner. Notes ----- - .. _s-NUMBER_notes: + .. _s-TRIAD_notes: - Specifies whether numbers, colors, or both are used for numbering displays ( :ref:`pnum` ) of nodes, - elements, keypoints, lines, areas, and volumes. + For efficiency, Mechanical APDL maintains a single data structure (segment) which includes the triad + as a + 3D data object. - Shading is also available for terminals configured with more than 4 color planes ( :ref:`show` ). + If a 3D device is involved ( :ref:`show`,3D) and the graphics are not being displayed as multi- + plots, the triad location is determined by the view settings for window #1. + + A request for triad display anywhere except for the origin may yield an improper display in windows + 2 through 5. + + The program displays the same segment in all windows. The view settings of each window constitute + the only difference in the display in the active windows. + + This command is valid in any processor. + """ + command = f"/TRIAD,{lab}" + return self.run(command, **kwargs) + + def number(self, nkey: int | str = "", **kwargs): + r"""Specifies whether numbers, colors, or both are used for displays. + + Mechanical APDL Command: `/NUMBER `_ + + Parameters + ---------- + nkey : int or str + Numbering style: + + * ``0`` - Color (terminal dependent) the numbered items and show numbers. + + * ``1`` - Color the numbered items. Do not show the numbers. + + * ``2`` - Show the numbers. Do not color the items. + + * ``-1`` - Do not color the items or show the numbers. For contour plots, the resulting display will + vary (see below). + + Notes + ----- + + .. _s-NUMBER_notes: + + Specifies whether numbers, colors, or both are used for numbering displays ( :ref:`pnum` ) of nodes, + elements, keypoints, lines, areas, and volumes. + + Shading is also available for terminals configured with more than 4 color planes ( :ref:`show` ). Color automatically appears for certain items and may be manually controlled (off or on) for other items. @@ -1205,43 +963,284 @@ def number(self, nkey: int | str = "", **kwargs): command = f"/NUMBER,{nkey}" return self.run(command, **kwargs) - def gformat(self, ftype: str = "", nwidth: str = "", dsignf: str = "", **kwargs): - r"""Specifies the format for the graphical display of numbers. + def hbc(self, wn: str = "", key: str = "", **kwargs): + r"""Determines how boundary condition symbols are displayed in a display window. - Mechanical APDL Command: `/GFORMAT `_ + Mechanical APDL Command: `/HBC `_ Parameters ---------- - ftype : str - FORTRAN format types (G is the default if this field is left blank.) + wn : str + Window reference number. This number can be any window numbered 1 to 5, or ALL (for all active + windows). Default = 1. - * ``G`` - G ``xx``. ``yy``. ``xx`` and ``yy`` are described below. + key : str + Controls hidden-surface boundary condition display behavior: - * ``F`` - F ``xx``. ``yy`` + ON, YES or 1 = Enable - Your boundary condition symbols are processed by the hidden-surface + algorithm (for 2D graphics devices) and use an improved pressure-contour display (for 2D and 3D + graphics devices). - * ``E`` - E ``xx``. ``yy`` + OFF, NO or 0 (default) = Disable (default) - Your boundary condition symbols are not processed + by the hidden-surface algorithm.. - nwidth : str - Total width (12 maximum) of the field (the ``xx`` in ``Ftype`` ). Defaults to 12. + Notes + ----- - dsignf : str - Number of digits after the decimal point ( ``yy`` in F or E format) or number of significant - digits in G format. Range is 1 to ``xx`` -6 for ``Ftype`` = G or E; and 0 to ``xx`` -3 for - ``Ftype`` = F. The default is a function of ``Ftype`` and ``NWIDTH``. + .. _s-HBC_notes: + + With :ref:`hbc`, ``WN``,ON in effect, Mechanical APDL does not display symbols obscured by the model + in the + current view (that is, symbols inside of or behind the model are not drawn). This behavior lessens + display clutter. + """ + command = f"/HBC,{wn},{key}" + return self.run(command, **kwargs) + + def cformat(self, nfirst: str = "", nlast: str = "", **kwargs): + r"""Controls the graphical display of alphanumeric character strings for parameters, components, + assemblies, and tables. + + Mechanical APDL Command: `/CFORMAT `_ + + Parameters + ---------- + nfirst : str + Display the first ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 32. + + nlast : str + Display the last ``n`` characters of the parameter, component, assembly, or table name, up to + 32. Defaults to 0. Notes ----- - .. _s-GFORMAT_notes: + .. _s-CFORMAT_notes: - Enables you to control the format of the graphical display of floating point numbers. + Use this command to control the length of the character string that is shown in the graphics window + for a parameter, component, assembly, or table name. - To display the current settings, issue :ref:`gformat`,STAT.. + The total number of characters ( ``NFIRST`` + ``NLAST`` +3) cannot exceed 32. - To allow Mechanical APDL to select the format for the graphical display of floating numbers, issue - :ref:`gformat`,DEFA. + If ``NFIRST`` is greater than zero and ``NLAST`` = 0, only the ``NFIRST`` characters are displayed, + followed by an ellipsis. + + If ``NFIRST`` = 0 and ``NLAST`` is greater than zero, only the ``NLAST`` characters are displayed, + preceded by an ellipsis (...). + + If both ``NFIRST`` and ``NLAST`` are greater than zero, the name will be shown as ``NFIRST``, + followed by an ellipsis (...), followed by ``NLAST``, up to a maximum of 32 characters. + + For example, if ``NFIRST`` = 6 and ``NLAST`` = 3, and the character string is LENGTHOFSIDEONE, then + it will appear in the graphics window as LENGTH...ONE. + + If the actual length of the character string is less than the specified combination of ``NFIRST`` + + ``NLAST`` +3, then the actual string will be used. This command is valid in any processor. """ - command = f"/GFORMAT,{ftype},{nwidth},{dsignf}" + command = f"/CFORMAT,{nfirst},{nlast}" + return self.run(command, **kwargs) + + def clabel(self, wn: str = "", key: int | str = "", **kwargs): + r"""Specifies contour labeling. + + Mechanical APDL Command: `/CLABEL `_ + + **Command default:** + + .. _s-CLABEL_default: + + Show contour line labels. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + key : int or str + Labeling key: + + * ``0 or 1`` - Label contours with legend or color (default). + + * ``-1`` - No contour labeling. + + * ``N`` - Same as 1 except show alphabetic legend only on every ``N`` th element. + + Notes + ----- + + .. _s-CLABEL_notes: + + Labels contours for identification with alphabetic legend for vector displays and color for raster + displays. Number of contours is automatically reduced to 9 (or fewer) for clarity. Use + :ref:`contour` command to increase (24 maximum for alphabetic labeling; no limit for color + labeling). + + This command is valid in any processor. + """ + command = f"/CLABEL,{wn},{key}" + return self.run(command, **kwargs) + + def contour( + self, + wn: str = "", + ncont: str = "", + vmin: str = "", + vinc: str = "", + vmax: str = "", + **kwargs, + ): + r"""Specifies the uniform contour values on stress displays. + + Mechanical APDL Command: `/CONTOUR `_ + + **Command default:** + + .. _s-CONTOUR_default: + + Nine contour values uniformly spaced between the extreme values, or no contours if the ratio of + range to minimum value (or range to maximum if minimum = 0) is less than 0.001. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + ncont : str + Number of contour values. ``NCONT`` defaults to 9 for X11 or WIN32 and to 128 for X11c or + WIN32C. The default graphics window display for 3D devices is a smooth continuous shading effect + that spans the maximum of 128 contours available. Use the :ref:`dv3d` command to create defined + banding for your contour values (values of 9 and 128 are displayed in smooth shading only). The + legend, however, will display only nine color boxes, which span the full range of colors + displayed in the graphics window. + + vmin : str + Minimum contour value. If ``VMIN`` = AUTO, automatically calculate contour values based upon + ``NCONT`` uniformly spaced values over the min-max extreme range. Or, if ``VMIN`` = USER, set + contour values to those of the last display (useful when last display automatically calculated + contours). + + vinc : str + Value increment (positive) between contour values. Defaults to ( ``VMAX`` - ``VMIN`` ) + ``/NCONT``. + + vmax : str + Maximum contour value. Ignored if both ``VMIN`` and ``VINC`` are specified. + + Notes + ----- + + .. _s-CONTOUR_notes: + + Values represent contour lines in vector mode, and the algebraic maximum of contour bands in raster + mode. + + Regardless of how many contours ( ``NCONT`` ) are specified, the actual number of contours appearing + on your display depends also on the device name, whether the display is directed to the screen or to + a file, the display mode (vector or raster), and the number of color planes. (All of those items are + controlled via :ref:`show`.) In any case, regardless of whether they are smoothed or banded, only + 128 contours can be displayed. + + For more information about changing the number of contours, see `Creating Geometric Results Displays + `_. + + When the current Mechanical APDL graphics are not displayed as Multi-Plots: + + * If the current device is a 3D device ( :ref:`show`,3D), the model contours in all active windows + are the same, even if separate :ref:`contour` commands are issued for each active window. + * Mechanical APDL maintains a single data structure (segment) containing one set of contours. The + program + displays the same segment in all windows. The view settings of each window constitute the only + differences in the contour plots in the active windows. + + This command is valid in any processor. + + For alternate specifications, see :ref:`cval`. + """ + command = f"/CONTOUR,{wn},{ncont},{vmin},{vinc},{vmax}" + return self.run(command, **kwargs) + + def cval( + self, + wn: str = "", + v1: str = "", + v2: str = "", + v3: str = "", + v4: str = "", + v5: str = "", + v6: str = "", + v7: str = "", + v8: str = "", + **kwargs, + ): + r"""Specifies nonuniform contour values on stress displays. + + Mechanical APDL Command: `/CVAL `_ + + **Command default:** + + .. _s-CVAL_default: + + Nine contour values uniformly spaced between the extreme values. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + v1 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v2 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v3 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v4 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v5 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v6 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v7 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + v8 : str + Up to 8 contour values may be specified (in ascending order). The 0.0 value (if any) must not be + the last value specified. If no values are specified, all contour specifications are erased and + contours are automatically calculated. + + Notes + ----- + + .. _s-CVAL_notes: + + This command is similar to the :ref:`contour` command. With :ref:`cval`, however, you define the + upper level of each contour band instead of having the contours uniformly distributed over the + range. The minimum value (including a zero value for the first band) for a contour band cannot be + specified. If you use both :ref:`contour` and :ref:`cval`, the last command issued takes precedence. + + This command is valid in any processor. + """ + command = f"/CVAL,{wn},{v1},{v2},{v3},{v4},{v5},{v6},{v7},{v8}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/scaling.py b/src/ansys/mapdl/core/_commands/graphics/scaling.py index 54c16f11dbf..3f328cd4626 100644 --- a/src/ansys/mapdl/core/_commands/graphics/scaling.py +++ b/src/ansys/mapdl/core/_commands/graphics/scaling.py @@ -23,77 +23,106 @@ class Scaling: - def iclwid(self, factor: str = "", **kwargs): - r"""Scales the line width of circuit builder icons. + def vscale(self, wn: str = "", vratio: str = "", key: int | str = "", **kwargs): + r"""Scales the length of displayed vectors. - Mechanical APDL Command: `/ICLWID `_ + Mechanical APDL Command: `/VSCALE `_ Parameters ---------- - factor : str - Multiplication factor applied to the default line width (defaults to 1). The minimum is 1 and - the maximum is 6. + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + vratio : str + Ratio value applied to the automatically calculated scale factor (defaults to 1.0, that is, use + scale factor as automatically calculated). + + key : int or str + Relative scaling key: + + * ``0`` - Use relative length scaling among vectors based on magnitudes. + + * ``1`` - Use uniform length scaling for all vector lengths. + + Notes + ----- + + .. _s-VSCALE_notes: + + Allows scaling of the vector length displayed with the :ref:`plvect` command of POST1 and the + :ref:`pbc` and :ref:`psf` commands. Also allows the scaling of the element (that is, + :ref:`psymb`,ESYS) and the nodal (that is, :ref:`psymb`,NDIR) coordinate system symbols. + + This command is valid in any processor. """ - command = f"/ICLWID,{factor}" + command = f"/VSCALE,{wn},{vratio},{key}" return self.run(command, **kwargs) - def icscale(self, wn: str = "", factor: str = "", **kwargs): - r"""Scales the icon size for elements supported in the circuit builder. + def ratio(self, wn: str = "", ratox: str = "", ratoy: str = "", **kwargs): + r"""Distorts the object geometry. - Mechanical APDL Command: `/ICSCALE `_ + Mechanical APDL Command: `/RATIO `_ Parameters ---------- wn : str Window number (or ALL) to which command applies (defaults to 1). - factor : str - Factor applied to the default icon size (defaults to 1). + ratox : str + Distort object in the window X direction by this factor (defaults to 1.0). + + ratoy : str + Distort object in the window Y direction by this factor (defaults to 1.0). Notes ----- - .. _s-ICSCALE_notes: + .. _s-RATIO_notes: - Scaling the icon size can provide better visualization of the circuit components when using the - Circuit Builder (an interactive builder available in the Mechanical APDL GUI). + Distorts the object geometry in a particular direction. An example of this command's use would be to + allow long narrow sections to be distorted to a more square area for better display visualization. + + This command is valid in any processor. """ - command = f"/ICSCALE,{wn},{factor}" + command = f"/RATIO,{wn},{ratox},{ratoy}" return self.run(command, **kwargs) - def vscale(self, wn: str = "", vratio: str = "", key: int | str = "", **kwargs): - r"""Scales the length of displayed vectors. + def iclwid(self, factor: str = "", **kwargs): + r"""Scales the line width of circuit builder icons. - Mechanical APDL Command: `/VSCALE `_ + Mechanical APDL Command: `/ICLWID `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + factor : str + Multiplication factor applied to the default line width (defaults to 1). The minimum is 1 and + the maximum is 6. + """ + command = f"/ICLWID,{factor}" + return self.run(command, **kwargs) - vratio : str - Ratio value applied to the automatically calculated scale factor (defaults to 1.0, that is, use - scale factor as automatically calculated). + def icscale(self, wn: str = "", factor: str = "", **kwargs): + r"""Scales the icon size for elements supported in the circuit builder. - key : int or str - Relative scaling key: + Mechanical APDL Command: `/ICSCALE `_ - * ``0`` - Use relative length scaling among vectors based on magnitudes. + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). - * ``1`` - Use uniform length scaling for all vector lengths. + factor : str + Factor applied to the default icon size (defaults to 1). Notes ----- - .. _s-VSCALE_notes: - - Allows scaling of the vector length displayed with the :ref:`plvect` command of POST1 and the - :ref:`pbc` and :ref:`psf` commands. Also allows the scaling of the element (that is, - :ref:`psymb`,ESYS) and the nodal (that is, :ref:`psymb`,NDIR) coordinate system symbols. + .. _s-ICSCALE_notes: - This command is valid in any processor. + Scaling the icon size can provide better visualization of the circuit components when using the + Circuit Builder (an interactive builder available in the Mechanical APDL GUI). """ - command = f"/VSCALE,{wn},{vratio},{key}" + command = f"/ICSCALE,{wn},{factor}" return self.run(command, **kwargs) def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): @@ -154,35 +183,6 @@ def slashdscale(self, wn: str = "", dmult: int | str = "", **kwargs): command = f"/DSCALE,{wn},{dmult}" return self.run(command, **kwargs) - def ratio(self, wn: str = "", ratox: str = "", ratoy: str = "", **kwargs): - r"""Distorts the object geometry. - - Mechanical APDL Command: `/RATIO `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - ratox : str - Distort object in the window X direction by this factor (defaults to 1.0). - - ratoy : str - Distort object in the window Y direction by this factor (defaults to 1.0). - - Notes - ----- - - .. _s-RATIO_notes: - - Distorts the object geometry in a particular direction. An example of this command's use would be to - allow long narrow sections to be distorted to a more square area for better display visualization. - - This command is valid in any processor. - """ - command = f"/RATIO,{wn},{ratox},{ratoy}" - return self.run(command, **kwargs) - def sscale(self, wn: str = "", smult: str = "", **kwargs): r"""Sets the contour multiplier for topographic displays. diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index 21b50fd9922..23515b85376 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -23,817 +23,703 @@ class SetUp: - def immed(self, key: int | str = "", **kwargs): - r"""Allows immediate display of a model as it is generated. + def pstatus(self, wn: str = "", **kwargs): + r"""Displays the global or window display specifications. - Mechanical APDL Command: `IMMED `_ + Mechanical APDL Command: `/PSTATUS `_ Parameters ---------- - key : int or str - Immediate mode key: - - * ``0`` - Display only upon request, that is, no immediate display (default with the GUI off ). - - * ``1`` - Display immediately as model is generated (default with the GUI on ). + wn : str + Window number for status (defaults to global specifications). Notes ----- - .. _IMMED_notes: - - The command enables you to control whether or not the model is displayed immediately as it is - generated in an interactive session. Available only during an interactive session at a graphics - display terminal. A valid graphics device name must first be specified ( :ref:`show` ). - - By default in the GUI, your model is immediately displayed in the Graphics window as you create new - entities (such as areas, keypoints, nodes, elements, local coordinate systems, boundary conditions, - etc.), referred to as immediate mode graphics. - - Symbols (such as boundary conditions, local coordinate system triads, etc.) appear immediately and - are present on subsequent displays unless you disable the appropriate symbol (via the GUI plot - controls function or the appropriate graphics-specification command). - - An immediate image is also scaled automatically to fit within the Graphics window. The new scaling - is usually apparent on the automatic replot associated with immediate mode. To suppress automatic - replot, issue :ref:`uis`,REPLOT,0. (With automatic replot suppressed, the immediate image may not - always be scaled correctly.) + .. _s-PSTATUS_notes: - An immediate display in progress should not be aborted with the usual system "break" feature (or - else the Mechanical APDL session itself terminates). When you run Mechanical APDL interactively - without using the - GUI, immediate mode is off by default. + Displays the current global or window display specifications. Global display specifications are + common to all windows (e.g. :ref:`show`, etc.). Window display specifications are specific to one + window (e.g. :ref:`view`, :ref:`slashtype`, etc.). - This command is valid only in PREP7. + This command is valid in any processor. """ - command = f"IMMED,{key}" + command = f"/PSTATUS,{wn}" return self.run(command, **kwargs) - def image(self, label: str = "", fname: str = "", ext: str = "", **kwargs): - r"""Allows graphics data to be captured and saved. + def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): + r"""Provides PNG file export for Mechanical APDL displays. - Mechanical APDL Command: `/IMAGE `_ + Mechanical APDL Command: `PNGR `_ Parameters ---------- - label : str - Label specifying the operation to be performed: - - * ``CAPTURE`` - Capture the image from the graphics window to a new window. + kywrd : str + Specifies various PNG file export options. - * ``RESTORE`` - Restore the image from a file to a new window. + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` is either ON or OFF (blank is interpreted as OFF). + This option allows you to turn PNG file compression ON or OFF. If OPT = ON, then The VAL field is + read to determine the degree of compression. See the VALUE argument for acceptable compression + values. - * ``SAVE`` - Save the contents of the graphic window to a file. + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire + plot. ``OPT`` can be either Horizontal (default) or Vertical. - * ``DELETE`` - Delete the window that contains the file. + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. + ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), + respectively. - fname : str - File name and directory path (248 characters maximum, including the characters needed for the - directory path). An unspecified directory path defaults to the working directory; in this case, - you can use all 248 characters for the file name. + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either + 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. - ext : str - Filename extension (eight-character maximum). If no extension is specified, :file:`bmp` will be - used on Windows systems, and :file:`img` will be used on Linux systems. - """ - command = f"/IMAGE,{label},{fname},{ext}" - return self.run(command, **kwargs) + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd + parameters listed above, are active. - def dv3d(self, lab: str = "", key: int | str = "", **kwargs): - r"""Sets 3D device option modes. + * ``STAT`` - Shows the current status of PNG file export. - Mechanical APDL Command: `/DV3D `_ + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - Parameters - ---------- - lab : str - Mode label: + * ``ON, OFF`` - If ``Kywrd`` = COMP, the values On and Off control the use of compression. The + degree of compression is determined by VAL - * ``ACCU`` - Activating the accumulation buffer for OpenGL graphics, providing faster model rotation - when shaded backgrounds are in use. This feature is off by default. + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the + orientation of the plot. - * ``ACTR`` - Label term to designate the cursor position as the center for automatic dynamic - rotational center capability. The subsequent ``Key`` value (see below) turns this capability on and - off. This feature is on by default. (Available for OpenGL displays only.) + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, + Grayscale and Color, respectively. - * ``ANIM`` - Animation mode. The ANIM option allows you to create animation frames in pixmap mode - instead of display list mode. This may improve large model performance, but it eliminates local - manipulation while animation is in progress. This feature is on by default. + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) + fonts will be used - * ``ANTI`` - Label term to control Anti-aliasing, a smoothing technique for your graph plots. (see - below) The subsequent ``Key`` value turns this capability on and off. The default for this feature - is off. (Available for OpenGL displays only). + val : int or str + ``VAL`` is active only when ``Kywrd`` = COMP, and determines the degree of compression applied to + the exported file (see above). - * ``CNTR`` - Switches banded contours on (1) or off (0) for your 3D contour display. The default is - 1 (ON). Other contour parameters such as number of contours or the increment and range are defined - using the :ref:`contour` command. When either 9 or 128 contours are specified via :ref:`contour`, - this command is ignored and a smooth contour is always displayed. + * ``-1`` - Apply the default, optimum value for compression. This value represents the best + combination of speed and compression. It varies according to the release level of the ZLIB + compression package. - * ``DGEN`` - Local manipulation degenerate mode. You access the DGEN option to set wire-frame local - manipulation mode for 3D devices (device dependent). This feature is off by default. + * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression + level (fastest) and 9 is the highest compression level (slowest). - * ``DLIST`` - With DLIST, you can specify whether screen updates and redraws will be performed using - the Mechanical APDL display list (off), or the 3D device's display list (on). DLIST is on by default for - Windows systems, but off for Linux. + """ + command = f"PNGR,{kywrd},{opt},{val}" + return self.run(command, **kwargs) - * ``DELS`` - You use DELS to suppress contour display screen overwrites when :ref:`noerase` is - active. This prevents the bleed-through that occurs when you overlay contour plots. + def mrep( + self, + name: str = "", + arg1: str = "", + arg2: str = "", + arg3: str = "", + arg4: str = "", + arg5: str = "", + arg6: str = "", + arg7: str = "", + arg8: str = "", + arg9: str = "", + arg10: str = "", + arg11: str = "", + arg12: str = "", + arg13: str = "", + arg14: str = "", + arg15: str = "", + arg16: str = "", + arg17: str = "", + arg18: str = "", + **kwargs, + ): + r"""Enables you to reissue the graphics command macro "name" during a replot or zoom operation. - * ``TRIS`` - Triangle strip mode. Tri-stripping provides faster 3D display capabilities and is on by - default. Some display enhancements, such as texturing, are adversely affected by tri-stripping. You - can turn off tri-stripping in order to improve these display functions. Be sure to turn tri- - stripping on after the desired output is obtained. + Mechanical APDL Command: `/MREP `_ - key : int or str - The following key options apply to ``Lab`` = ACCU: + Parameters + ---------- + name : str + The name identifying the macro file or macro block on a macro library file. The name can contain + up to eight characters maximum and must begin with a letter. - * ``0`` - (OFF) The accumulation buffer is not accessed. (default) + arg1 : str + Values to be passed into the file or block. - * ``1`` - (ON) Access to the buffer is enabled. + arg2 : str + Values to be passed into the file or block. - The following key options apply to ``Lab`` = ACTR: + arg3 : str + Values to be passed into the file or block. - * ``0`` - (OFF) The cursor position has no effect on the existing rotational center for dynamic - operations. + arg4 : str + Values to be passed into the file or block. - * ``1`` - (ON) The rotational center for dynamic rotations in OpenGL is determined by the position - of the mouse cursor on (or within 15 pixels of) the model. Any rotations that are initiated with the - cursor more than 15 pixels from the model will occur about the midpoint of the Z-axis at that point - in space. If the Z-buffer has not been refreshed the Z-axis will have an infinite value, and - rotations will appear to occur about an extremely long Z-axis. This behavior stops when the graphics - window is refreshed or replotted. (default) + arg5 : str + Values to be passed into the file or block. - Note that when using the GUI in 3D mode, when ACTR = 1, the ``Rotational Center`` option is grayed - out under Utility Menu> PlotCtrls> View Setting because the rotational center is determined strictly - by the position of the mouse cursor. + arg6 : str + Values to be passed into the file or block. - The following key options apply to ``Lab`` = ANIM: + arg7 : str + Values to be passed into the file or block. - * ``0`` - Display list animation. The object can be dynamically manipulated while animating. No - legend, countour or annotation items are displayed. (see Notes, below) + arg8 : str + Values to be passed into the file or block. - * ``1`` - On Linux, device-dependent pixmap animation is used. On the PC, bitmap animation is - provided (default). When you animate in this mode, you cannot dynamically manipulate your model (see - Notes, below). + arg9 : str + Values to be passed into the file or block. - * ``2`` - On the PC only, this option provides AVI animation which uses the AVI movie player. + arg10 : str + Values to be passed into the file or block. - Although you can create animations of multiple Mechanical APDL window schemes, animations created with - OpenGL display lists ( :ref:`dv3d`, ANIM, 0) do not retain the windowing scheme information. You CAN - save multiple windows via the X11/WIN32 drivers, or via the OpenGL driver with :ref:`dv3d`, ANIM, - KEY in effect (where KEY is not zero). + arg11 : str + Values to be passed into the file or block. - The following key options apply to ``Lab`` = ANTI + arg12 : str + Values to be passed into the file or block. - * ``0`` - (OFF) Anti-aliasing is not active (default). + arg13 : str + Values to be passed into the file or block. - * ``1`` - (ON) The anti-aliasing technique will be applied to smooth the lines in your displays - (valid for OpenGL only). + arg14 : str + Values to be passed into the file or block. - The following key options apply to ``Lab`` = DGEN: + arg15 : str + Values to be passed into the file or block. - * ``0`` - Normal manipulation. + arg16 : str + Values to be passed into the file or block. - * ``1`` - Wireframe Manipulation. + arg17 : str + Values to be passed into the file or block. - The following key options apply to ``Lab`` = DLIST: + arg18 : str + Values to be passed into the file or block. - * ``0`` - (OFF) The Mechanical APDL display list is used for plotting and dynamic graphics manipulation - (Linux default). + Notes + ----- - * ``1`` - (ON) The local (3D device) display list is used for plotting and dynamic rotation (Windows - default). + .. _s-MREP_notes: - The following key options apply to ``Lab`` = TRIS: + This command reissues the graphics command macro "name" during a replot operation ( :ref:`replot` ) + or a zoom ( :ref:`zoom` ) operation. The program passes the command macro arguments to the replot + and zoom feature for use by the graphics macro. You should place the ``s-MREP`` command at the end + of the graphics command macro, following the last graphics command within the macro, to enable the + replot or zoom feature. + """ + command = f"/MREP,{name},{arg1},{arg2},{arg3},,{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" + return self.run(command, **kwargs) - * ``0`` - (OFF) Tri-stripping is off. + def gplot(self, **kwargs): + r"""Controls general plotting. - * ``1`` - (ON) Tri-stripping is on (default). + Mechanical APDL Command: `GPLOT `_ Notes ----- - .. warning:: + .. _GPLOT_notes: - This function contains specificities regarding the argument definitions. - Please refer to the `command documentation `_ - for further explanations. + This command displays all entity types as specified via the :ref:`gtype` command. Only selected + entities ( :ref:`nsel`, :ref:`esel`, :ref:`ksel`, :ref:`lsel`, :ref:`asel`, :ref:`vsel` ) will be + displayed. See the descriptions of the :ref:`gtype` and :ref:`gcmd` commands for methods of setting + the entity types displayed. - Mechanical APDL uses display list animation for its 3D models. This memory resident array method - interfaces - with the OpenGL model information to allow the program to efficiently pan, zoom, rotate and - dynamically manipulate your model during animation. The logo, legend, contour and other annotation - items are produced in 2D and will not appear when :ref:`dv3d`, ANIM, 0 is in effect. To display - these items, use :ref:`dv3d`, ANIM, 1. All screen data will be displayed, but manipulation of the - model will not be possible. + This command is valid in any processor. """ - command = f"/DV3D,{lab},{key}" + command = "GPLOT" return self.run(command, **kwargs) - def device(self, label: str = "", key: int | str = "", **kwargs): - r"""Controls graphics device options. - - Mechanical APDL Command: `/DEVICE `_ - - **Command default:** - - .. _s-DEVICE_default: + def gcolumn(self, curve: str = "", string: str = "", **kwargs): + r"""Allows the user to apply a label to a specified curve. - Vector mode off (that is, raster mode); dithering on. + Mechanical APDL Command: `/GCOLUMN `_ Parameters ---------- - label : str - Device function label: - - * ``BBOX`` - Bounding box mode. For PowerGraphics plots involving elements with :ref:`show`,x11 and - :ref:`show`,win32, Mechanical APDL generally displays dynamic rotations faster. If KEY = 1 (ON), then a - bounding box (not the elements) encompassing the model is displayed and rotated, rather than the - element outlines (ON is default in preprocessing). When KEY = 0 (OFF), then dynamic rotations may be - slower (Mechanical APDL redraws the element outlines) for plots involving elements with :ref:`show`,x11 and - :ref:`show`,win32. OFF is default in postprocessing. This command is ignored if :ref:`edge`,WN,1 is - set for any WN. This is ignored in POST1 and SOLUTION plots. - - For any PowerGraphics plots involving elements, regardless of :ref:`show` settings, plots will - generally be displayed faster. - - * ``VECTOR`` - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display - geometries are shown as outlines (wireframes). When vector mode is off (default), these entities are - shown filled with color. - - * ``DITHER`` - When dithering is turned on (default), color intensity transitions are smoothed. This - selection a - - applies only to smooth-shaded images, that is, Z-buffered ( :ref:`slashtype` ), or raster plots with - Gouraud or Phong shading ( :ref:`shade` ). - - * ``ANIM`` - Select the animation type used on 2D devices on the PC platform. A ``KEY`` value of BMP - (or 0) sets animation mode to the Mechanical APDL animation controller (default). A ``KEY`` value of AVI - (or 2) sets animation mode to AVI movie player file. - - * ``FONT`` - Font selection for the Mechanical APDL graphics window. When ``Label`` = FONT, the command format is: - :ref:`device`,FONT, ``KEY``, ``Val1``, ``Val2``, ``Val3``, ``Val4``, ``Val5``, ``Val6`` where - ``KEY`` determines the type of font being controlled, and values 1 through 6 control various font - parameters. These values are device specific; using the same command input file ( :ref:`input` ) on - different machines may yield different results.. The following ``KEY`` values determine the font - information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, - JPEG,...): - - * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. - - * ``KEY = 2`` - The command controls the ENTITY (node and keypoint number) font. - - * ``KEY = 3`` - The command controls the ANNOTATION/GRAPH font. - - Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 - are character strings; value 4 is a nonzero integer: - - * ``Val1`` - Family name (for example, Courier). If ``Val1`` = MENU, all other values are ignored - and a font selection menu appears (GUI must be active). - - * ``Val2`` - Weight (for example, medium) - - * ``Val3`` - Slant (for example, r) - - * ``Val4`` - Pixel size (for example, 14). Note that this value does no affect the annotation fonts - ( ``KEY`` = 3). Use the :ref:`tspec` command for annotation font size. - - * ``Val5`` - unused - - * ``Val6`` - unused - - PC: The values are encoded in a PC logical font structure. Value 1 is a character string, and the - remaining values are integers: - - * ``Val1`` - Family name (for example, Courier\2New) Substitute an asterisk (\2) for any blank - character that appears in a family name. If ``Val1`` = MENU, all other values are ignored and a font - selection menu appears (GUI must be active). When this value is blank, Mechanical APDL uses the first - available resource it finds. - - * ``Val2`` - Weight (0 - 1000) - - * ``Val3`` - Orientation (in tenths of a degree) - - * ``Val4`` - Height (in logical units) - - * ``Val5`` - Width (in logical units) - - * ``Val6`` - Italics (0 = OFF, 1 = ON) - - * ``TEXT`` - Text size specification for the Mechanical APDL graphics window. Using this label with the - :ref:`device` command requires the following form: :ref:`device`,TEXT, ``KEY``, ``PERCENT``. ``KEY`` - = 1 for LEGEND fonts; ``KEY`` = 2 for ENTITY fonts. ``PERCENT`` specifies the new text size as a - percent of the default text size. If ``PERCENT`` = 100, the new text size is precisely the default - size. If ``PERCENT`` = 200, the new text size is twice the default text size. - - key : int or str - Control key: - - * ``OFF or 0`` - Turns specified function off. - - * ``ON or 1`` - Turns specified function on or designates the LEGEND font. - - * ``2`` - Designates the ENTITY font. + curve : str + Curve number on which label will be applied (integer value between 1 and 10). - * ``3`` - Designates the ANNOTATION/GRAPH font. + string : str + Name or designation that will be applied to the curve (8 characters max). Notes ----- - .. _s-DEVICE_notes: - - This command is valid in any processor. + .. _s-GCOLUMN_notes: - The :ref:`device`,BBOX command is ignored in POST1 and SOLUTION plots. Also, the elements are - displayed and rotated if you use :ref:`device`,BBOX,ON and :ref:`edge`,WN,1,ANGLE (effectively - ignoring the BBOX option). + This command is used for an array parameter plot (a plot created by the :ref:`starvplot` command). + Normally the label for curve 1 is COL 1, the label for curve 2 is COL 2 and so on; the column number + is the field containing the dependent variables for that particular curve. Issuing :ref:`gcolumn`, + ``CURVE``, with no string value specified resets the label to the original value. """ - command = f"/DEVICE,{label},{key}" + command = f"/GCOLUMN,{curve},{string}" return self.run(command, **kwargs) - def dsys(self, kcn: str = "", **kwargs): - r"""Activates a display coordinate system for geometry listings and plots. - - Mechanical APDL Command: `DSYS `_ - - **Command default:** - - .. _DSYS_default: + def gresume(self, fname: str = "", ext: str = "", **kwargs): + r"""Sets graphics settings to the settings on a file. - Global Cartesian ( ``KCN`` = 0) display coordinate system. + Mechanical APDL Command: `/GRESUME `_ Parameters ---------- - kcn : str - Coordinate system reference number. ``KCN`` may be 0,1,2 or any previously defined local - coordinate system number. If a cylinder is displayed in its cylindrical coordinate system (with - a 1,0,0 view), it will be unrolled (developed) into a flat plane (with theta along the Y - direction). + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is + blank. Notes ----- - .. _DSYS_notes: - - Boundary condition symbols, vector arrows, and element coordinate system triads are not transformed - to the display coordinate system. The display system orientation (for the default view) is X - horizontal to the right, Y vertical upward, and Z out of the screen (normal). - - Line directions and area directions ( :ref:`psymb`,LDIR and :ref:`psymb`,ADIR) are not plotted for - ``KCN`` >0. + .. _s-GRESUME_notes: - When you create 3D annotation, the coordinates are stored to the database in the display coordinate - system that was active at the time of creation. Changing the display coordinate system does not - change the annotation coordinate data in the database. + Causes a file to be read to reset the graphics slash (/) commands as they were at the last + :ref:`gsave` command. This command is valid in any processor. """ - command = f"DSYS,{kcn}" + command = f"/GRESUME,{fname},{ext}" return self.run(command, **kwargs) - def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): - r"""Provides PNG file export for Mechanical APDL displays. + def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): + r"""Controls the entities that the :ref:`gplot` command displays. - Mechanical APDL Command: `PNGR `_ + Mechanical APDL Command: `/GTYPE `_ Parameters ---------- - kywrd : str - Specifies various PNG file export options. + wn : str + Window number (or ALL) to which this command applies (defaults to 1) - * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` is either ON or OFF (blank is interpreted as OFF). - This option allows you to turn PNG file compression ON or OFF. If OPT = ON, then The VAL field is - read to determine the degree of compression. See the VALUE argument for acceptable compression - values. + label : str + This represents the type of entity to display: - * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire - plot. ``OPT`` can be either Horizontal (default) or Vertical. + * ``NODE`` - Nodes - * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color depth of the saved file. - ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), - respectively. + * ``ELEM`` - Elements - * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either - 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. + * ``KEYP`` - Keypoints - * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd - parameters listed above, are active. + * ``LINE`` - Lines - * ``STAT`` - Shows the current status of PNG file export. + * ``AREA`` - Areas - opt : str - ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + * ``VOLU`` - Volumes - * ``ON, OFF`` - If ``Kywrd`` = COMP, the values On and Off control the use of compression. The - degree of compression is determined by VAL + * ``GRPH`` - Graph displays - * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the - orientation of the plot. + key : int or str + Switch: - * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, - Grayscale and Color, respectively. + * ``0`` - Turns the entity type off. - * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) - fonts will be used + * ``1`` - Turns the entity type on. - val : int or str - ``VAL`` is active only when ``Kywrd`` = COMP, and determines the degree of compression applied to - the exported file (see above). + Notes + ----- - * ``-1`` - Apply the default, optimum value for compression. This value represents the best - combination of speed and compression. It varies according to the release level of the ZLIB - compression package. + .. _s-GTYPE_notes: - * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression - level (fastest) and 9 is the highest compression level (slowest). + The :ref:`gtype` command controls which entities the :ref:`gplot` command displays. NODE, ELEM, + KEYP, LINE, AREA, and VOLU are on by default. When ELEM is activated, you can control the type of + element displayed via the :ref:`gcmd` command (which also controls the type of graph display). When + the GRPH entity type is activated, all other entity types are deactivated. Conversely, when any of + the NODE, ELEM, KEYP, LINE, AREA, and VOLU entity types are active, the GRPH entity type is + deactivated. + + The :ref:`gtype` command gives you several options for multi-window layout: + + * One window + + * Two windows (left and right or top and bottom of the screen) + + * Three windows (two at the top and one at the bottom of the screen, or one top and two bottom + windows + + * Four windows (two at the top and two at the bottom) + + Once you choose a window layout, you can choose one of the following: multiple plots, replotting, or + no redisplay. + This command is valid in any processor. """ - command = f"PNGR,{kywrd},{opt},{val}" + command = f"/GTYPE,{wn},{label},{key}" return self.run(command, **kwargs) - def pstatus(self, wn: str = "", **kwargs): - r"""Displays the global or window display specifications. + def gfile(self, size: str = "", **kwargs): + r"""Specifies the pixel resolution on Z-buffered graphics files. - Mechanical APDL Command: `/PSTATUS `_ + Mechanical APDL Command: `/GFILE `_ Parameters ---------- - wn : str - Window number for status (defaults to global specifications). + size : str + Pixel resolution. Defaults to a pixel resolution of 800. Valid values are from 256 to 2400. Notes ----- - .. _s-PSTATUS_notes: + .. _s-GFILE_notes: - Displays the current global or window display specifications. Global display specifications are - common to all windows (e.g. :ref:`show`, etc.). Window display specifications are specific to one - window (e.g. :ref:`view`, :ref:`slashtype`, etc.). + Defines the pixel resolution on subsequently written graphics files (for example, JPEG, PNG, TIFF) + for software Z-buffered displays ( :ref:`slashtype` ). Lowering the pixel resolution produces a + fuzzier image; increasing the resolution produces a sharper image but takes a little longer. This command is valid in any processor. """ - command = f"/PSTATUS,{wn}" + command = f"/GFILE,{size}" return self.run(command, **kwargs) - def tiff(self, kywrd: str = "", opt: str = "", **kwargs): - r"""Provides TIFF file export for Mechanical APDL displays. + def gsave(self, fname: str = "", ext: str = "", **kwargs): + r"""Saves graphics settings to a file for later use. - Mechanical APDL Command: `TIFF `_ + Mechanical APDL Command: `/GSAVE `_ Parameters ---------- - kywrd : str - Specifies various TIFF file export options. - - * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` controls data compression for the output file. If - COMP = 0, then compression is off. If COMP = 1 (default), then compression is on. - - * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire - plot. ``OPT`` can be either Horizontal (default) or Vertical. - - * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color attribute of the saved - file. ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), - respectively. - - * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either - 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. - - * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd - parameters listed above, are active. + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. - opt : str - ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). + ext : str + Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is + blank. - * ``1 or 0`` - If ``Kywrd`` = COMP, a value or 1 (on) or 0 (off) will control compression for the - TIFF file. + Notes + ----- - * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the - orientation of the plot. + .. _s-GSAVE_notes: - * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, - Grayscale and Color, respectively. + This command does not save all graphics settings, but only those that may be reset by the + :ref:`slashreset` command. The database remains untouched. Use the :ref:`gresume` command to read + the file. Repeated use of the :ref:`gsave` command overwrites the previous data on the file. The + following commands are saved by :ref:`gsave` : - * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) - fonts will be used + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + This command is valid in any processor. """ - command = f"TIFF,{kywrd},{opt}" + command = f"/GSAVE,{fname},{ext}" return self.run(command, **kwargs) - def mrep( - self, - name: str = "", - arg1: str = "", - arg2: str = "", - arg3: str = "", - arg4: str = "", - arg5: str = "", - arg6: str = "", - arg7: str = "", - arg8: str = "", - arg9: str = "", - arg10: str = "", - arg11: str = "", - arg12: str = "", - arg13: str = "", - arg14: str = "", - arg15: str = "", - arg16: str = "", - arg17: str = "", - arg18: str = "", - **kwargs, - ): - r"""Enables you to reissue the graphics command macro "name" during a replot or zoom operation. + def graphics(self, key: str = "", **kwargs): + r"""Defines the type of graphics display. - Mechanical APDL Command: `/MREP `_ + Mechanical APDL Command: `/GRAPHICS `_ Parameters ---------- - name : str - The name identifying the macro file or macro block on a macro library file. The name can contain - up to eight characters maximum and must begin with a letter. - - arg1 : str - Values to be passed into the file or block. - - arg2 : str - Values to be passed into the file or block. - - arg3 : str - Values to be passed into the file or block. + key : str + Graphics key: - arg4 : str - Values to be passed into the file or block. + * ``FULL`` - Display all model geometry and results. - arg5 : str - Values to be passed into the file or block. + * ``POWER`` - Activate PowerGraphics (default when GUI is on). - arg6 : str - Values to be passed into the file or block. + Notes + ----- - arg7 : str - Values to be passed into the file or block. + .. _s-GRAPHICS_notes: - arg8 : str - Values to be passed into the file or block. + The :ref:`graphics` command specifies the type of graphics display. ``Key`` = POWER activates the + PowerGraphics capability. PowerGraphics offers faster plotting than the ``Key`` = FULL + option, and speeds up element, results, area, line, and volume displays. - arg9 : str - Values to be passed into the file or block. + The default PowerGraphics mode is enabled automatically when accessing the GUI. This action + supersedes all prior macros or start-up routines ( :file:`start.ans`, :file:`config.ans`, etc.). + Full graphics mode is accessed only by issuing :ref:`graphics`,FULL after the GUI is active. - arg10 : str - Values to be passed into the file or block. + Results values (both printed and plotted) may differ between the ``Key`` = FULL + and ``Key`` = POWER options because each option specifies a different set of data for + averaging and display. For ``Key`` = FULL, all element and results + values (interior and surface) are included. For ``Key`` = POWER, only + element and results values along the model exterior surface are processed. - arg11 : str - Values to be passed into the file or block. + When ``Key`` = FULL, it is possible to deselect an individual node, select all elements (including + the element that contains that node), and then perform postprocessing calculations on those elements + and have that unselected node not be considered in those calculations. If PowerGraphics is active, + however, postprocessing always displays based on selected elements. - arg12 : str - Values to be passed into the file or block. + If you have specified one facet per element edge for PowerGraphics displays (via the :ref:`efacet` + command or options from the General Postproc or Utility menu), PowerGraphics does not plot midside + nodes. ( :ref:`efacet` applies to element type displays only.) - arg13 : str - Values to be passed into the file or block. + Maximum values shown in plots can differ from printed maximum values. This is due to different + averaging schemes used for plotted and printed maximum values. - arg14 : str - Values to be passed into the file or block. + When using solution coordinate systems for results output ( :ref:`rsys`,SOLU) with PowerGraphics, + the deformed or displaced shape in a POST1 contour display can be unexpected (although the contours + are displayed in the expected colors). The program does not rotate displacement values (Ux,Uy,Uz) to + global; instead, the displacements (stored locally) are added directly to the global coordinates + (X,Y,Z). For example, if in PREP7 the nodes are rotated 90 degrees about the z axis and the global + Uy displacements are relatively large, the Ux values will be large, causing the model to display a + large deformation in the global X direction. - arg15 : str - Values to be passed into the file or block. + PowerGraphics displays do not average at geometric discontinuities. The printouts in PowerGraphics + will, however, provide averaging information at geometric discontinuities if the models do not + contain shell elements. Carefully inspect the data you obtain at geometric discontinuities. - arg16 : str - Values to be passed into the file or block. + PowerGraphics does not support the following diffusion analysis results: CONC, CG, DF, EPDI. - arg17 : str - Values to be passed into the file or block. + ``Key`` = FULL is not available for `XFEM-based crack-growth analysis + `_. - arg18 : str - Values to be passed into the file or block. + Excepting a few options, PowerGraphics supports these commands: - Notes - ----- + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. - .. _s-MREP_notes: + The following commands are executed via the ``Key`` = FULL option, + regardless of whether PowerGraphics is activated: - This command reissues the graphics command macro "name" during a replot operation ( :ref:`replot` ) - or a zoom ( :ref:`zoom` ) operation. The program passes the command macro arguments to the replot - and zoom feature for use by the graphics macro. You should place the ``s-MREP`` command at the end - of the graphics command macro, following the last graphics command within the macro, to enable the - replot or zoom feature. + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. """ - command = f"/MREP,{name},{arg1},{arg2},{arg3},,{arg4},{arg5},{arg6},{arg7},{arg8},{arg9},{arg10},{arg11},{arg12},{arg13},{arg14},{arg15},{arg16},{arg17},{arg18}" + command = f"/GRAPHICS,{key}" return self.run(command, **kwargs) - def color( + def gcmd( self, - lab: str = "", - clab: str = "", - n1: str = "", - n2: str = "", - ninc: str = "", + wn: str = "", + lab1: str = "", + lab2: str = "", + lab3: str = "", + lab4: str = "", + lab5: str = "", + lab6: str = "", + lab7: str = "", + lab8: str = "", + lab9: str = "", + lab10: str = "", + lab11: str = "", + lab12: str = "", **kwargs, ): - r"""Specifies the color mapping for various items. + r"""Controls the type of element or graph display used for the :ref:`gplot` command. - Mechanical APDL Command: `/COLOR `_ + Mechanical APDL Command: `/GCMD `_ - **Command default:** + Parameters + ---------- + wn : str + Window number (or ALL) to which this command applies (defaults to 1) - .. _s-COLOR_default: + lab1 : str + Command labels (for example, :ref:`plnsol`,S,X) - Use the default color mapping. + lab2 : str + Command labels (for example, :ref:`plnsol`,S,X) - Parameters - ---------- - lab : str - Apply color to the items specified by the following labels: + lab3 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``AXES`` - Determines the color (specified in next argument, ``Clab`` ) that the axes of a graph - will be plotted in. + lab4 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``AXNUM`` - Determines the color (specified in next argument, ``Clab`` ) that the numbering on the - axes of a graph will be plotted in. + lab5 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``NUM`` - Discretely numbered items (such as element types, element materials, etc., as shown on - the :ref:`pnum` command). Also specify number (1 to 11) in the ``N1`` field. For example, - :ref:`color`,NUM,RED,3 will assign the color red to all items having the discrete number 3 (material - displays would show elements having material 3 as red). + lab6 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``OUTL`` - Outline of elements, areas, and volumes. Ex: :ref:`color`,OUTL,BLUE. + lab7 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. + lab8 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``LINE`` - Solid model lines. Use ``N1``, ``N2``, ``NINC`` fields for line numbers. + lab9 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. + lab10 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. + lab11 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc.). This option is particularly useful - when capturing frames for animating a single isosurface value. + lab12 : str + Command labels (for example, :ref:`plnsol`,S,X) - * ``WBAK`` - Window background. Use ``N1``, ``N2``, ``NINC`` fields for window numbers. The options - that you select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. + Notes + ----- - * ``b.c.label`` - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, CURR, F, - M, HEAT, FLOW, VF, AMPS, FLUX, CSG, CURT, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See the - :ref:`pbc` command for boundary condition label definitions. + .. _s-GCMD_notes: - * ``GRBAK`` - Graph background. + This command controls the type of element or graph display that appears when you issue the + :ref:`gplot` command when the :ref:`gtype`,,(ELEM or GRPH) entity type is active. If you have + multiple plotting windows enabled, you can also use :ref:`gcmd` to select one window when you wish + to edit its contents. - * ``GRID`` - Graph grid lines. + For related information, see the descriptions of the :ref:`gplot` and :ref:`gtype` commands in this + manual. - * ``AXLAB`` - Graph X and Y axis labels. + This command is valid in any processor. + """ + command = f"/GCMD,{wn},{lab1},{lab2},{lab3},{lab4},{lab5},{lab6},{lab7},{lab8},{lab9},{lab10},{lab11},{lab12}" + return self.run(command, **kwargs) - * ``CURVE`` - Graph curves (identify curve numbers (1-10) in ``N1``, ``N2``, ``NINC`` fields). + def tiff(self, kywrd: str = "", opt: str = "", **kwargs): + r"""Provides TIFF file export for Mechanical APDL displays. - * ``CM`` - Component group. Use ``N1`` field for component name, ignore ``N2`` and ``NINC``. + Mechanical APDL Command: `TIFF `_ - * ``CNTR`` - Mechanical APDL contour stress colors. The maximum number of contours available is 128. The - number of colors that can be specified interactively (GUI) is 9. ( :ref:`contour`, 9). Any other - setting will yield inconsistent results. + Parameters + ---------- + kywrd : str + Specifies various TIFF file export options. - * ``SMAX`` - Specifies that all stress values above the maximum value entered in :ref:`contour` will - be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. + * ``COMP`` - If ``Kywrd`` = COMP, then ``OPT`` controls data compression for the output file. If + COMP = 0, then compression is off. If COMP = 1 (default), then compression is on. - * ``SMIN`` - Specifies that all stress values below the minimum value entered in :ref:`contour` will - be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. + * ``ORIENT`` - If ``Kywrd`` = ORIENT, then ``OPT`` will determine the orientation of the entire + plot. ``OPT`` can be either Horizontal (default) or Vertical. - * ``PBAK`` - Activates background shading options (see command syntax at end of argument - descriptions below). The options that you select using ``Lab`` = PBAK will supersede those applied - using ``Lab`` = WBAK. + * ``COLOR`` - If ``Kywrd`` = COLOR, then ``OPT`` will determine the color attribute of the saved + file. ``OPT`` can be 0, 1, or 2, corresponding to Black and White, Grayscale, and Color (default), + respectively. - clab : str - Valid color labels are: + * ``TMOD`` - If ``Kywrd`` = TMOD, then ``OPT`` will determine the text method. ``OPT`` can be either + 1 or 0, corresponding to bitmap text (default) or line stroke text, respectively. - * ``BLAC (0)`` - Black + * ``DEFAULT`` - If ``Kywrd`` = DEFAULT, then all of the default values, for all of the Kywrd + parameters listed above, are active. - * ``MRED (1)`` - Magenta-Red + opt : str + ``OPT`` can have the following names or values, depending on the value for ``Kywrd`` (see above). - * ``MAGE (2)`` - Magenta + * ``1 or 0`` - If ``Kywrd`` = COMP, a value or 1 (on) or 0 (off) will control compression for the + TIFF file. - * ``BMAG (3)`` - Blue-Magenta + * ``Horizontal, Vertical`` - If ``Kywrd`` = ORIENT, the terms Horizontal or Vertical determine the + orientation of the plot. - * ``BLUE (4)`` - Blue + * ``0, 1, 2`` - If ``Kywrd`` = COLOR, the numbers 0, 1, and 2 correspond to Black and White, + Grayscale and Color, respectively. - * ``CBLU (5)`` - Cyan-Blue + * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) + fonts will be used - * ``CYAN (6)`` - Cyan + """ + command = f"TIFF,{kywrd},{opt}" + return self.run(command, **kwargs) - * ``GCYA ((7)`` - Green-Cyan + def noerase(self, **kwargs): + r"""Prevents the screen erase between displays. - * ``GREE (8)`` - Green + Mechanical APDL Command: `/NOERASE `_ - * ``YGRE (9)`` - Yellow-Green + Notes + ----- - * ``YELL (10)`` - Yellow + .. _s-NOERASE_notes: - * ``ORAN (11)`` - Orange + Preventing the normal screen erase between requested displays allows you to overlay multiple views. - * ``RED (12)`` - Red + Clearing the screen with the ``ERASE`` command ( Utility Menu> PlotCtrls> Erase Options> Erase + screen ) active simply clears the display area. Subsequent replots will provide the cumulative plots + previously generated by the :ref:`noerase` command. - * ``DGRA (13)`` - Dark Gray + For 3D devices, you can issue :ref:`dv3d`,DELS to suppress repeated screen overlays and generate + clear contour plots. - * ``LGRA (14)`` - Light Gray + Use the ``/ERASE`` command to reactivate automatic screen erase. - * ``WHIT (15)`` - White + For 3D devices ( :ref:`show`,3D), the model in all active windows will be the same, even if you + issue a different display command ( :ref:`nplot`, :ref:`eplot`, etc.) for each active window. Use + the Multi-Plot command ( :ref:`gplot` ) to display different entities, in different windows, on 3D + devices. - n1 : str - Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of - ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` - is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical - picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities - via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + This command is valid in any processor. + """ + command = "/NOERASE" + return self.run(command, **kwargs) - n2 : str - Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of - ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` - is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical - picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities - via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + def replot(self, label: str = "", **kwargs): + r"""Reissues the last display command. - ninc : str - Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of - ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` - is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical - picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities - via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. + Mechanical APDL Command: `/REPLOT `_ - Notes - ----- + Parameters + ---------- + label : str + Controls the type of replot. - .. warning:: + * ``RESIZE`` - Issued internally when a graphics window resize occurs (Default). - This function contains specificities regarding the argument definitions. - Please refer to the `command documentation `_ - for further explanations. + * ``FAST`` - Only applicable for 3D devices that allow a fast redisplay for changes in the view + characteristics only. - .. _s-COLOR_notes: + Notes + ----- - Issue :ref:`color`,STAT to display the current color mapping. Issue :ref:`color`,DEFA to reset the - default color mapping. Color labels may also be reassigned any "color" with the :ref:`cmap` command. + .. _s-REPLOT_notes: - This command is valid anywhere. - """ - command = f"/COLOR,{lab},{clab},{n1},{n2},{ninc}" - return self.run(command, **kwargs) + Reissues the last display command ( :ref:`nplot`, :ref:`eplot`, :ref:`kplot`, :ref:`plnsol`, + :ref:`plvar`, etc.), along with its parameters, for convenience. The current display specifications + are used. + + When the last display command is invalid in a given processor, :ref:`replot` is also invalid in that + processor. However, if you attempt a :ref:`replot` and the last display command is invalid in the + current processor, Mechanical APDL generates an element display ( :ref:`eplot` ) instead, as long as + the + last display command was :ref:`plnsol`, :ref:`plesol`, or :ref:`pldisp`. - def cmap( - self, fname: str = "", ext: str = "", kywrd: str = "", ncntr: str = "", **kwargs - ): - r"""Changes an existing or creates a new color mapping table. + Example: :ref:`replot` Replaced by :ref:`eplot` Automatically - Mechanical APDL Command: `/CMAP `_ + :ref:`plnsol`, used to display solution results as continuous contours, is a valid command in the + POST1 general postprocessor. - **Command default:** + If you issue :ref:`plnsol` followed by :ref:`replot` while in POST1, :ref:`replot` effectively + reissues your earlier :ref:`plnsol` command, along with its parameters. - .. _s-CMAP_default: + If you then exit POST1, enter the PREP7 preprocessor, and again issue :ref:`replot`, the program + uses :ref:`eplot` internally instead. - Use predefined Mechanical APDL color map table. + The command substitution occurs because :ref:`plnsol` is not a valid command in PREP7. - Parameters - ---------- - fname : str - File name and directory path (248 characters maximum, including the characters needed for the - directory path). An unspecified directory path defaults to the working directory; in this case, - you can use all 248 characters for the file name. If blank, restore color map. + When you click one of the buttons on the `Pan, Zoom, Rotate + `_ + dialog box to manipulate the view of a model, :ref:`replot` is issued internally. Thus, the + substitution of :ref:`replot` with :ref:`eplot` as described above may also occur for operations + that you perform via with the `Pan, Zoom, Rotate + `_ + dialog box. - ext : str - Filename extension (eight-character maximum). + :ref:`replot` does not show boundary conditions if they are applied only to a solid model and the + last display command (such as :ref:`eplot` ) displays the finite element model. To show boundary + conditions, the following options are available: - kywrd : str - Keyword indicating the disposition of the color map file. + * Issue :ref:`replot` after you issue :ref:`sbctran` to transfer solid model boundary conditions to + the finite element model. - * ``(blank)`` - Loads existing color map file. + * Issue :ref:`replot` after you issue a solid model display command (such as :ref:`vplot` ). - * ``CREATE`` - Starts the CMAP utility and modifies or creates the specified file. + This command is valid in any processor (except as noted above). + """ + command = f"/REPLOT,{label}" + return self.run(command, **kwargs) - * ``SAVE`` - Writes the active color map to the specified file, which can be imported into future - sessions. + def slashreset(self, **kwargs): + r"""Resets display specifications to their initial defaults. - ncntr : str - Number of contours to be defined. Default = 9 (even if an existing file is being modified). - Maximum = 128. + Mechanical APDL Command: `/RESET `_ Notes ----- - .. _s-CMAP_notes: - - Reads the color map file (RGB index specifications) to change from current specifications. Only one - color map may be active at a time. - - For 2D drivers (especially Win32c), modifying the color map can produce anomalies, including - legend/contour disagreement. - - When ``Kywrd`` equals CREATE, the 2D drivers (X11c and Win32c) display the CMAP utility with an - additional contour color picker called CONTOURS. Colors selected via the CONTOURS picker affect - result contour displays (such as stresses). No other drivers offer the CONTOURS picker in the CMAP - utility. + .. _s-RESET_notes: - Changing the color map using the :ref:`cmap` command changes the meaning of the color labels on the - :ref:`color` command. See :ref:`color` for other color controls. + Resets slash display specifications ( :ref:`window`, :ref:`slashtype`, :ref:`view`, etc.) back to + their initial default settings (for convenience). Also resets the focus location to the geometric + center of the object. - This command is valid anywhere. + This command is valid in any processor. """ - command = f"/CMAP,{fname},{ext},,{kywrd},{ncntr}" + command = "/RESET" return self.run(command, **kwargs) def window( @@ -906,618 +792,587 @@ def window( command = f"/WINDOW,{wn},{xmin},{xmax},{ymin},{ymax},{ncopy}" return self.run(command, **kwargs) - def slashreset(self, **kwargs): - r"""Resets display specifications to their initial defaults. + def image(self, label: str = "", fname: str = "", ext: str = "", **kwargs): + r"""Allows graphics data to be captured and saved. - Mechanical APDL Command: `/RESET `_ + Mechanical APDL Command: `/IMAGE `_ - Notes - ----- + Parameters + ---------- + label : str + Label specifying the operation to be performed: - .. _s-RESET_notes: + * ``CAPTURE`` - Capture the image from the graphics window to a new window. - Resets slash display specifications ( :ref:`window`, :ref:`slashtype`, :ref:`view`, etc.) back to - their initial default settings (for convenience). Also resets the focus location to the geometric - center of the object. + * ``RESTORE`` - Restore the image from a file to a new window. - This command is valid in any processor. + * ``SAVE`` - Save the contents of the graphic window to a file. + + * ``DELETE`` - Delete the window that contains the file. + + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. + + ext : str + Filename extension (eight-character maximum). If no extension is specified, :file:`bmp` will be + used on Windows systems, and :file:`img` will be used on Linux systems. """ - command = "/RESET" + command = f"/IMAGE,{label},{fname},{ext}" return self.run(command, **kwargs) - def replot(self, label: str = "", **kwargs): - r"""Reissues the last display command. + def immed(self, key: int | str = "", **kwargs): + r"""Allows immediate display of a model as it is generated. - Mechanical APDL Command: `/REPLOT `_ + Mechanical APDL Command: `IMMED `_ Parameters ---------- - label : str - Controls the type of replot. + key : int or str + Immediate mode key: - * ``RESIZE`` - Issued internally when a graphics window resize occurs (Default). + * ``0`` - Display only upon request, that is, no immediate display (default with the GUI off ). - * ``FAST`` - Only applicable for 3D devices that allow a fast redisplay for changes in the view - characteristics only. + * ``1`` - Display immediately as model is generated (default with the GUI on ). Notes ----- - .. _s-REPLOT_notes: + .. _IMMED_notes: - Reissues the last display command ( :ref:`nplot`, :ref:`eplot`, :ref:`kplot`, :ref:`plnsol`, - :ref:`plvar`, etc.), along with its parameters, for convenience. The current display specifications - are used. + The command enables you to control whether or not the model is displayed immediately as it is + generated in an interactive session. Available only during an interactive session at a graphics + display terminal. A valid graphics device name must first be specified ( :ref:`show` ). - When the last display command is invalid in a given processor, :ref:`replot` is also invalid in that - processor. However, if you attempt a :ref:`replot` and the last display command is invalid in the - current processor, Mechanical APDL generates an element display ( :ref:`eplot` ) instead, as long as - the - last display command was :ref:`plnsol`, :ref:`plesol`, or :ref:`pldisp`. + By default in the GUI, your model is immediately displayed in the Graphics window as you create new + entities (such as areas, keypoints, nodes, elements, local coordinate systems, boundary conditions, + etc.), referred to as immediate mode graphics. - Example: :ref:`replot` Replaced by :ref:`eplot` Automatically + Symbols (such as boundary conditions, local coordinate system triads, etc.) appear immediately and + are present on subsequent displays unless you disable the appropriate symbol (via the GUI plot + controls function or the appropriate graphics-specification command). - :ref:`plnsol`, used to display solution results as continuous contours, is a valid command in the - POST1 general postprocessor. + An immediate image is also scaled automatically to fit within the Graphics window. The new scaling + is usually apparent on the automatic replot associated with immediate mode. To suppress automatic + replot, issue :ref:`uis`,REPLOT,0. (With automatic replot suppressed, the immediate image may not + always be scaled correctly.) - If you issue :ref:`plnsol` followed by :ref:`replot` while in POST1, :ref:`replot` effectively - reissues your earlier :ref:`plnsol` command, along with its parameters. + An immediate display in progress should not be aborted with the usual system "break" feature (or + else the Mechanical APDL session itself terminates). When you run Mechanical APDL interactively + without using the + GUI, immediate mode is off by default. - If you then exit POST1, enter the PREP7 preprocessor, and again issue :ref:`replot`, the program - uses :ref:`eplot` internally instead. + This command is valid only in PREP7. + """ + command = f"IMMED,{key}" + return self.run(command, **kwargs) - The command substitution occurs because :ref:`plnsol` is not a valid command in PREP7. + def cmap( + self, fname: str = "", ext: str = "", kywrd: str = "", ncntr: str = "", **kwargs + ): + r"""Changes an existing or creates a new color mapping table. - When you click one of the buttons on the `Pan, Zoom, Rotate - `_ - dialog box to manipulate the view of a model, :ref:`replot` is issued internally. Thus, the - substitution of :ref:`replot` with :ref:`eplot` as described above may also occur for operations - that you perform via with the `Pan, Zoom, Rotate - `_ - dialog box. + Mechanical APDL Command: `/CMAP `_ - :ref:`replot` does not show boundary conditions if they are applied only to a solid model and the - last display command (such as :ref:`eplot` ) displays the finite element model. To show boundary - conditions, the following options are available: + **Command default:** - * Issue :ref:`replot` after you issue :ref:`sbctran` to transfer solid model boundary conditions to - the finite element model. + .. _s-CMAP_default: - * Issue :ref:`replot` after you issue a solid model display command (such as :ref:`vplot` ). + Use predefined Mechanical APDL color map table. - This command is valid in any processor (except as noted above). - """ - command = f"/REPLOT,{label}" - return self.run(command, **kwargs) + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. If blank, restore color map. - def noerase(self, **kwargs): - r"""Prevents the screen erase between displays. + ext : str + Filename extension (eight-character maximum). - Mechanical APDL Command: `/NOERASE `_ + kywrd : str + Keyword indicating the disposition of the color map file. + + * ``(blank)`` - Loads existing color map file. + + * ``CREATE`` - Starts the CMAP utility and modifies or creates the specified file. + + * ``SAVE`` - Writes the active color map to the specified file, which can be imported into future + sessions. + + ncntr : str + Number of contours to be defined. Default = 9 (even if an existing file is being modified). + Maximum = 128. Notes ----- - .. _s-NOERASE_notes: + .. _s-CMAP_notes: - Preventing the normal screen erase between requested displays allows you to overlay multiple views. + Reads the color map file (RGB index specifications) to change from current specifications. Only one + color map may be active at a time. - Clearing the screen with the ``ERASE`` command ( Utility Menu> PlotCtrls> Erase Options> Erase - screen ) active simply clears the display area. Subsequent replots will provide the cumulative plots - previously generated by the :ref:`noerase` command. + For 2D drivers (especially Win32c), modifying the color map can produce anomalies, including + legend/contour disagreement. + + When ``Kywrd`` equals CREATE, the 2D drivers (X11c and Win32c) display the CMAP utility with an + additional contour color picker called CONTOURS. Colors selected via the CONTOURS picker affect + result contour displays (such as stresses). No other drivers offer the CONTOURS picker in the CMAP + utility. + + Changing the color map using the :ref:`cmap` command changes the meaning of the color labels on the + :ref:`color` command. See :ref:`color` for other color controls. + + This command is valid anywhere. + """ + command = f"/CMAP,{fname},{ext},,{kywrd},{ncntr}" + return self.run(command, **kwargs) + + def color( + self, + lab: str = "", + clab: str = "", + n1: str = "", + n2: str = "", + ninc: str = "", + **kwargs, + ): + r"""Specifies the color mapping for various items. + + Mechanical APDL Command: `/COLOR `_ + + **Command default:** + + .. _s-COLOR_default: + + Use the default color mapping. + + Parameters + ---------- + lab : str + Apply color to the items specified by the following labels: - For 3D devices, you can issue :ref:`dv3d`,DELS to suppress repeated screen overlays and generate - clear contour plots. + * ``AXES`` - Determines the color (specified in next argument, ``Clab`` ) that the axes of a graph + will be plotted in. - Use the ``/ERASE`` command to reactivate automatic screen erase. + * ``AXNUM`` - Determines the color (specified in next argument, ``Clab`` ) that the numbering on the + axes of a graph will be plotted in. - For 3D devices ( :ref:`show`,3D), the model in all active windows will be the same, even if you - issue a different display command ( :ref:`nplot`, :ref:`eplot`, etc.) for each active window. Use - the Multi-Plot command ( :ref:`gplot` ) to display different entities, in different windows, on 3D - devices. + * ``NUM`` - Discretely numbered items (such as element types, element materials, etc., as shown on + the :ref:`pnum` command). Also specify number (1 to 11) in the ``N1`` field. For example, + :ref:`color`,NUM,RED,3 will assign the color red to all items having the discrete number 3 (material + displays would show elements having material 3 as red). - This command is valid in any processor. - """ - command = "/NOERASE" - return self.run(command, **kwargs) + * ``OUTL`` - Outline of elements, areas, and volumes. Ex: :ref:`color`,OUTL,BLUE. - def show( - self, - fname: str = "", - option: str = "", - vect: int | str = "", - ncpl: str = "", - **kwargs, - ): - r"""Specifies the device and other parameters for graphics displays. + * ``ELEM`` - Elements. Use ``N1``, ``N2``, ``NINC`` fields for element numbers. - Mechanical APDL Command: `/SHOW `_ + * ``LINE`` - Solid model lines. Use ``N1``, ``N2``, ``NINC`` fields for line numbers. - Parameters - ---------- - fname : str - Device name, file name, or keyword, as listed below: + * ``AREA`` - Solid model areas. Use ``N1``, ``N2``, ``NINC`` fields for area numbers. - * ``<, device name >`` - Any valid graphics display device name (for example, X11, 3D etc.). - Defaults to X11 for most systems. See `Getting Started with Graphics - `_ in the `Basic Analysis Guide `_ - for details. A device name must be defined before activating the Graphical User Interface (GUI). - Once the GUI is activated, the device name cannot be changed for that session, except for switching - between X11 and X11C. + * ``VOLU`` - Solid model volumes. Use ``N1``, ``N2``, ``NINC`` fields for volume numbers. - * ``TERM`` - Graphics displays are switched back to the last-specified device name. + * ``ISURF`` - Isosurfaces (surfaces of constant stress, etc.). This option is particularly useful + when capturing frames for animating a single isosurface value. - * ``CLOSE`` - This option purges the graphics file buffer. The CLOSE option should be issued any - time you are changing graphics devices or file output types during a session. Graphics displays are - switched back to the last-specified device name, and any open graphics files are closed. The CLOSE - option is similar to the TERM option, however, with the CLOSE option, another process can access the - data in the graphics file. The CLOSE option causes graphics file buffers to be flushed to the - graphics file. + * ``WBAK`` - Window background. Use ``N1``, ``N2``, ``NINC`` fields for window numbers. The options + that you select using ``Lab`` = PBAK will supersede those applied using ``Lab`` = WBAK. - * ``OFF`` - Graphics display requests are ignored. + * ``b.c.label`` - Boundary condition label. Enter U, ROT, TEMP, PRES, V, VOLT, MAG, A, EMF, CURR, F, + M, HEAT, FLOW, VF, AMPS, FLUX, CSG, CURT, MAST, CP, CE, NFOR, NMOM, RFOR, RMOM, PATH. See the + :ref:`pbc` command for boundary condition label definitions. - * ``(blank)`` - If blank in interactive mode, graphics will be displayed on screen as requested by - display commands (no file written). + * ``GRBAK`` - Graph background. - * ``JPEG`` - Creates JPEG files that are named :file:`Jobname` nnn.jpg, where ``nnn`` is a numeric - value that is incremented by one as each additional file is created; that is, - :file:`Jobname000.jpg`, :file:`Jobname001.jpg`, :file:`Jobname002.jpg`, and so on. Ignores the - ``Ext`` field. + * ``GRID`` - Graph grid lines. - * ``TIFF`` - Creates tagged image format files that are named :file:`Jobname` nnn.tif, where ``nnn`` - is a numeric value that is incremented by one as each additional file is created; that is, - :file:`Jobname000.tif`, :file:`Jobname001.tif`, :file:`Jobname002.tif`, and so on. This value for - the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`tiff` command for options.) + * ``AXLAB`` - Graph X and Y axis labels. - * ``PNG`` - Creates PNG (Portable Network Graphics) files that are named :file:`Jobname` nnn.png, - where ``nnn`` is a numeric value that is incremented by one as each additional file is created; that - is, :file:`Jobname000.png`, :file:`Jobname001.png`, :file:`Jobname002.png`, and so on. This value - for the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`pngr` command for options.) + * ``CURVE`` - Graph curves (identify curve numbers (1-10) in ``N1``, ``N2``, ``NINC`` fields). - * ``VRML`` - Creates Virtual Reality Meta Language files named :file:`Jobname000.wrl` that can be - displayed on 3D Internet web browsers. Ignores the ``Ext`` and ``NCPL`` fields. + * ``CM`` - Component group. Use ``N1`` field for component name, ignore ``N2`` and ``NINC``. - option : str - Assign a file name extension or specify reverse video output: + * ``CNTR`` - Mechanical APDL contour stress colors. The maximum number of contours available is 128. The + number of colors that can be specified interactively (GUI) is 9. ( :ref:`contour`, 9). Any other + setting will yield inconsistent results. - * ``Ext`` - File name extension (eight-character maximum). + * ``SMAX`` - Specifies that all stress values above the maximum value entered in :ref:`contour` will + be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. - * ``REV`` - Reverse background/image (black/white) colors. Valid with ``Fname`` = PNG (recommended), - JPEG, and TIFF. This option is ignored if a previously specified color map table ( :ref:`cmap` or - :ref:`rgb` ) is in effect. + * ``SMIN`` - Specifies that all stress values below the minimum value entered in :ref:`contour` will + be displayed in the color designated in the ``Clab`` field. Defaults to dark grey. - vect : int or str - Specifies raster or vector display mode. This affects area, volume, and element displays, as well as - geometric results displays such as contour plots. See the :ref:`device` command for an alternate way to toggle between raster and vector mode. Changing ``VECT`` also resets the :ref:`slashtype` command to its default. + * ``PBAK`` - Activates background shading options (see command syntax at end of argument + descriptions below). The options that you select using ``Lab`` = PBAK will supersede those applied + using ``Lab`` = WBAK. - * ``0`` - Raster display (color filled entities; default) + clab : str + Valid color labels are: - * ``1`` - Vector display (outlined entities; that is, "wireframe") + * ``BLAC (0)`` - Black - ncpl : str - Sets the number of color planes (4 to 8). Default is device-dependent. ``NCPL`` is not supported - by all graphics devices. + * ``MRED (1)`` - Magenta-Red - Notes - ----- + * ``MAGE (2)`` - Magenta - .. _s-SHOW_notes: + * ``BMAG (3)`` - Blue-Magenta - Specifies the device to be used for graphics displays, and specifies other graphics display - parameters. Display may be shown at the time of generation (for interactive runs at a graphics - display terminal) or diverted to a file. Issue :ref:`pstatus` for display status. + * ``BLUE (4)`` - Blue - Batch runs do not have access to the fonts available on your system. The Courier and Helvetica font - files used for JPEG, PNG and TIFF batch output are copyrighted by Adobe Systems Inc. and Digital - Equipment Corp. Permission to use these trademarks is hereby granted only in association with the - images described above. Batch run JPEG output is produced at the default quality index value of 75, - unless specified otherwise. + * ``CBLU (5)`` - Cyan-Blue - Interactive displays default to eight color planes ( ``NCPL`` = 8) for most monitors, while graph - file output defaults to eight color planes for VRML output, and four color planes for JPEG, PNG, and - TIFF. + * ``CYAN (6)`` - Cyan - This command is valid in any processor. - """ - command = f"/SHOW,{fname},{option},{vect},{ncpl}" - return self.run(command, **kwargs) + * ``GCYA ((7)`` - Green-Cyan - def seg(self, label: str = "", aviname: str = "", delay: str = "", **kwargs): - r"""Allows graphics data to be stored in the local terminal memory. + * ``GREE (8)`` - Green - Mechanical APDL Command: `/SEG `_ + * ``YGRE (9)`` - Yellow-Green - Parameters - ---------- - label : str - Storage key: + * ``YELL (10)`` - Yellow - * ``SINGL`` - Store subsequent display in a single segment (overwrites last storage). + * ``ORAN (11)`` - Orange - * ``MULTI`` - Store subsequent displays in unique segments ( :ref:`anim` ). + * ``RED (12)`` - Red - * ``DELET`` - Delete all currently stored segments. + * ``DGRA (13)`` - Dark Gray - * ``OFF`` - Stop storing display data in segments. + * ``LGRA (14)`` - Light Gray - * ``STAT`` - Display segment status. + * ``WHIT (15)`` - White - * ``PC`` - This option only applies to PC versions of Mechanical APDL and only when animating via the AVI - movie player ( :ref:`device`,ANIM,2). The command appends frames to the :file:`File.AVI`, so that - the animation goes in both directions (that is, forward--backward--forward). You must have a current - animation file to use this option. + n1 : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. - aviname : str - Name of the animation file that will be created when each frame is saved. The :file:`.AVI` - extension is applied automatically. Defaults to :file:`Jobname.AVI` if no filename is specified. + n2 : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. - delay : str - Delay factor between each frame, in seconds. Defaults to 0.015 seconds if no value is specified. + ninc : str + Apply color to ``Lab`` items numbered ``N1`` to ``N2`` (defaults to ``N1`` ) in steps of + ``NINC`` (defaults to 1). If ``N1`` is blank, apply color to entire selected range. If ``Lab`` + is CM, use component name for ``N1`` and ignore ``N2`` and ``NINC``. If ``N1`` = P, graphical + picking of elements, lines, areas and volumes is enabled; your can assign colors to the entities + via the picker. When picking is enabled, the ``Lab`` and ``Clab`` fields are ignored. Notes ----- - .. _s-SEG_notes: + .. warning:: - Allows graphics data to be stored in the terminal local memory (device-dependent). Storage occurs - concurrently with the display. + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. - Although the information from your graphics window is stored as an individual segment, you cannot - plot directly ( :ref:`gplot` ) from the segment memory. + .. _s-COLOR_notes: - This command is valid in any processor. + Issue :ref:`color`,STAT to display the current color mapping. Issue :ref:`color`,DEFA to reset the + default color mapping. Color labels may also be reassigned any "color" with the :ref:`cmap` command. + + This command is valid anywhere. """ - command = f"/SEG,{label},{aviname},{delay}" + command = f"/COLOR,{lab},{clab},{n1},{n2},{ninc}" return self.run(command, **kwargs) - def gsave(self, fname: str = "", ext: str = "", **kwargs): - r"""Saves graphics settings to a file for later use. + def dsys(self, kcn: str = "", **kwargs): + r"""Activates a display coordinate system for geometry listings and plots. - Mechanical APDL Command: `/GSAVE `_ + Mechanical APDL Command: `DSYS `_ + + **Command default:** + + .. _DSYS_default: + + Global Cartesian ( ``KCN`` = 0) display coordinate system. Parameters ---------- - fname : str - File name and directory path (248 characters maximum, including the characters needed for the - directory path). An unspecified directory path defaults to the working directory; in this case, - you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. - - ext : str - Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is - blank. + kcn : str + Coordinate system reference number. ``KCN`` may be 0,1,2 or any previously defined local + coordinate system number. If a cylinder is displayed in its cylindrical coordinate system (with + a 1,0,0 view), it will be unrolled (developed) into a flat plane (with theta along the Y + direction). Notes ----- - .. _s-GSAVE_notes: + .. _DSYS_notes: - This command does not save all graphics settings, but only those that may be reset by the - :ref:`slashreset` command. The database remains untouched. Use the :ref:`gresume` command to read - the file. Repeated use of the :ref:`gsave` command overwrites the previous data on the file. The - following commands are saved by :ref:`gsave` : + Boundary condition symbols, vector arrows, and element coordinate system triads are not transformed + to the display coordinate system. The display system orientation (for the default view) is X + horizontal to the right, Y vertical upward, and Z out of the screen (normal). + + Line directions and area directions ( :ref:`psymb`,LDIR and :ref:`psymb`,ADIR) are not plotted for + ``KCN`` >0. - InformalTables need to be added. + When you create 3D annotation, the coordinates are stored to the database in the display coordinate + system that was active at the time of creation. Changing the display coordinate system does not + change the annotation coordinate data in the database. This command is valid in any processor. """ - command = f"/GSAVE,{fname},{ext}" + command = f"DSYS,{kcn}" return self.run(command, **kwargs) - def gtype(self, wn: str = "", label: str = "", key: int | str = "", **kwargs): - r"""Controls the entities that the :ref:`gplot` command displays. - - Mechanical APDL Command: `/GTYPE `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which this command applies (defaults to 1) - - label : str - This represents the type of entity to display: - - * ``NODE`` - Nodes - - * ``ELEM`` - Elements - - * ``KEYP`` - Keypoints + def device(self, label: str = "", key: int | str = "", **kwargs): + r"""Controls graphics device options. - * ``LINE`` - Lines + Mechanical APDL Command: `/DEVICE `_ - * ``AREA`` - Areas + **Command default:** - * ``VOLU`` - Volumes + .. _s-DEVICE_default: - * ``GRPH`` - Graph displays + Vector mode off (that is, raster mode); dithering on. - key : int or str - Switch: + Parameters + ---------- + label : str + Device function label: - * ``0`` - Turns the entity type off. + * ``BBOX`` - Bounding box mode. For PowerGraphics plots involving elements with :ref:`show`,x11 and + :ref:`show`,win32, Mechanical APDL generally displays dynamic rotations faster. If KEY = 1 (ON), then a + bounding box (not the elements) encompassing the model is displayed and rotated, rather than the + element outlines (ON is default in preprocessing). When KEY = 0 (OFF), then dynamic rotations may be + slower (Mechanical APDL redraws the element outlines) for plots involving elements with :ref:`show`,x11 and + :ref:`show`,win32. OFF is default in postprocessing. This command is ignored if :ref:`edge`,WN,1 is + set for any WN. This is ignored in POST1 and SOLUTION plots. - * ``1`` - Turns the entity type on. + For any PowerGraphics plots involving elements, regardless of :ref:`show` settings, plots will + generally be displayed faster. - Notes - ----- + * ``VECTOR`` - Vector mode. In vector mode, areas, volumes, elements, and postprocessing display + geometries are shown as outlines (wireframes). When vector mode is off (default), these entities are + shown filled with color. - .. _s-GTYPE_notes: + * ``DITHER`` - When dithering is turned on (default), color intensity transitions are smoothed. This + selection a - The :ref:`gtype` command controls which entities the :ref:`gplot` command displays. NODE, ELEM, - KEYP, LINE, AREA, and VOLU are on by default. When ELEM is activated, you can control the type of - element displayed via the :ref:`gcmd` command (which also controls the type of graph display). When - the GRPH entity type is activated, all other entity types are deactivated. Conversely, when any of - the NODE, ELEM, KEYP, LINE, AREA, and VOLU entity types are active, the GRPH entity type is - deactivated. + applies only to smooth-shaded images, that is, Z-buffered ( :ref:`slashtype` ), or raster plots with + Gouraud or Phong shading ( :ref:`shade` ). - The :ref:`gtype` command gives you several options for multi-window layout: + * ``ANIM`` - Select the animation type used on 2D devices on the PC platform. A ``KEY`` value of BMP + (or 0) sets animation mode to the Mechanical APDL animation controller (default). A ``KEY`` value of AVI + (or 2) sets animation mode to AVI movie player file. - * One window + * ``FONT`` - Font selection for the Mechanical APDL graphics window. When ``Label`` = FONT, the command format is: + :ref:`device`,FONT, ``KEY``, ``Val1``, ``Val2``, ``Val3``, ``Val4``, ``Val5``, ``Val6`` where + ``KEY`` determines the type of font being controlled, and values 1 through 6 control various font + parameters. These values are device specific; using the same command input file ( :ref:`input` ) on + different machines may yield different results.. The following ``KEY`` values determine the font + information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, + JPEG....): - * Two windows (left and right or top and bottom of the screen) + * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. - * Three windows (two at the top and one at the bottom of the screen, or one top and two bottom - windows + * ``KEY = 2`` - The command controls the ENTITY (node and keypoint number) font. - * Four windows (two at the top and two at the bottom) + * ``KEY = 3`` - The command controls the ANNOTATION/GRAPH font. - Once you choose a window layout, you can choose one of the following: multiple plots, replotting, or - no redisplay. + Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 + are character strings; value 4 is a nonzero integer: - This command is valid in any processor. - """ - command = f"/GTYPE,{wn},{label},{key}" - return self.run(command, **kwargs) + * ``Val1`` - Family name (for example, Courier). If ``Val1`` = MENU, all other values are ignored + and a font selection menu appears (GUI must be active). - def gcolumn(self, curve: str = "", string: str = "", **kwargs): - r"""Allows the user to apply a label to a specified curve. + * ``Val2`` - Weight (for example, medium) - Mechanical APDL Command: `/GCOLUMN `_ + * ``Val3`` - Slant (for example, r) - Parameters - ---------- - curve : str - Curve number on which label will be applied (integer value between 1 and 10). + * ``Val4`` - Pixel size (for example, 14). Note that this value does no affect the annotation fonts + ( ``KEY`` = 3). Use the :ref:`tspec` command for annotation font size. - string : str - Name or designation that will be applied to the curve (8 characters max). + * ``Val5`` - unused - Notes - ----- + * ``Val6`` - unused - .. _s-GCOLUMN_notes: + PC: The values are encoded in a PC logical font structure. Value 1 is a character string, and the + remaining values are integers: - This command is used for an array parameter plot (a plot created by the :ref:`starvplot` command). - Normally the label for curve 1 is COL 1, the label for curve 2 is COL 2 and so on; the column number - is the field containing the dependent variables for that particular curve. Issuing :ref:`gcolumn`, - ``CURVE``, with no string value specified resets the label to the original value. - """ - command = f"/GCOLUMN,{curve},{string}" - return self.run(command, **kwargs) + * ``Val1`` - Family name (for example, Courier\2New) Substitute an asterisk (\2) for any blank + character that appears in a family name. If ``Val1`` = MENU, all other values are ignored and a font + selection menu appears (GUI must be active). When this value is blank, Mechanical APDL uses the first + available resource it finds. - def gfile(self, size: str = "", **kwargs): - r"""Specifies the pixel resolution on Z-buffered graphics files. + * ``Val2`` - Weight (0 - 1000) - Mechanical APDL Command: `/GFILE `_ + * ``Val3`` - Orientation (in tenths of a degree) - Parameters - ---------- - size : str - Pixel resolution. Defaults to a pixel resolution of 800. Valid values are from 256 to 2400. + * ``Val4`` - Height (in logical units) - Notes - ----- + * ``Val5`` - Width (in logical units) - .. _s-GFILE_notes: + * ``Val6`` - Italics (0 = OFF, 1 = ON) - Defines the pixel resolution on subsequently written graphics files (for example, JPEG, PNG, TIFF) - for software Z-buffered displays ( :ref:`slashtype` ). Lowering the pixel resolution produces a - fuzzier image; increasing the resolution produces a sharper image but takes a little longer. + * ``TEXT`` - Text size specification for the Mechanical APDL graphics window. Using this label with the + :ref:`device` command requires the following form: :ref:`device`,TEXT, ``KEY``, ``PERCENT``. ``KEY`` + = 1 for LEGEND fonts; ``KEY`` = 2 for ENTITY fonts. ``PERCENT`` specifies the new text size as a + percent of the default text size. If ``PERCENT`` = 100, the new text size is precisely the default + size. If ``PERCENT`` = 200, the new text size is twice the default text size. - This command is valid in any processor. - """ - command = f"/GFILE,{size}" - return self.run(command, **kwargs) + key : int or str + Control key: - def gresume(self, fname: str = "", ext: str = "", **kwargs): - r"""Sets graphics settings to the settings on a file. + * ``OFF or 0`` - Turns specified function off. - Mechanical APDL Command: `/GRESUME `_ + * ``ON or 1`` - Turns specified function on or designates the LEGEND font. - Parameters - ---------- - fname : str - File name and directory path (248 characters maximum, including the characters needed for the - directory path). An unspecified directory path defaults to the working directory; in this case, - you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + * ``2`` - Designates the ENTITY font. - ext : str - Filename extension (eight-character maximum). The extension defaults to GSAV if ``Fname`` is - blank. + * ``3`` - Designates the ANNOTATION/GRAPH font. Notes ----- - .. _s-GRESUME_notes: - - Causes a file to be read to reset the graphics slash (/) commands as they were at the last - :ref:`gsave` command. + .. _s-DEVICE_notes: This command is valid in any processor. + + The :ref:`device`,BBOX command is ignored in POST1 and SOLUTION plots. Also, the elements are + displayed and rotated if you use :ref:`device`,BBOX,ON and :ref:`edge`,WN,1,ANGLE (effectively + ignoring the BBOX option). """ - command = f"/GRESUME,{fname},{ext}" + command = f"/DEVICE,{label},{key}" return self.run(command, **kwargs) - def gcmd( - self, - wn: str = "", - lab1: str = "", - lab2: str = "", - lab3: str = "", - lab4: str = "", - lab5: str = "", - lab6: str = "", - lab7: str = "", - lab8: str = "", - lab9: str = "", - lab10: str = "", - lab11: str = "", - lab12: str = "", - **kwargs, - ): - r"""Controls the type of element or graph display used for the :ref:`gplot` command. + def dv3d(self, lab: str = "", key: int | str = "", **kwargs): + r"""Sets 3D device option modes. - Mechanical APDL Command: `/GCMD `_ + Mechanical APDL Command: `/DV3D `_ Parameters ---------- - wn : str - Window number (or ALL) to which this command applies (defaults to 1) - - lab1 : str - Command labels (for example, :ref:`plnsol`,S,X) - - lab2 : str - Command labels (for example, :ref:`plnsol`,S,X) - - lab3 : str - Command labels (for example, :ref:`plnsol`,S,X) - - lab4 : str - Command labels (for example, :ref:`plnsol`,S,X) - - lab5 : str - Command labels (for example, :ref:`plnsol`,S,X) - - lab6 : str - Command labels (for example, :ref:`plnsol`,S,X) + lab : str + Mode label: - lab7 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``ACCU`` - Activating the accumulation buffer for OpenGL graphics, providing faster model rotation + when shaded backgrounds are in use. This feature is off by default. - lab8 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``ACTR`` - Label term to designate the cursor position as the center for automatic dynamic + rotational center capability. The subsequent ``Key`` value (see below) turns this capability on and + off. This feature is on by default. (Available for OpenGL displays only.) - lab9 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``ANIM`` - Animation mode. The ANIM option allows you to create animation frames in pixmap mode + instead of display list mode. This may improve large model performance, but it eliminates local + manipulation while animation is in progress. This feature is on by default. - lab10 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``ANTI`` - Label term to control Anti-aliasing, a smoothing technique for your graph plots. (see + below) The subsequent ``Key`` value turns this capability on and off. The default for this feature + is off. (Available for OpenGL displays only). - lab11 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``CNTR`` - Switches banded contours on (1) or off (0) for your 3D contour display. The default is + 1 (ON). Other contour parameters such as number of contours or the increment and range are defined + using the :ref:`contour` command. When either 9 or 128 contours are specified via :ref:`contour`, + this command is ignored and a smooth contour is always displayed. - lab12 : str - Command labels (for example, :ref:`plnsol`,S,X) + * ``DGEN`` - Local manipulation degenerate mode. You access the DGEN option to set wire-frame local + manipulation mode for 3D devices (device dependent). This feature is off by default. - Notes - ----- + * ``DLIST`` - With DLIST, you can specify whether screen updates and redraws will be performed using + the Mechanical APDL display list (off), or the 3D device's display list (on). DLIST is on by default for + Windows systems, but off for Linux. - .. _s-GCMD_notes: + * ``DELS`` - You use DELS to suppress contour display screen overwrites when :ref:`noerase` is + active. This prevents the bleed-through that occurs when you overlay contour plots. - This command controls the type of element or graph display that appears when you issue the - :ref:`gplot` command when the :ref:`gtype`,,(ELEM or GRPH) entity type is active. If you have - multiple plotting windows enabled, you can also use :ref:`gcmd` to select one window when you wish - to edit its contents. + * ``TRIS`` - Triangle strip mode. Tri-stripping provides faster 3D display capabilities and is on by + default. Some display enhancements, such as texturing, are adversely affected by tri-stripping. You + can turn off tri-stripping in order to improve these display functions. Be sure to turn tri- + stripping on after the desired output is obtained. - For related information, see the descriptions of the :ref:`gplot` and :ref:`gtype` commands in this - manual. + key : int or str + The following key options apply to ``Lab`` = ACCU: - This command is valid in any processor. - """ - command = f"/GCMD,{wn},{lab1},{lab2},{lab3},{lab4},{lab5},{lab6},{lab7},{lab8},{lab9},{lab10},{lab11},{lab12}" - return self.run(command, **kwargs) + * ``0`` - (OFF) The accumulation buffer is not accessed. (default) - def gplot(self, **kwargs): - r"""Controls general plotting. + * ``1`` - (ON) Access to the buffer is enabled. - Mechanical APDL Command: `GPLOT `_ + The following key options apply to ``Lab`` = ACTR: - Notes - ----- + * ``0`` - (OFF) The cursor position has no effect on the existing rotational center for dynamic + operations. - .. _GPLOT_notes: + * ``1`` - (ON) The rotational center for dynamic rotations in OpenGL is determined by the position + of the mouse cursor on (or within 15 pixels of) the model. Any rotations that are initiated with the + cursor more than 15 pixels from the model will occur about the midpoint of the Z-axis at that point + in space. If the Z-buffer has not been refreshed the Z-axis will have an infinite value, and + rotations will appear to occur about an extremely long Z-axis. This behavior stops when the graphics + window is refreshed or replotted. (default) - This command displays all entity types as specified via the :ref:`gtype` command. Only selected - entities ( :ref:`nsel`, :ref:`esel`, :ref:`ksel`, :ref:`lsel`, :ref:`asel`, :ref:`vsel` ) will be - displayed. See the descriptions of the :ref:`gtype` and :ref:`gcmd` commands for methods of setting - the entity types displayed. + Note that when using the GUI in 3D mode, when ACTR = 1, the ``Rotational Center`` option is grayed + out under Utility Menu> PlotCtrls> View Setting because the rotational center is determined strictly + by the position of the mouse cursor. - This command is valid in any processor. - """ - command = "GPLOT" - return self.run(command, **kwargs) + The following key options apply to ``Lab`` = ANIM: - def graphics(self, key: str = "", **kwargs): - r"""Defines the type of graphics display. + * ``0`` - Display list animation. The object can be dynamically manipulated while animating. No + legend, countour or annotation items are displayed. (see Notes, below) - Mechanical APDL Command: `/GRAPHICS `_ + * ``1`` - On Linux, device-dependent pixmap animation is used. On the PC, bitmap animation is + provided (default). When you animate in this mode, you cannot dynamically manipulate your model (see + Notes, below). - Parameters - ---------- - key : str - Graphics key: + * ``2`` - On the PC only, this option provides AVI animation which uses the AVI movie player. - * ``FULL`` - Display all model geometry and results. + Although you can create animations of multiple Mechanical APDL window schemes, animations created with + OpenGL display lists ( :ref:`dv3d`, ANIM, 0) do not retain the windowing scheme information. You CAN + save multiple windows via the X11/WIN32 drivers, or via the OpenGL driver with :ref:`dv3d`, ANIM, + KEY in effect (where KEY is not zero). - * ``POWER`` - Activate PowerGraphics (default when GUI is on). + The following key options apply to ``Lab`` = ANTI - Notes - ----- + * ``0`` - (OFF) Anti-aliasing is not active (default). - .. _s-GRAPHICS_notes: + * ``1`` - (ON) The anti-aliasing technique will be applied to smooth the lines in your displays + (valid for OpenGL only). - The :ref:`graphics` command specifies the type of graphics display. ``Key`` = POWER activates the - PowerGraphics capability. PowerGraphics offers faster plotting than the _nolinebreak? ``Key`` = FULL - option, /_nolinebreak? and speeds up element, results, area, line, and volume displays. + The following key options apply to ``Lab`` = DGEN: - The default PowerGraphics mode is enabled automatically when accessing the GUI. This action - supersedes all prior macros or start-up routines ( :file:`start.ans`, :file:`config.ans`, etc.). - Full graphics mode is accessed only by issuing :ref:`graphics`,FULL after the GUI is active. + * ``0`` - Normal manipulation. - Results values (both printed and plotted) may differ between the _nolinebreak? ``Key`` = FULL - /_nolinebreak? and ``Key`` = POWER options because each option specifies a different set of data for - averaging and display. For _nolinebreak? ``Key`` = FULL /_nolinebreak?, all element and results - values (interior and surface) are included. For _nolinebreak? ``Key`` = POWER /_nolinebreak?, only - element and results values along the model exterior surface are processed. + * ``1`` - Wireframe Manipulation. - When ``Key`` = FULL, it is possible to deselect an individual node, select all elements (including - the element that contains that node), and then perform postprocessing calculations on those elements - and have that unselected node not be considered in those calculations. If PowerGraphics is active, - however, postprocessing always displays based on selected elements. + The following key options apply to ``Lab`` = DLIST: - If you have specified one facet per element edge for PowerGraphics displays (via the :ref:`efacet` - command or options from the General Postproc or Utility menu), PowerGraphics does not plot midside - nodes. ( :ref:`efacet` applies to element type displays only.) + * ``0`` - (OFF) The Mechanical APDL display list is used for plotting and dynamic graphics manipulation + (Linux default). - Maximum values shown in plots can differ from printed maximum values. This is due to different - averaging schemes used for plotted and printed maximum values. + * ``1`` - (ON) The local (3D device) display list is used for plotting and dynamic rotation (Windows + default). - When using solution coordinate systems for results output ( :ref:`rsys`,SOLU) with PowerGraphics, - the deformed or displaced shape in a POST1 contour display can be unexpected (although the contours - are displayed in the expected colors). The program does not rotate displacement values (Ux,Uy,Uz) to - global; instead, the displacements (stored locally) are added directly to the global coordinates - (X,Y,Z). For example, if in PREP7 the nodes are rotated 90 degrees about the z axis and the global - Uy displacements are relatively large, the Ux values will be large, causing the model to display a - large deformation in the global X direction. + The following key options apply to ``Lab`` = TRIS: - PowerGraphics displays do not average at geometric discontinuities. The printouts in PowerGraphics - will, however, provide averaging information at geometric discontinuities if the models do not - contain shell elements. Carefully inspect the data you obtain at geometric discontinuities. + * ``0`` - (OFF) Tri-stripping is off. - PowerGraphics does not support the following diffusion analysis results: CONC, CG, DF, EPDI. + * ``1`` - (ON) Tri-stripping is on (default). - ``Key`` = FULL is not available for `XFEM-based crack-growth analysis - `_. + Notes + ----- - Excepting a few options, PowerGraphics supports these commands: + .. warning:: - InformalTables need to be added. - The following commands are executed via the _nolinebreak? ``Key`` = FULL /_nolinebreak? option, - regardless of whether PowerGraphics is activated: + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. - InformalTables need to be added. + Mechanical APDL uses display list animation for its 3D models. This memory resident array method + interfaces + with the OpenGL model information to allow the program to efficiently pan, zoom, rotate and + dynamically manipulate your model during animation. The logo, legend, contour and other annotation + items are produced in 2D and will not appear when :ref:`dv3d`, ANIM, 0 is in effect. To display + these items, use :ref:`dv3d`, ANIM, 1. All screen data will be displayed, but manipulation of the + model will not be possible. """ - command = f"/GRAPHICS,{key}" + command = f"/DV3D,{lab},{key}" return self.run(command, **kwargs) def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): @@ -1564,3 +1419,152 @@ def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): """ command = f"JPEG,{kywrd},{opt}" return self.run(command, **kwargs) + + def show( + self, + fname: str = "", + option: str = "", + vect: int | str = "", + ncpl: str = "", + **kwargs, + ): + r"""Specifies the device and other parameters for graphics displays. + + Mechanical APDL Command: `/SHOW `_ + + Parameters + ---------- + fname : str + Device name, file name, or keyword, as listed below: + + * ``<, device name >`` - Any valid graphics display device name (for example, X11, 3D etc.). + Defaults to X11 for most systems. See `Getting Started with Graphics + `_ in the `Basic Analysis Guide `_ + for details. A device name must be defined before activating the Graphical User Interface (GUI). + Once the GUI is activated, the device name cannot be changed for that session, except for switching + between X11 and X11C. + + * ``TERM`` - Graphics displays are switched back to the last-specified device name. + + * ``CLOSE`` - This option purges the graphics file buffer. The CLOSE option should be issued any + time you are changing graphics devices or file output types during a session. Graphics displays are + switched back to the last-specified device name, and any open graphics files are closed. The CLOSE + option is similar to the TERM option, however, with the CLOSE option, another process can access the + data in the graphics file. The CLOSE option causes graphics file buffers to be flushed to the + graphics file. + + * ``OFF`` - Graphics display requests are ignored. + + * ``(blank)`` - If blank in interactive mode, graphics will be displayed on screen as requested by + display commands (no file written). + + * ``JPEG`` - Creates JPEG files that are named :file:`Jobnamennn.jpg`, where ``nnn`` is a numeric + value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.jpg`, :file:`Jobname001.jpg`, :file:`Jobname002.jpg`, and so on. Ignores the + ``Ext`` field. + + * ``TIFF`` - Creates tagged image format files that are named :file:`Jobnamennn.tif`, where ``nnn`` + is a numeric value that is incremented by one as each additional file is created; that is, + :file:`Jobname000.tif`, :file:`Jobname001.tif`, :file:`Jobname002.tif`, and so on. This value for + the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`tiff` command for options.) + + * ``PNG`` - Creates PNG (Portable Network Graphics) files that are named :file:`Jobnamennn.png`, + where ``nnn`` is a numeric value that is incremented by one as each additional file is created; that + is, :file:`Jobname000.png`, :file:`Jobname001.png`, :file:`Jobname002.png`, and so on. This value + for the ``Fname`` argument ignores the ``Ext`` field. (See the :ref:`pngr` command for options.) + + * ``VRML`` - Creates Virtual Reality Meta Language files named :file:`Jobname000.wrl` that can be + displayed on 3D Internet web browsers. Ignores the ``Ext`` and ``NCPL`` fields. + + option : str + Assign a file name extension or specify reverse video output: + + * ``Ext`` - File name extension (eight-character maximum). + + * ``REV`` - Reverse background/image (black/white) colors. Valid with ``Fname`` = PNG (recommended), + JPEG, and TIFF. This option is ignored if a previously specified color map table ( :ref:`cmap` or + :ref:`rgb` ) is in effect. + + vect : int or str + Specifies raster or vector display mode. This affects area, volume, and element displays, as well as + geometric results displays such as contour plots. See the :ref:`device` command for an alternate way to toggle between raster and vector mode. Changing ``VECT`` also resets the :ref:`slashtype` command to its default. + + * ``0`` - Raster display (color filled entities; default) + + * ``1`` - Vector display (outlined entities; that is, "wireframe") + + ncpl : str + Sets the number of color planes (4 to 8). Default is device-dependent. ``NCPL`` is not supported + by all graphics devices. + + Notes + ----- + + .. _s-SHOW_notes: + + Specifies the device to be used for graphics displays, and specifies other graphics display + parameters. Display may be shown at the time of generation (for interactive runs at a graphics + display terminal) or diverted to a file. Issue :ref:`pstatus` for display status. + + Batch runs do not have access to the fonts available on your system. The Courier and Helvetica font + files used for JPEG, PNG and TIFF batch output are copyrighted by Adobe Systems Inc. and Digital + Equipment Corp. Permission to use these trademarks is hereby granted only in association with the + images described above. Batch run JPEG output is produced at the default quality index value of 75, + unless specified otherwise. + + Interactive displays default to eight color planes ( ``NCPL`` = 8) for most monitors, while graph + file output defaults to eight color planes for VRML output, and four color planes for JPEG, PNG, and + TIFF. + + This command is valid in any processor. + """ + command = f"/SHOW,{fname},{option},{vect},{ncpl}" + return self.run(command, **kwargs) + + def seg(self, label: str = "", aviname: str = "", delay: str = "", **kwargs): + r"""Allows graphics data to be stored in the local terminal memory. + + Mechanical APDL Command: `/SEG `_ + + Parameters + ---------- + label : str + Storage key: + + * ``SINGL`` - Store subsequent display in a single segment (overwrites last storage). + + * ``MULTI`` - Store subsequent displays in unique segments ( :ref:`anim` ). + + * ``DELET`` - Delete all currently stored segments. + + * ``OFF`` - Stop storing display data in segments. + + * ``STAT`` - Display segment status. + + * ``PC`` - This option only applies to PC versions of Mechanical APDL and only when animating via the AVI + movie player ( :ref:`device`,ANIM,2). The command appends frames to the :file:`File.AVI`, so that + the animation goes in both directions (that is, forward--backward--forward). You must have a current + animation file to use this option. + + aviname : str + Name of the animation file that will be created when each frame is saved. The :file:`.AVI` + extension is applied automatically. Defaults to :file:`Jobname.AVI` if no filename is specified. + + delay : str + Delay factor between each frame, in seconds. Defaults to 0.015 seconds if no value is specified. + + Notes + ----- + + .. _s-SEG_notes: + + Allows graphics data to be stored in the terminal local memory (device-dependent). Storage occurs + concurrently with the display. + + Although the information from your graphics window is stored as an individual segment, you cannot + plot directly ( :ref:`gplot` ) from the segment memory. + + This command is valid in any processor. + """ + command = f"/SEG,{label},{aviname},{delay}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/style.py b/src/ansys/mapdl/core/_commands/graphics/style.py index 39d73651cab..34f9e762c6c 100644 --- a/src/ansys/mapdl/core/_commands/graphics/style.py +++ b/src/ansys/mapdl/core/_commands/graphics/style.py @@ -25,6 +25,200 @@ class Style: + def eshape(self, scale: str = "", key: str = "", **kwargs): + r"""Displays elements with shapes determined from the real constants, section definition, or other + inputs. + + Mechanical APDL Command: `/ESHAPE `_ + + **Command default:** + + .. _s-ESHAPE_default: + + Use simple display of line and area elements ( ``SCALE`` = 0). + + Parameters + ---------- + scale : int or str + Scaling factor: + + * ``0`` - Use simple display of line and area elements. This value is the default. + + * ``1`` - Use real constants, section definition, or other information to form a solid shape display + of the applicable elements. + + * ``FAC`` - Multiply certain real constants, such as thickness, by ``FAC`` (where ``FAC`` > 0.01) + and use them to form a solid shape display of elements. + + key : int or str + Current shell thickness key: + + * ``0`` - Use current thickness in the displaced solid shape display of shell elements (valid for + ``SHELL181``, ``SHELL208``, ``SHELL209``, and ``SHELL281``). This value is the default. + + * ``1`` - Use initial thickness in the displaced solid shape display of shell elements. + + Notes + ----- + + .. _s-ESHAPE_notes: + + The :ref:`eshape` command allows beams, shells, current sources, and certain special-purpose + elements or elements with special options to be displayed as solids with the shape determined from + the real constants, section types, or other information. Elements are displayed via the :ref:`eplot` + command. No checks for valid or complete input are made for the display. + + Following are details about using this command with various element types: + + * ``COMBIN14``, ``COMBIN39``, and ``MASS21``are displayed with a graphics icon, with the offset + determined by the real constants and KEYOPT settings. + + * ``BEAM188``, ``BEAM189``, ``PIPE288``, ``PIPE289``and ``ELBOW290``are displayed as solids with the + shape determined via the section-definition commands ( :ref:`sectype` and :ref:`secdata` ). The + arbitrary section option ( ``Subtype`` = ASEC) has no definite shape and appears as a thin + rectangle to indicate the orientation; the thin side represents the beam Y axis and the thick + (longer) side represents the Z axis. The length of thick side is determined by ``TKz``. If ``TKz`` + = 0, the area is used to determine the length of thick side. The thin side is scaled by the + fraction of the thick side, regardless of ``TKy``. If the offsets are defined via ``CGy`` / + ``CGz`` ( :ref:`secdata` or :ref:`secoffset`,USER, ``OFFSETY``, ``OFFSETZ`` ), they are applied to + the plot without scaling. The elements are displayed with internal lines representing the cross- + section mesh. + + * Reduced-integration and lower-order shells ( ``SHELL181``and ``SHELL208``with KEYOPT(3)=0) are + displayed with uniform thickness, evaluated at the centroid, to reflect the element behavior. + + * ``SOLID272``and ``SOLID273``are displayed as solids with the shape determined via the section- + definition commands ( :ref:`sectype` and :ref:`secdata` ). The 2D master plane is revolved around + the prescribed axis of symmetry. + + * ``PLANE182``, ``PLANE183``, ``PLANE222``, and ``PLANE223`` with KEYOPT(3) = 6 are displayed as 3D + solids with the shape determined by nodal locations and displacements at the nodes. + + * Contour plots are available for these elements in postprocessing for PowerGraphics only ( + :ref:`graphics`,POWER). To view 3D deformed shapes for the elements, issue :ref:`outres`,MISC or + :ref:`outres`,ALL for static or transient analyses. To view 3D mode shapes for a modal or + eigenvalue buckling analysis, expand the modes with element results calculation ON ( ``Elcalc`` = + YES for :ref:`mxpand` ). + + * ``SOURC36``, ``CIRCU124``, and ``TRANS126``elements always plot using :ref:`eshape` when + PowerGraphics is activated ( :ref:`graphics`,POWER). + + In most cases, :ref:`eshape` renders a thickness representation of your shell, plane and layered + elements more readily in PowerGraphics ( :ref:`graphics`,POWER). This type of representation employs + PowerGraphics to generate the enhanced representation, and will often provide no enhancement in Full + Graphics ( :ref:`graphics`,FULL). This is especially true for POST1 results displays, where + :ref:`eshape` is not supported for most element types with FULL graphics. + + When PowerGraphics is active, :ref:`eshape` may degrade the image if adjacent elements have + overlapping material, such as shell elements which are not co-planar. Additionally, if adjacent + elements have different thicknesses, the polygons depicting the connectivity between the "thicker" + and "thinner" elements along the shared element edges may not always be displayed. + + For POST1 results displays (such as :ref:`plnsol` ), the following limitations apply: + + * If you issue :ref:`rsys`,SOLU before reviewing results for beam or pipe elements, contour plots + for displacement (for example, :ref:`plnsol`,U,X and :ref:`pldisp` ) do not appear in the solution + coordinate system when :ref:`eshape` is active. Instead, the contours appear in the global + Cartesian coordinate system. + + * When shell elements are not co-planar, the resulting :ref:`plnsol` display with :ref:`eshape` will + actually be a :ref:`plesol` display as the non-coincident pseudo-nodes are not averaged. + Additionally, :ref:`eshape` should not be used with coincident elements because the plot may + incorrectly average the displacements of the coincident elements. + + * When nodes are initially coincident and PowerGraphics is active, duplicate polygons are eliminated + to conserve display time and disk space. The command may degrade the image if initially coincident + nodes have different displacements. The tolerance for determining coincidence is 1E-9 times the + model``s bounding box diagonal. + + * If you want to view solution results ( :ref:`plnsol`, etc.) on layered elements (such as + ``SHELL181``, ``SOLSH190``, ``SOLID185``Layered Solid, ``SOLID186``Layered Solid, ``SHELL208``, + ``SHELL209``, ``SHELL281``, and ``ELBOW290``), set KEYOPT(8) = 1 for the layer elements so that + the data for all layers is stored in the results file. + + * You can plot the through-thickness temperatures of elements ``SHELL131``and ``SHELL132``regardless + of the thermal DOFs in use by issuing the :ref:`plnsol`,TEMP command (with PowerGraphics and + :ref:`eshape` active). + + * The :ref:`eshape`,1 and :ref:`eshape`, ``FAC`` commands are incompatible with the :ref:`cycexpand` + command used in cyclic symmetry analyses. + + * The :ref:`eshape`,1 command does not support velocity and acceleration results for elements + ``PLANE182``, ``PLANE183``, ``PLANE222``, or ``PLANE223``with KEYOPT(3) = 6. + + * For coupled-field elements ``PLANE222``and ``PLANE223``with KEYOPT(3) = 6, the :ref:`eshape` + command can be used to visualize structural results. Non-structural results visualization is + limited to gradient and flux displays supported with PowerGraphics. + + This command is valid in any processor. + """ + warnings.warn( + "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(backend=GraphicsBackend.MAPDL)`` " + ) + command = f"/ESHAPE,{scale},{key}" + return self.run(command, **kwargs) + + def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): + r"""Displays only the common lines (“edges”) of an object. + + Mechanical APDL Command: `/EDGE `_ + + **Command default:** + + .. _s-EDGE_default: + + For element plots, display common lines between all adjacent element faces. For contour plots, + display only the common lines between non-coplanar faces. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies. The default window is 1. + + key : int or str + Edge key: + + **Elements Plots** + + * ``0`` - Display common lines between all adjacent element faces. + + * ``1`` - Display only the common lines between non-coplanar faces (that is, show only the edges). + + **Contour Plots** + + * ``0`` - Display only the common lines between non-coplanar faces. + + * ``1`` - Display common lines between all element faces. + + angle : str + Largest angle between two faces for which the faces are considered to be coplanar (0° to 180°). + Defaults to 45°. A smaller angle produces more edges, a larger angle produces fewer edges. + + Notes + ----- + + .. _s-EDGE_notes: + + The ``ANGLE`` field is used in PowerGraphics to determine geometric discontinuities. It is a + tolerance measure for the differences between the normals of the surfaces being considered. Values + within the tolerance are accepted as coplanar (geometrically continuous). In postprocessing + displays, results are not averaged across discontinuous surfaces. + + A surface can be displayed as an edge outline without interior detail. This is useful for both + geometry and postprocessing displays. Element outlines are normally shown as solid lines for + geometry and displacement displays. Lines common to adjacent "coplanar" element faces are removed + from the display. Midside nodes of elements are ignored. + + The :ref:`shrink` option is ignored with the edge option. + + :ref:`edge` is not supported for :ref:`plesol` and :ref:`eshape` displays when in PowerGraphics mode + ( :ref:`graphics`,POWER). + + The :ref:`edge` command is valid in any processor. + """ + command = f"/EDGE,{wn},{key},{angle}" + return self.run(command, **kwargs) + def light( self, wn: str = "", @@ -96,200 +290,193 @@ def light( command = f"/LIGHT,{wn},{num},{int_},{xv},{yv},{zv},{refl}" return self.run(command, **kwargs) - def edge(self, wn: str = "", key: int | str = "", angle: str = "", **kwargs): - r"""Displays only the common lines (“edges”) of an object. + def gmface(self, lab: str = "", n: str = "", **kwargs): + r"""Specifies the facet representation used to form solid models. - Mechanical APDL Command: `/EDGE `_ + Mechanical APDL Command: `GMFACE `_ - **Command default:** + Parameters + ---------- + lab : str + Valid Labels: - .. _s-EDGE_default: + * ``FINE`` - Value that determines how coarse the facets will be. - For element plots, display common lines between all adjacent element faces. For contour plots, - display only the common lines between non-coplanar faces. + n : str + An integer value between one (small) and ten (large) that determines the tolerances that will be + applied to the creation of arcs and surfaces. Ten will create many facets, which may in turn + cause Mechanical APDL to run very slowly. One will create fewer facets, which may in turn cause + larger tolerance errors. + """ + command = f"GMFACE,{lab},{n}" + return self.run(command, **kwargs) + + def gmarker(self, curve: str = "", key: int | str = "", incr: str = "", **kwargs): + r"""Specifies the curve marking style. + + Mechanical APDL Command: `/GMARKER `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies. The default window is 1. + curve : str + Curve number markers will be applied on (integer value between 1 and 10). key : int or str - Edge key: - - **Elements Plots** + Marker key: - * ``0`` - Display common lines between all adjacent element faces. + * ``0`` - No markers will be applied (default). - * ``1`` - Display only the common lines between non-coplanar faces (that is, show only the edges). + * ``1`` - TRIANGLES will be applied. - **Contour Plots** + * ``2`` - SQUARES will be applied. - * ``0`` - Display only the common lines between non-coplanar faces. + * ``3`` - DIAMONDS will be applied. - * ``1`` - Display common lines between all element faces. + * ``4`` - CROSSES will be applied. - angle : str - Largest angle between two faces for which the faces are considered to be coplanar (0° to 180°). - Defaults to 45°. A smaller angle produces more edges, a larger angle produces fewer edges. + incr : str + Determines the curve marking frequency. (a whole number value between 1 and 255). If ``INCR`` = + 1, markers are displayed at every data point on the curve. If ``INCR`` = 2 then markers are + displayed at every second data point. If ``INCR`` = 3 then they are displayed at every third + data point. Notes ----- - .. _s-EDGE_notes: - - The ``ANGLE`` field is used in PowerGraphics to determine geometric discontinuities. It is a - tolerance measure for the differences between the normals of the surfaces being considered. Values - within the tolerance are accepted as coplanar (geometrically continuous). In postprocessing - displays, results are not averaged across discontinuous surfaces. - - A surface can be displayed as an edge outline without interior detail. This is useful for both - geometry and postprocessing displays. Element outlines are normally shown as solid lines for - geometry and displacement displays. Lines common to adjacent "coplanar" element faces are removed - from the display. Midside nodes of elements are ignored. - - The :ref:`shrink` option is ignored with the edge option. - - :ref:`edge` is not supported for :ref:`plesol` and :ref:`eshape` displays when in PowerGraphics mode - ( :ref:`graphics`,POWER). + .. _s-GMARKER_notes: - The :ref:`edge` command is valid in any processor. + The user-specified markers will not be drawn when the area under the curve is color-filled ( + :ref:`gropt`, FILL). """ - command = f"/EDGE,{wn},{key},{angle}" + command = f"/GMARKER,{curve},{key},{incr}" return self.run(command, **kwargs) - def eshape(self, scale: str = "", key: str = "", **kwargs): - r"""Displays elements with shapes determined from the real constants, section definition, or other - inputs. + def gline(self, wn: str = "", style: int | str = "", **kwargs): + r"""Specifies the element outline style. - Mechanical APDL Command: `/ESHAPE `_ + Mechanical APDL Command: `/GLINE `_ - **Command default:** + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). - .. _s-ESHAPE_default: + style : int or str + Outline key: - Use simple display of line and area elements ( ``SCALE`` = 0). + * ``0`` - Solid element outlines (default) - Parameters - ---------- - scale : int or str - Scaling factor: + * ``1`` - Dashed element outlines - * ``0`` - Use simple display of line and area elements. This value is the default. + * ``-1`` - No element outlines - * ``1`` - Use real constants, section definition, or other information to form a solid shape display - of the applicable elements. + Notes + ----- - * ``FAC`` - Multiply certain real constants, such as thickness, by ``FAC`` (where ``FAC`` > 0.01) - and use them to form a solid shape display of elements. + .. _s-GLINE_notes: - key : int or str - Current shell thickness key: + Determines the element outline style. Often used when node numbers are displayed to prevent element + lin es from overwriting node numbers. - * ``0`` - Use current thickness in the displaced solid shape display of shell elements (valid for - SHELL181, SHELL208, SHELL209, and SHELL281 ). This value is the default. + Unless you are using an OpenGL or Starbase driver, the dashed element outline option ( :ref:`gline`, + ``WN``,1) is not available in the following situations: - * ``1`` - Use initial thickness in the displaced solid shape display of shell elements. + * Z-buffered displays ( :ref:`slashtype`, ``WN``,6). - Notes - ----- + * Capped Z-buffered displays ( :ref:`slashtype`, ``WN``,7). - .. _s-ESHAPE_notes: + * Qslice Z-buffered displays ( :ref:`slashtype`, ``WN``,8). - The :ref:`eshape` command allows beams, shells, current sources, and certain special-purpose - elements or elements with special options to be displayed as solids with the shape determined from - the real constants, section types, or other information. Elements are displayed via the :ref:`eplot` - command. No checks for valid or complete input are made for the display. + This command is valid in any processor. + """ + command = f"/GLINE,{wn},{style}" + return self.run(command, **kwargs) - Following are details about using this command with various element types: + def slashtype(self, wn: str = "", type_: str = "", **kwargs): + r"""Defines the type of display. - * COMBIN14, COMBIN39, and MASS21 are displayed with a graphics icon, with the offset determined by - the real constants and KEYOPT settings. + Mechanical APDL Command: `/TYPE `_ - * BEAM188, BEAM189, PIPE288, PIPE289 and ELBOW290 are displayed as solids with the shape determined - via the section-definition commands ( :ref:`sectype` and :ref:`secdata` ). The arbitrary section - option ( ``Subtype`` = ASEC) has no definite shape and appears as a thin rectangle to indicate the - orientation; the thin side represents the beam Y axis and the thick (longer) side represents the Z - axis. The length of thick side is determined by ``TKz``. If ``TKz`` = 0, the area is used to - determine the length of thick side. The thin side is scaled by the fraction of the thick side, - regardless of ``TKy``. If the offsets are defined via ``CGy`` / ``CGz`` ( :ref:`secdata` or - :ref:`secoffset`,USER, ``OFFSETY``, ``OFFSETZ`` ), they are applied to the plot without scaling. - The elements are displayed with internal lines representing the cross-section mesh. + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). - * Reduced-integration and lower-order shells ( SHELL181 and SHELL208 with KEYOPT(3)=0) are displayed - with uniform thickness, evaluated at the centroid, to reflect the element behavior. + type_ : str + Display type. Defaults to ZBUF for raster mode displays or BASIC for vector mode displays: - * SOLID272 and SOLID273 are displayed as solids with the shape determined via the section-definition - commands ( :ref:`sectype` and :ref:`secdata` ). The 2D master plane is revolved around the - prescribed axis of symmetry. + * ``BASIC or 0`` - Basic display (no hidden or section operations). - * PLANE182, PLANE183, PLANE222, and PLANE223 with KEYOPT(3) = 6 are displayed as + * ``SECT or 1`` - Section display (plane view). Use the :ref:`cplane` command to define the cutting + plane. - 3D solids with the shape determined by + * ``HIDC or 2`` - Centroid hidden display (based on item centroid sort). - nodal locations and displacements at the nodes. + * ``HIDD or 3`` - Face hidden display (based on face centroid sort). - * Contour plots are available for these elements in postprocessing for PowerGraphics only ( - :ref:`graphics`,POWER). To view 3D deformed shapes for the elements, issue :ref:`outres`,MISC or - :ref:`outres`,ALL for static or transient analyses. To view 3D mode shapes for a modal or - eigenvalue buckling analysis, expand the modes with element results calculation ON ( ``Elcalc`` = - YES for :ref:`mxpand` ). + * ``HIDP or 4`` - Precise hidden display (like HIDD but with more precise checking). Because all + facets are sorted, this mode can be extremely slow, especially for large models. - * SOURC36, CIRCU124, and TRANS126 elements always plot using :ref:`eshape` when PowerGraphics is - activated ( :ref:`graphics`,POWER). + * ``CAP or 5`` - Capped hidden display (same as combined SECT and HIDD with model in front of + section plane removed). - In most cases, :ref:`eshape` renders a thickness representation of your shell, plane and layered - elements more readily in PowerGraphics ( :ref:`graphics`,POWER). This type of representation employs - PowerGraphics to generate the enhanced representation, and will often provide no enhancement in Full - Graphics ( :ref:`graphics`,FULL). This is especially true for POST1 results displays, where - :ref:`eshape` is not supported for most element types with FULL graphics. + * ``ZBUF or 6`` - Z-buffered display (like HIDD but using software Z-buffering). - When PowerGraphics is active, :ref:`eshape` may degrade the image if adjacent elements have - overlapping material, such as shell elements which are not co-planar. Additionally, if adjacent - elements have different thicknesses, the polygons depicting the connectivity between the "thicker" - and "thinner" elements along the shared element edges may not always be displayed. + * ``ZCAP or 7`` - Capped Z-buffered display (same as combined SECT and ZBUF with model in front of + section plane removed). - For POST1 results displays (such as :ref:`plnsol` ), the following limitations apply: + * ``ZQSL or 8`` - QSLICE Z-buffered display (same as SECT but the edge lines of the remaining 3D + model are shown). - * If you issue :ref:`rsys`,SOLU before reviewing results for beam or pipe elements, contour plots - for displacement (for example, :ref:`plnsol`,U,X and :ref:`pldisp` ) do not appear in the solution - coordinate system when :ref:`eshape` is active. Instead, the contours appear in the global - Cartesian coordinate system. + * ``HQSL or 9`` - QSLICE precise hidden display (like ZQSL but using precise hidden). - * When shell elements are not co-planar, the resulting :ref:`plnsol` display with :ref:`eshape` will - actually be a :ref:`plesol` display as the non-coincident pseudo-nodes are not averaged. - Additionally, :ref:`eshape` should not be used with coincident elements because the plot may - incorrectly average the displacements of the coincident elements. + Notes + ----- - * When nodes are initially coincident and PowerGraphics is active, duplicate polygons are eliminated - to conserve display time and disk space. The command may degrade the image if initially coincident - nodes have different displacements. The tolerance for determining coincidence is 1E-9 times the - model``s bounding box diagonal. + .. _s-TYPE_notes: - * If you want to view solution results ( :ref:`plnsol`, etc.) on layered elements (such as SHELL181, - SOLSH190, SOLID185 Layered Solid, SOLID186 Layered Solid, SHELL208, SHELL209, SHELL281, and - ELBOW290 ), set KEYOPT(8) = 1 for the layer elements so that the data for all layers is stored in - the results file. + Defines the type of display, such as section display or hidden-line display. Use the :ref:`device` + command to specify either raster or vector mode. - * You can plot the through-thickness temperatures of elements SHELL131 and SHELL132 regardless of - the thermal DOFs in use by issuing the :ref:`plnsol`,TEMP command (with PowerGraphics and - :ref:`eshape` active). + The SECT, CAP, ZCAP, ZQSL, and HQSL options produce section displays. The section or "cutting" plane + is specified on the :ref:`cplane` command as either normal to the viewing vector at the focus point + (default), or as the working plane. - * The :ref:`eshape`,1 and :ref:`eshape`, ``FAC`` commands are incompatible with the :ref:`cycexpand` - command used in cyclic symmetry analyses. + When you use PowerGraphics, the section display options (Section, Slice, and Capped) use different + averaging techniques for the interior and exterior results. Because of the different averaging + schemes, anomalies may appear at the transition areas. In many cases, the automatically computed MIN + and MAX values will differ from the full range of interior values. You can lessen the effect of + these anomalies by issuing :ref:`avres`,,FULL ( Main Menu> General Post Proc> Options for Outp ). + This command sets your legend's automatic contour interval range according to the minimum and + maximum results found throughout the entire model. - * The :ref:`eshape`,1 command does not support velocity and acceleration results for elements - PLANE182, PLANE183, PLANE222, or PLANE223 with KEYOPT(3) = 6. + With PowerGraphics active ( :ref:`graphics`,POWER), the averaging scheme for surface data with + interior element data included ( :ref:`avres`,,FULL) and multiple facets per edge ( :ref:`efacet`,2 + or :ref:`efacet`,4) will yield differing minimum and maximum contour values depending on the + Z-Buffering options ( :ref:`slashtype`,,6 or :ref:`slashtype`,,7). When the Section data is not + included in the averaging schemes ( :ref:`slashtype`,,7), the resulting absolute value for the + midside node is significantly smaller. - * For coupled-field elements PLANE222 and PLANE223 with KEYOPT(3) = 6, the :ref:`eshape` command can - be used to visualize structural results. Non-structural results visualization is limited to - gradient and flux displays supported with PowerGraphics. + The HIDC, HIDD, HIDP, ZBUF, ZQSL, and HQSL options produce displays with "hidden" lines removed. + Hidden lines are lines obscured from view by another element, area, etc. The choice of non-Z- + buffered hidden-line procedure types is available only for raster mode ( :ref:`device` ) displays. + For vector mode displays, all non-Z-buffered "hidden-line" options use the same procedure (which is + slightly different from the raster procedures). Both geometry and postprocessing displays may be of + the hidden-line type. Interior stress contour lines within solid elements can also be removed as + hidden lines, leaving only the stress contour lines and element outlines on the visible surfaces. + Midside nodes of elements are ignored on postprocessing displays. Overlapping elements will not be + displayed. + + The ZBUF, ZCAP, and ZQSL options use a specific hidden-line technique called software Z-buffering. + This technique allows a more accurate display of overlapping surfaces (common when using Boolean + operations or :ref:`eshape` on element displays), and allows smooth shaded displays on all + interactive graphics displays. Z-buffered displays can be performed faster than HIDP and CAP type + displays for large models. See also the :ref:`light`, :ref:`shade`, and :ref:`gfile` commands for + additional options when Z-buffering is used. This command is valid in any processor. """ - warnings.warn( - "pymapdl does not support /ESHAPE when plotting in Python using ``mapdl.eplot()``. Use ``mapdl.eplot(backend=GraphicsBackend.MAPDL)`` " - ) - command = f"/ESHAPE,{scale},{key}" + command = f"/TYPE,{wn},{type_}" return self.run(command, **kwargs) def txtre( @@ -507,154 +694,68 @@ def trlcy( the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by picking. - ninc : str - Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` - to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, - apply specified translucency level to entire selected range. If ``Lab`` is CM, use component - name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically - pick elements, areas, and volumes. You can then assign translucency levels to the entities via - the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by - picking. - - Notes - ----- - - .. _s-TRLCY_notes: - - Specifies the level of translucency for various items. Issue :ref:`trlcy`,DEFA to reset the default - (0) translucency levels. This command is valid only on selected 2D and 3D graphics devices; see - filename="Hlp_G_BAS11_3.html"? in the `Basic Analysis Guide - `_ for more - information on applying translucency. - - For 2D devices, the program displays only the visible faces of the items being displayed. The - information behind the facing planes is not displayed. Issuing the :ref:`shrink` command will force - the hardware to display information behind the translucent items. - - This command is valid in any processor. - """ - command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" - return self.run(command, **kwargs) - - def slashtype(self, wn: str = "", type_: str = "", **kwargs): - r"""Defines the type of display. - - Mechanical APDL Command: `/TYPE `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - type_ : str - Display type. Defaults to ZBUF for raster mode displays or BASIC for vector mode displays: - - * ``BASIC or 0`` - Basic display (no hidden or section operations). - - * ``SECT or 1`` - Section display (plane view). Use the :ref:`cplane` command to define the cutting - plane. - - * ``HIDC or 2`` - Centroid hidden display (based on item centroid sort). - - * ``HIDD or 3`` - Face hidden display (based on face centroid sort). - - * ``HIDP or 4`` - Precise hidden display (like HIDD but with more precise checking). Because all - facets are sorted, this mode can be extremely slow, especially for large models. - - * ``CAP or 5`` - Capped hidden display (same as combined SECT and HIDD with model in front of - section plane removed). - - * ``ZBUF or 6`` - Z-buffered display (like HIDD but using software Z-buffering). - - * ``ZCAP or 7`` - Capped Z-buffered display (same as combined SECT and ZBUF with model in front of - section plane removed). - - * ``ZQSL or 8`` - QSLICE Z-buffered display (same as SECT but the edge lines of the remaining 3D - model are shown). - - * ``HQSL or 9`` - QSLICE precise hidden display (like ZQSL but using precise hidden). + ninc : str + Used only with labels as noted above. Apply translucency level to ``Lab`` items numbered ``N1`` + to ``N2`` (defaults to ``N1`` ) in steps of ``NINC`` (defaults to 1). If ``N1`` is blank or ALL, + apply specified translucency level to entire selected range. If ``Lab`` is CM, use component + name for ``N1`` and ignore ``N2`` and ``NINC``. A value of ``N1`` = P allows you to graphically + pick elements, areas, and volumes. You can then assign translucency levels to the entities via + the picker. The ``Lab`` and ``TLEVEL`` fields are ignored when translucency is applied by + picking. Notes ----- - .. _s-TYPE_notes: - - Defines the type of display, such as section display or hidden-line display. Use the :ref:`device` - command to specify either raster or vector mode. - - The SECT, CAP, ZCAP, ZQSL, and HQSL options produce section displays. The section or "cutting" plane - is specified on the :ref:`cplane` command as either normal to the viewing vector at the focus point - (default), or as the working plane. - - When you use PowerGraphics, the section display options (Section, Slice, and Capped) use different - averaging techniques for the interior and exterior results. Because of the different averaging - schemes, anomalies may appear at the transition areas. In many cases, the automatically computed MIN - and MAX values will differ from the full range of interior values. You can lessen the effect of - these anomalies by issuing :ref:`avres`,,FULL ( Main Menu> General Post Proc> Options for Outp ). - This command sets your legend's automatic contour interval range according to the minimum and - maximum results found throughout the entire model. - - With PowerGraphics active ( :ref:`graphics`,POWER), the averaging scheme for surface data with - interior element data included ( :ref:`avres`,,FULL) and multiple facets per edge ( :ref:`efacet`,2 - or :ref:`efacet`,4) will yield differing minimum and maximum contour values depending on the - Z-Buffering options ( :ref:`slashtype`,,6 or :ref:`slashtype`,,7). When the Section data is not - included in the averaging schemes ( :ref:`slashtype`,,7), the resulting absolute value for the - midside node is significantly smaller. + .. _s-TRLCY_notes: - The HIDC, HIDD, HIDP, ZBUF, ZQSL, and HQSL options produce displays with "hidden" lines removed. - Hidden lines are lines obscured from view by another element, area, etc. The choice of non-Z- - buffered hidden-line procedure types is available only for raster mode ( :ref:`device` ) displays. - For vector mode displays, all non-Z-buffered "hidden-line" options use the same procedure (which is - slightly different from the raster procedures). Both geometry and postprocessing displays may be of - the hidden-line type. Interior stress contour lines within solid elements can also be removed as - hidden lines, leaving only the stress contour lines and element outlines on the visible surfaces. - Midside nodes of elements are ignored on postprocessing displays. Overlapping elements will not be - displayed. + Specifies the level of translucency for various items. Issue :ref:`trlcy`,DEFA to reset the default + (0) translucency levels. This command is valid only on selected 2D and 3D graphics devices; see + filename="Hlp_G_BAS11_3.html"? in the `Basic Analysis Guide + `_ for more + information on applying translucency. - The ZBUF, ZCAP, and ZQSL options use a specific hidden-line technique called software Z-buffering. - This technique allows a more accurate display of overlapping surfaces (common when using Boolean - operations or :ref:`eshape` on element displays), and allows smooth shaded displays on all - interactive graphics displays. Z-buffered displays can be performed faster than HIDP and CAP type - displays for large models. See also the :ref:`light`, :ref:`shade`, and :ref:`gfile` commands for - additional options when Z-buffering is used. + For 2D devices, the program displays only the visible faces of the items being displayed. The + information behind the facing planes is not displayed. Issuing the :ref:`shrink` command will force + the hardware to display information behind the translucent items. This command is valid in any processor. """ - command = f"/TYPE,{wn},{type_}" + command = f"/TRLCY,{lab},{tlevel},{n1},{n2},{ninc}" return self.run(command, **kwargs) - def cplane(self, key: int | str = "", **kwargs): - r"""Specifies the cutting plane for section and capped displays. - - Mechanical APDL Command: `/CPLANE `_ - - **Command default:** - - .. _s-CPLANE_default: + def normal(self, wn: str = "", key: int | str = "", **kwargs): + r"""Allows displaying area elements by top or bottom faces. - The cutting plane is normal to the viewing vector at the focus point. + Mechanical APDL Command: `/NORMAL `_ Parameters ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + key : int or str - Specifies the cutting plane: + Display key: - * ``0`` - Cutting plane is normal to the viewing vector ( :ref:`view` ) and passes through the focus - point ( :ref:`focus` ) (default). + * ``0`` - No face distinction. - * ``1`` - The working plane ( :ref:`wplane` ) is the cutting plane. + * ``1`` - Show only area elements having their positive normals directed toward the viewing point. + + * ``-1`` - Show only area elements having their positive normals directed away from the viewing + point. Notes ----- - .. _s-CPLANE_notes: + .. _s-NORMAL_notes: - Defines the cutting plane to be used for section and capped displays ( :ref:`slashtype`,,(1, 5, or - 7)). + :ref:`normal` allows you to select area elements and area plots by the top or bottom faces. It is + useful for checking the normal directions on shell elements. The positive normal (element Z + direction) is defined by the right-hand rule following the node I, J, K, L input direction. This + command is available only with raster or hidden-line displays, for WIN32 or X11 2D displays only. This command is valid in any processor. """ - command = f"/CPLANE,{key}" + command = f"/NORMAL,{wn},{key}" return self.run(command, **kwargs) def ctype( @@ -724,72 +825,38 @@ def ctype( command = f"/CTYPE,{key},{dotd},{dots},{dshp},{tlen}" return self.run(command, **kwargs) - def normal(self, wn: str = "", key: int | str = "", **kwargs): - r"""Allows displaying area elements by top or bottom faces. - - Mechanical APDL Command: `/NORMAL `_ - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - key : int or str - Display key: - - * ``0`` - No face distinction. - - * ``1`` - Show only area elements having their positive normals directed toward the viewing point. - - * ``-1`` - Show only area elements having their positive normals directed away from the viewing - point. - - Notes - ----- - - .. _s-NORMAL_notes: + def cplane(self, key: int | str = "", **kwargs): + r"""Specifies the cutting plane for section and capped displays. - :ref:`normal` allows you to select area elements and area plots by the top or bottom faces. It is - useful for checking the normal directions on shell elements. The positive normal (element Z - direction) is defined by the right-hand rule following the node I, J, K, L input direction. This - command is available only with raster or hidden-line displays, for WIN32 or X11 2D displays only. + Mechanical APDL Command: `/CPLANE `_ - This command is valid in any processor. - """ - command = f"/NORMAL,{wn},{key}" - return self.run(command, **kwargs) + **Command default:** - def facet(self, lab: str = "", **kwargs): - r"""Specifies the facet representation used to form solid model displays. + .. _s-CPLANE_default: - Mechanical APDL Command: `/FACET `_ + The cutting plane is normal to the viewing vector at the focus point. Parameters ---------- - lab : str - Valid labels: - - * ``FINE`` - Use finer tessellation to increase the number of facets for the display. Provides the - best representation (but decreases speed of operation). - - * ``NORML`` - Use the basic number of facets for the display (default). + key : int or str + Specifies the cutting plane: - * ``COAR`` - Use a limited number of facets for the display. This option will increase the speed of - the operations, but may produce poor representations for some imported models. + * ``0`` - Cutting plane is normal to the viewing vector ( :ref:`view` ) and passes through the focus + point ( :ref:`focus` ) (default). - * ``WIRE`` - Display model with a wireframe representation (fast, but surfaces will not be shown). + * ``1`` - The working plane ( :ref:`wplane` ) is the cutting plane. Notes ----- - .. _s-FACET_notes: + .. _s-CPLANE_notes: - Specifies the facet (or polygon) representation used to form solid model displays. Used only with - the :ref:`aplot`, :ref:`asum`, :ref:`vplot`, and :ref:`vsum` commands. + Defines the cutting plane to be used for section and capped displays ( :ref:`slashtype`,,(1, 5, or + 7)). This command is valid in any processor. """ - command = f"/FACET,{lab}" + command = f"/CPLANE,{key}" return self.run(command, **kwargs) def shade(self, wn: str = "", type_: str = "", **kwargs): @@ -827,104 +894,35 @@ def shade(self, wn: str = "", type_: str = "", **kwargs): command = f"/SHADE,{wn},{type_}" return self.run(command, **kwargs) - def gline(self, wn: str = "", style: int | str = "", **kwargs): - r"""Specifies the element outline style. + def facet(self, lab: str = "", **kwargs): + r"""Specifies the facet representation used to form solid model displays. - Mechanical APDL Command: `/GLINE `_ + Mechanical APDL Command: `/FACET `_ Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + lab : str + Valid labels: - style : int or str - Outline key: + * ``FINE`` - Use finer tessellation to increase the number of facets for the display. Provides the + best representation (but decreases speed of operation). - * ``0`` - Solid element outlines (default) + * ``NORML`` - Use the basic number of facets for the display (default). - * ``1`` - Dashed element outlines + * ``COAR`` - Use a limited number of facets for the display. This option will increase the speed of + the operations, but may produce poor representations for some imported models. - * ``-1`` - No element outlines + * ``WIRE`` - Display model with a wireframe representation (fast, but surfaces will not be shown). Notes ----- - .. _s-GLINE_notes: - - Determines the element outline style. Often used when node numbers are displayed to prevent element - lin es from overwriting node numbers. - - Unless you are using an OpenGL or Starbase driver, the dashed element outline option ( :ref:`gline`, - ``WN``,1) is not available in the following situations: - - * Z-buffered displays ( :ref:`slashtype`, ``WN``,6). - - * Capped Z-buffered displays ( :ref:`slashtype`, ``WN``,7). + .. _s-FACET_notes: - * Qslice Z-buffered displays ( :ref:`slashtype`, ``WN``,8). + Specifies the facet (or polygon) representation used to form solid model displays. Used only with + the :ref:`aplot`, :ref:`asum`, :ref:`vplot`, and :ref:`vsum` commands. This command is valid in any processor. """ - command = f"/GLINE,{wn},{style}" - return self.run(command, **kwargs) - - def gmface(self, lab: str = "", n: str = "", **kwargs): - r"""Specifies the facet representation used to form solid models. - - Mechanical APDL Command: `GMFACE `_ - - Parameters - ---------- - lab : str - Valid Labels: - - * ``FINE`` - Value that determines how coarse the facets will be. - - n : str - An integer value between one (small) and ten (large) that determines the tolerances that will be - applied to the creation of arcs and surfaces. Ten will create many facets, which may in turn - cause Mechanical APDL to run very slowly. One will create fewer facets, which may in turn cause - larger tolerance errors. - """ - command = f"GMFACE,{lab},{n}" - return self.run(command, **kwargs) - - def gmarker(self, curve: str = "", key: int | str = "", incr: str = "", **kwargs): - r"""Specifies the curve marking style. - - Mechanical APDL Command: `/GMARKER `_ - - Parameters - ---------- - curve : str - Curve number markers will be applied on (integer value between 1 and 10). - - key : int or str - Marker key: - - * ``0`` - No markers will be applied (default). - - * ``1`` - TRIANGLES will be applied. - - * ``2`` - SQUARES will be applied. - - * ``3`` - DIAMONDS will be applied. - - * ``4`` - CROSSES will be applied. - - incr : str - Determines the curve marking frequency. (a whole number value between 1 and 255). If ``INCR`` = - 1, markers are displayed at every data point on the curve. If ``INCR`` = 2 then markers are - displayed at every second data point. If ``INCR`` = 3 then they are displayed at every third - data point. - - Notes - ----- - - .. _s-GMARKER_notes: - - The user-specified markers will not be drawn when the area under the curve is color-filled ( - :ref:`gropt`, FILL). - """ - command = f"/GMARKER,{curve},{key},{incr}" + command = f"/FACET,{lab}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/views.py b/src/ansys/mapdl/core/_commands/graphics/views.py index a081955ed0b..b9dfab3f809 100644 --- a/src/ansys/mapdl/core/_commands/graphics/views.py +++ b/src/ansys/mapdl/core/_commands/graphics/views.py @@ -23,140 +23,30 @@ class Views: - def xfrm( - self, - lab: str = "", - x1: str = "", - y1: str = "", - z1: str = "", - x2: str = "", - y2: str = "", - z2: str = "", - **kwargs, - ): - r"""Controls the centroid or the axis of dynamic rotation. - - Mechanical APDL Command: `/XFRM `_ - - **Command default:** - - .. _s-XFRM_default: - - Issuing :ref:`xfrm`, with no ``LAB`` defined sets the center of rotation at the focal point - specified by the :ref:`focus` command. - - Parameters - ---------- - lab : str - The location or entity (centroid) used to define the center or axis of rotation. - - * ``NODE`` - If NODE is chosen for the center of rotation, the node number will be ``X1``. If the - rotation is to be about an axis, then ``X1`` and ``Y1`` define the two nodes between which a line is - drawn to determine the axis. The remaining arguments are ignored. - - * ``ELEMENT`` - If ELEMENT is chosen for the center of rotation, the element number will be ``X1``. - If the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two elements between which - a line is drawn to determine the axis. The remaining arguments are ignored. - - * ``KP`` - If KP is chosen for the center of rotation, the keypoint number will be ``X1``. If the - rotation is to be about an axis, then ``X1`` and ``Y1`` define the two keypoints between which a - line is drawn to determine the axis. The remaining arguments are ignored. - - * ``LINE`` - If LINE is chosen for the center of rotation, the line number will be ``X1``. If the - rotation is to be about an axis, then ``X1`` and ``Y1`` define the two lines between which a line is - drawn to determine the axis. The remaining arguments are ignored. - - * ``AREA`` - If AREA is chosen for the center of rotation, the area number will be ``X1``. If the - rotation is to be about an axis, then ``X1`` and ``Y1`` define the two areas between which a line is - drawn to determine the axis. The remaining arguments are ignored. - - * ``VOLUME`` - If VOLUME is chosen for the center of rotation, the volume number will be ``X1``. If - the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two volumes between which a - line is drawn to determine the axis. The remaining arguments are ignored. - - * ``XYZ`` - If XYZ is chosen for the center of rotation, the location of that center is determined - by the coordinates ``X1``, ``Y1``, ``Z1``. If values are specified for ``X2``, ``Y2``, ``Z2``, then - the axis of rotation will be about the line between those two points. - - * ``OFF`` - If ``LAB`` = OFF, DEFAULT, FOCUS or if no value is specified, then the center of - rotation is set at the FOCUS point, as defined by the :ref:`focus` command. - - x1 : str - The entity number or X coordinate for the center of rotation. - - y1 : str - The entity number or Y coordinate for the center of rotation. - - z1 : str - The Z coordinate for the center of rotation. - - x2 : str - The X coordinate for the axis of rotation. - - y2 : str - The Y coordinate for the axis of rotation. - - z2 : str - The Z coordinate for the axis of rotation. - - Notes - ----- - - .. _s-XFRM_notes: - - The :ref:`xfrm` command is active only when the cumulative rotation key is specified ON for the - :ref:`angle` command ( ``KINCR`` = 1). This command affects dynamic manipulations only. - - For center rotation, the middle mouse button will rotate the model about the screen Z axis and the - right mouse button will rotate the model about the screen X and Y axis. - - For rotation about an axis, the middle mouse button will rotate the model about the defined axis of - rotation and the right mouse button will be deactivated. - - This command is valid in any processor. - """ - command = f"/XFRM,{lab},{x1},{y1},{z1},{x2},{y2},{z2}" - return self.run(command, **kwargs) - - def vup(self, wn: str = "", label: str = "", **kwargs): - r"""Specifies the global Cartesian coordinate system reference orientation. + def user(self, wn: str = "", **kwargs): + r"""Conveniently resets :ref:`focus` and :ref:`dist` to USER. - Mechanical APDL Command: `/VUP `_ + Mechanical APDL Command: `/USER `_ Parameters ---------- wn : str Window number (or ALL) to which command applies (defaults to 1). - label : str - Orientation: - - * ``Y`` - Y vertical upward, X horizontal to the right, Z out from the screen (default). - - * ``-Y`` - Y vertical downward, X horizontal to the left, Z out from the screen. - - * ``X`` - X vertical upward, Y horizontal to the left, Z out from the screen. - - * ``-X`` - X vertical downward, Y horizontal to the right, Z out from the screen. - - * ``Z`` - Z vertical upward, Y horizontal to the right, X out from the screen. With this choice, you - should use a view other than the :ref:`view` default of (0,0,1). - - * ``-Z`` - Z vertical downward, Y horizontal to the left, X out from the screen. With this choice, - you should use a view other than the :ref:`view` default of (0,0,1). - Notes ----- - .. _s-VUP_notes: + .. _s-USER_notes: - Specifies the global Cartesian coordinate system reference orientation. The :ref:`view` and - :ref:`angle` commands may be used to reorient the view and are relative to this reference - orientation. All coordinate systems are right-handed. + Conveniently resets scale parameters to USER on the :ref:`focus` and :ref:`dist` commands. Scale + parameters will be internally respecified to those used for the last display. Convenient when the + last scale parameters were automatically calculated. User specified parameters hold until changed or + removed ( :ref:`auto` ). Parameters may be reset on the individual commands after this command has + been issued. This command is valid in any processor. """ - command = f"/VUP,{wn},{label}" + command = f"/USER,{wn}" return self.run(command, **kwargs) def vcone(self, wn: str = "", phi: str = "", **kwargs): @@ -189,17 +79,16 @@ def vcone(self, wn: str = "", phi: str = "", **kwargs): view cone) angle Φ as follows: M A G F = ℓ / 2 ( d ) T A N ϕ - where :math:``, for square windows, is thelargest in-plane vertical or horizontal dimension, d is - the distance fromthe observer to the plane ofnbsp :math:`` (usuallythe front plane of the + where :math:````, for square windows, is thelargest in-plane vertical or horizontal dimension, d is + the distance fromthe observer to the plane ofnbsp :math:```` (usuallythe front plane of the object), andnbsp:math:`\Phi` is the view cone angle (definedwith the :ref:`vcone` command). The bigger the cone angle, the more the perspective. The magnification factor proportionally decreases with increasing Φ. The distance can be defined with the :ref:`dist` or the :ref:`focus` command. Note, the distance input on the :ref:`dist` command is equal to d only if the focus point is located on - the plane of :math:``. It is recommended that if a general perspective is desired(that is, not any - specific cone angle), use :math:`\Phi` = 45.0 (since TAN(45.0) = 1.0)and let the d value be - automatically - calculated for full window magnification. + the plane of :math:````. It is recommended that if a general perspective is desired(that is, not + any specific cone angle), use :math:`\Phi` = 45.0 (since TAN(45.0) = 1.0)and let the d value be + automatically calculated for full window magnification. Note that any number of :ref:`dist`, :ref:`focus`, and :ref:`vcone` combinations can be used to produce the same magnification. Distances less than the object depth will produce views from within @@ -217,6 +106,47 @@ def vcone(self, wn: str = "", phi: str = "", **kwargs): command = f"/VCONE,{wn},{phi}" return self.run(command, **kwargs) + def vup(self, wn: str = "", label: str = "", **kwargs): + r"""Specifies the global Cartesian coordinate system reference orientation. + + Mechanical APDL Command: `/VUP `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + label : str + Orientation: + + * ``Y`` - Y vertical upward, X horizontal to the right, Z out from the screen (default). + + * ``-Y`` - Y vertical downward, X horizontal to the left, Z out from the screen. + + * ``X`` - X vertical upward, Y horizontal to the left, Z out from the screen. + + * ``-X`` - X vertical downward, Y horizontal to the right, Z out from the screen. + + * ``Z`` - Z vertical upward, Y horizontal to the right, X out from the screen. With this choice, you + should use a view other than the :ref:`view` default of (0,0,1). + + * ``-Z`` - Z vertical downward, Y horizontal to the left, X out from the screen. With this choice, + you should use a view other than the :ref:`view` default of (0,0,1). + + Notes + ----- + + .. _s-VUP_notes: + + Specifies the global Cartesian coordinate system reference orientation. The :ref:`view` and + :ref:`angle` commands may be used to reorient the view and are relative to this reference + orientation. All coordinate systems are right-handed. + + This command is valid in any processor. + """ + command = f"/VUP,{wn},{label}" + return self.run(command, **kwargs) + def view(self, wn: str = "", xv: str = "", yv: str = "", zv: str = "", **kwargs): r"""Defines the viewing direction for the display. @@ -263,137 +193,99 @@ def view(self, wn: str = "", xv: str = "", yv: str = "", zv: str = "", **kwargs) command = f"/VIEW,{wn},{xv},{yv},{zv}" return self.run(command, **kwargs) - def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): - r"""Specifies the viewing distance for magnifications and perspective. + def xfrm( + self, + lab: str = "", + x1: str = "", + y1: str = "", + z1: str = "", + x2: str = "", + y2: str = "", + z2: str = "", + **kwargs, + ): + r"""Controls the centroid or the axis of dynamic rotation. - Mechanical APDL Command: `/DIST `_ + Mechanical APDL Command: `/XFRM `_ **Command default:** - .. _s-DIST_default: - - Distance is automatically calculated to produce full window magnification. - - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). - - dval : str - Distance along the view line from the observer to the focus point (defaults to value producing - full- window display). Distances "too close" to the object will produce excessive - magnifications. If ``DVAL`` = AUTO, zero, or blank, the program will calculate the distance - automatically. If ``DVAL`` = USER, the distance of last display will be used (useful when last - display automatically calculated distance). - - kfact : int or str - ``DVAL`` interpretation key: - - * ``0`` - Interpret numerical ``DVAL`` values as described above. - - * ``1`` - Interpret ``DVAL`` as a multiplier on the current distance ( ``DVAL`` of 2 gives twice the - current distance; 0.5 gives half the current distance, etc.). - - Notes - ----- - - .. _s-DIST_notes: - - The scale factor is relative to the window shape. For example, for objects centered in a square - window and with parallel projection (no perspective), a distance of :math:`` /2 (+10%) producesa - full window magnification, where nbsp :math:`` isthe largest in-plane vertical or horizontal - dimension. See also :ref:`auto` and :ref:`user` commands. - - This command is valid in any processor. - """ - command = f"/DIST,{wn},{dval},{kfact}" - return self.run(command, **kwargs) - - def user(self, wn: str = "", **kwargs): - r"""Conveniently resets :ref:`focus` and :ref:`dist` to USER. + .. _s-XFRM_default: - Mechanical APDL Command: `/USER `_ + Issuing :ref:`xfrm`, with no ``LAB`` defined sets the center of rotation at the focal point + specified by the :ref:`focus` command. Parameters ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + lab : str + The location or entity (centroid) used to define the center or axis of rotation. - Notes - ----- + * ``NODE`` - If NODE is chosen for the center of rotation, the node number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two nodes between which a line is + drawn to determine the axis. The remaining arguments are ignored. - .. _s-USER_notes: + * ``ELEMENT`` - If ELEMENT is chosen for the center of rotation, the element number will be ``X1``. + If the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two elements between which + a line is drawn to determine the axis. The remaining arguments are ignored. - Conveniently resets scale parameters to USER on the :ref:`focus` and :ref:`dist` commands. Scale - parameters will be internally respecified to those used for the last display. Convenient when the - last scale parameters were automatically calculated. User specified parameters hold until changed or - removed ( :ref:`auto` ). Parameters may be reset on the individual commands after this command has - been issued. + * ``KP`` - If KP is chosen for the center of rotation, the keypoint number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two keypoints between which a + line is drawn to determine the axis. The remaining arguments are ignored. - This command is valid in any processor. - """ - command = f"/USER,{wn}" - return self.run(command, **kwargs) + * ``LINE`` - If LINE is chosen for the center of rotation, the line number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two lines between which a line is + drawn to determine the axis. The remaining arguments are ignored. - def focus( - self, - wn: str = "", - xf: str = "", - yf: str = "", - zf: str = "", - ktrans: int | str = "", - **kwargs, - ): - r"""Specifies the focus point (center of the window). + * ``AREA`` - If AREA is chosen for the center of rotation, the area number will be ``X1``. If the + rotation is to be about an axis, then ``X1`` and ``Y1`` define the two areas between which a line is + drawn to determine the axis. The remaining arguments are ignored. - Mechanical APDL Command: `/FOCUS `_ + * ``VOLUME`` - If VOLUME is chosen for the center of rotation, the volume number will be ``X1``. If + the rotation is to be about an axis, then ``X1`` and ``Y1`` define the two volumes between which a + line is drawn to determine the axis. The remaining arguments are ignored. - Parameters - ---------- - wn : str - Window number (or ALL) to which command applies (defaults to 1). + * ``XYZ`` - If XYZ is chosen for the center of rotation, the location of that center is determined + by the coordinates ``X1``, ``Y1``, ``Z1``. If values are specified for ``X2``, ``Y2``, ``Z2``, then + the axis of rotation will be about the line between those two points. - xf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). + * ``OFF`` - If ``LAB`` = OFF, DEFAULT, FOCUS or if no value is specified, then the center of + rotation is set at the FOCUS point, as defined by the :ref:`focus` command. - yf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). + x1 : str + The entity number or X coordinate for the center of rotation. - zf : str - Location of the object to be at the focus point (center of the window) in the global Cartesian - coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use - focus location of last display (useful when last display had auto focus). + y1 : str + The entity number or Y coordinate for the center of rotation. - ktrans : int or str - Translate key: + z1 : str + The Z coordinate for the center of rotation. - * ``0`` - Interpret numerical ``XF``, ``YF``, ``ZF`` values as described above. + x2 : str + The X coordinate for the axis of rotation. - * ``1`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the - current position in the screen coordinate system. Example: ``XF`` of 2.4 translates the display - approximately 2.4 half-screens to the left in the screen X (horizontal) direction. + y2 : str + The Y coordinate for the axis of rotation. - * ``2`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the - current position in the global Cartesian coordinate system. Example: ``XF`` of 1.5 translates the - display approximately 1.5 half-screens in the global Cartesian X direction of the model. + z2 : str + The Z coordinate for the axis of rotation. Notes ----- - .. _s-FOCUS_notes: + .. _s-XFRM_notes: - Specifies the location on (or off) the model which is to be located at the focus point (center of - the window). For section and capped displays, the cutting plane is also assumed to pass through this - location (unless the working plane is used via :ref:`cplane` ). See also :ref:`auto` and :ref:`user` - commands. + The :ref:`xfrm` command is active only when the cumulative rotation key is specified ON for the + :ref:`angle` command ( ``KINCR`` = 1). This command affects dynamic manipulations only. + + For center rotation, the middle mouse button will rotate the model about the screen Z axis and the + right mouse button will rotate the model about the screen X and Y axis. + + For rotation about an axis, the middle mouse button will rotate the model about the defined axis of + rotation and the right mouse button will be deactivated. This command is valid in any processor. """ - command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" + command = f"/XFRM,{lab},{x1},{y1},{z1},{x2},{y2},{z2}" return self.run(command, **kwargs) def angle( @@ -467,6 +359,52 @@ def auto(self, wn: str = "", **kwargs): command = f"/AUTO,{wn}" return self.run(command, **kwargs) + def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): + r"""Specifies the viewing distance for magnifications and perspective. + + Mechanical APDL Command: `/DIST `_ + + **Command default:** + + .. _s-DIST_default: + + Distance is automatically calculated to produce full window magnification. + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + dval : str + Distance along the view line from the observer to the focus point (defaults to value producing + full- window display). Distances "too close" to the object will produce excessive + magnifications. If ``DVAL`` = AUTO, zero, or blank, the program will calculate the distance + automatically. If ``DVAL`` = USER, the distance of last display will be used (useful when last + display automatically calculated distance). + + kfact : int or str + ``DVAL`` interpretation key: + + * ``0`` - Interpret numerical ``DVAL`` values as described above. + + * ``1`` - Interpret ``DVAL`` as a multiplier on the current distance ( ``DVAL`` of 2 gives twice the + current distance; 0.5 gives half the current distance, etc.). + + Notes + ----- + + .. _s-DIST_notes: + + The scale factor is relative to the window shape. For example, for objects centered in a square + window and with parallel projection (no perspective), a distance of :math:```` /2 (+10%) producesa + full window magnification, where nbsp :math:```` isthe largest in-plane vertical or horizontal + dimension. See also :ref:`auto` and :ref:`user` commands. + + This command is valid in any processor. + """ + command = f"/DIST,{wn},{dval},{kfact}" + return self.run(command, **kwargs) + def zoom( self, wn: str = "", @@ -543,3 +481,64 @@ def zoom( """ command = f"/ZOOM,{wn},{lab},{x1},{y1},{x2},{y2}" return self.run(command, **kwargs) + + def focus( + self, + wn: str = "", + xf: str = "", + yf: str = "", + zf: str = "", + ktrans: int | str = "", + **kwargs, + ): + r"""Specifies the focus point (center of the window). + + Mechanical APDL Command: `/FOCUS `_ + + Parameters + ---------- + wn : str + Window number (or ALL) to which command applies (defaults to 1). + + xf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + yf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + zf : str + Location of the object to be at the focus point (center of the window) in the global Cartesian + coordinate system. If ``XF`` = AUTO, allow automatic location calculation. If ``XF`` = USER, use + focus location of last display (useful when last display had auto focus). + + ktrans : int or str + Translate key: + + * ``0`` - Interpret numerical ``XF``, ``YF``, ``ZF`` values as described above. + + * ``1`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the + current position in the screen coordinate system. Example: ``XF`` of 2.4 translates the display + approximately 2.4 half-screens to the left in the screen X (horizontal) direction. + + * ``2`` - Interpret ``XF``, ``YF``, ``ZF`` values as multiples of half-screens to translate from the + current position in the global Cartesian coordinate system. Example: ``XF`` of 1.5 translates the + display approximately 1.5 half-screens in the global Cartesian X direction of the model. + + Notes + ----- + + .. _s-FOCUS_notes: + + Specifies the location on (or off) the model which is to be located at the focus point (center of + the window). For section and capped displays, the cutting plane is also assumed to pass through this + location (unless the working plane is used via :ref:`cplane` ). See also :ref:`auto` and :ref:`user` + commands. + + This command is valid in any processor. + """ + command = f"/FOCUS,{wn},{xf},{yf},{zf},{ktrans}" + return self.run(command, **kwargs) From 212fa690cbed049a829fc0c111c5b1b235bc8e5c Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:16:34 +0200 Subject: [PATCH 09/10] fix: latest changes --- .../core/_commands/graphics/annotation.py | 6 +-- .../mapdl/core/_commands/graphics/labeling.py | 45 ++++++++++--------- .../mapdl/core/_commands/graphics/set_up.py | 2 +- .../mapdl/core/_commands/graphics/views.py | 17 +++---- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/ansys/mapdl/core/_commands/graphics/annotation.py b/src/ansys/mapdl/core/_commands/graphics/annotation.py index f9874e7aee5..c86b2d64c19 100644 --- a/src/ansys/mapdl/core/_commands/graphics/annotation.py +++ b/src/ansys/mapdl/core/_commands/graphics/annotation.py @@ -80,7 +80,7 @@ def polygon( Parameters ---------- nvert : str - Number of vertices of polygon (3 :math:```` ``NVERT`` :math:```` 8). Use :ref:`pmore` for + Number of vertices of polygon (3 :math:`` ``NVERT`` :math:`` 8). Use :ref:`pmore` for polygons with more than 4 vertices. x1 : str @@ -142,7 +142,7 @@ def slashpspec( Parameters ---------- pcolor : int or str - Polygon color (0 :math:```` ``PCOLOR`` :math:```` 15): + Polygon color (0 :math:`` ``PCOLOR`` :math:`` 15): * ``0`` - Black. @@ -546,7 +546,7 @@ def tspec( Parameters ---------- tcolor : int or str - Text color (0 :math:```` ``TCOLOR`` :math:```` 15): + Text color (0 :math:`` ``TCOLOR`` :math:`` 15): * ``0`` - Black. diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py index 94b07f2d6c2..afba8753e97 100644 --- a/src/ansys/mapdl/core/_commands/graphics/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -74,14 +74,14 @@ def plopts(self, label: str = "", key: int | str = "", **kwargs): * ``DATE`` - Controls the display of the date and time in your legend. Subsequent ``KEY`` values control the display as follows: - * 0 – No date or time displays are included in your legend. - * 1 – Only the date is shown. - * 2 – Both the date and time are shown (default). + * 0 - No date or time displays are included in your legend. + * 1 - Only the date is shown. + * 2 - Both the date and time are shown (default). * ``FILE`` - Controls the display of the Mechanical APDL jobname in your legend. Subsequent ``KEY`` values control the display as follows: - * 0 – The Mechanical APDL jobname is not included in your legend (default). - * 1 – The Mechanical APDL jobname is included in your legend. + * 0 - The Mechanical APDL jobname is not included in your legend (default). + * 1 - The Mechanical APDL jobname is included in your legend. key : int or str Switch: @@ -216,7 +216,7 @@ def pbc( * ``ROT`` - Applied rotational constraints (ROTX, ROTY, ROTZ). - * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3...., TTOP). + * ``TEMP`` - Applied temperatures (TEMP, TBOT, TE2, TE3,..., TTOP). * ``PRES`` - Applied fluid pressures. @@ -236,7 +236,7 @@ def pbc( * ``M or MOME`` - Applied structural moments (MX, MY, MZ). - * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3...., HTOP). + * ``HEAT`` - Applied heat flows (HEAT, HBOT, HE2, HE3,..., HTOP). * ``FLOW`` - Applied fluid flow. @@ -356,10 +356,10 @@ def psf( Parameters ---------- item : str - Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. + Labels identifying the surface load to be shown; see :ref:`psf_tab_1`. comp : str - Labels identifying the surface load to be shown; see :ref:`psf.tab.1`. + Labels identifying the surface load to be shown; see :ref:`psf_tab_1`. key : int or str Key to turn surface load symbols on or off: @@ -434,9 +434,10 @@ def psf( This command is valid in any processor. - .. _psf.tab.1: + .. _psf_tab_1: - **/PSF - Valid Item and Component Labels** + /PSF - Valid Item and Component Labels + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. flat-table:: :header-rows: 1 @@ -445,13 +446,13 @@ def psf( - Comp - Description - Comments - * - :rspan:`14` PRES [ :ref:`psf.labels.fn.1`] + * - :rspan:`14` PRES [ :ref:`psf_labels_fn_1`] - NORM (or blank) - Applied pressure normal to the face (real component only). - For element types other than ``SURF153``, ``SURF154``and ``SURF156``. * - NORM - Applied pressure normal to the face (real component). - - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ :ref:`psf.labels.fn.2`] + - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 0. For `supported structural elements`_ with``KCSYS`` = 0. [ :ref:`psf_labels_fn_2`] * - TANX - Applied pressure in the element tangential x direction (real component). * - TANY @@ -464,7 +465,7 @@ def psf( - Applied pressure in the element tangential y direction (imaginary component). * - LOCX - Applied pressure in the local x direction (real component). - - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ :ref:`psf.labels.fn.2`] + - :rspan:`5` For element types ``SURF153``, ``SURF154``and ``SURF156``with KEYOPT(2) = 1. For `supported structural element`_ with``KCSYS`` = 1. [ :ref:`psf_labels_fn_2`] * - LOCY - Applied pressure in the local y direction (real component). * - LOCZ @@ -477,7 +478,7 @@ def psf( - Applied pressure in the local z direction (imaginary component). * - RVEC - Applied pressure in the user-defined direction (real component). - - :rspan:`1` For `supported structural element`_ with``KCSYS`` = 2. [ :ref:`psf.labels.fn.2`] + - :rspan:`1` For `supported structural element`_ with``KCSYS`` = 2. [ :ref:`psf_labels_fn_2`] * - IVEC - Applied pressure in the user-defined direction (imaginary component). * - :rspan:`1` CONV @@ -541,9 +542,13 @@ def psf( - Boundary layer impedance flag. - + .. _psf_labels_fn_1: + Pressure loads apply to the element coordinate system (KEYOPT(2) = 0). Adjust appropriately for a local coordinate system (KEYOPT(2) = 1). See, and in the Element Reference. + .. _psf_labels_fn_2: + ``KCSYS`` is specified when issuing :ref:`sfcontrol`. """ command = f"/PSF,{item},{comp},{key},{kshell},{color}" @@ -664,19 +669,19 @@ def pnum(self, label: str = "", key: int | str = "", **kwargs): * ``ELEM`` - Element numbers and colors on element plots. - * ``SEC`` - Section numbers and colors on element and solid model plots (see :ref:`s-PNUM.notes`). + * ``SEC`` - Section numbers and colors on element and solid model plots (see :ref:`s-PNUM_notes`). * ``MAT`` - Material set numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). + :ref:`s-PNUM_notes`). * ``TYPE`` - Element type reference numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). + :ref:`s-PNUM_notes`). * ``REAL`` - Real constant set numbers and colors on element and solid model plots (see - :ref:`s-PNUM.notes`). + :ref:`s-PNUM_notes`). * ``ESYS`` - Element coordinate system numbers on element and solid model plots (see - :ref:`s-PNUM.notes`). + :ref:`s-PNUM_notes`). * ``LOC`` - Location numbers/colors of the element in matrix assembly order on element plots. diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index 23515b85376..f733ec972c8 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -1170,7 +1170,7 @@ def device(self, label: str = "", key: int | str = "", **kwargs): parameters. These values are device specific; using the same command input file ( :ref:`input` ) on different machines may yield different results.. The following ``KEY`` values determine the font information that will be supplied to the appropriate driver (for example, Postscript, X11, Win32, - JPEG....): + JPEG,...): * ``KEY = 1`` - The command controls the LEGEND (documentation column) font. diff --git a/src/ansys/mapdl/core/_commands/graphics/views.py b/src/ansys/mapdl/core/_commands/graphics/views.py index b9dfab3f809..906e89f7bbf 100644 --- a/src/ansys/mapdl/core/_commands/graphics/views.py +++ b/src/ansys/mapdl/core/_commands/graphics/views.py @@ -79,16 +79,17 @@ def vcone(self, wn: str = "", phi: str = "", **kwargs): view cone) angle Φ as follows: M A G F = ℓ / 2 ( d ) T A N ϕ - where :math:````, for square windows, is thelargest in-plane vertical or horizontal dimension, d is - the distance fromthe observer to the plane ofnbsp :math:```` (usuallythe front plane of the - object), andnbsp:math:`\Phi` is the view cone angle (definedwith the :ref:`vcone` command). The + where :math:``, for square windows, is thelargest in-plane vertical or horizontal dimension, d is + the distance fromthe observer to the plane of :math:`` (usuallythe front plane of the + object), and :math:`\Phi` is the view cone angle (definedwith the :ref:`vcone` command). The bigger the cone angle, the more the perspective. The magnification factor proportionally decreases with increasing Φ. The distance can be defined with the :ref:`dist` or the :ref:`focus` command. Note, the distance input on the :ref:`dist` command is equal to d only if the focus point is located on - the plane of :math:````. It is recommended that if a general perspective is desired(that is, not - any specific cone angle), use :math:`\Phi` = 45.0 (since TAN(45.0) = 1.0)and let the d value be - automatically calculated for full window magnification. + the plane of :math:``. It is recommended that if a general perspective is desired(that is, not any + specific cone angle), use :math:`\Phi` = 45.0 (since TAN(45.0) = 1.0)and let the d value be + automatically + calculated for full window magnification. Note that any number of :ref:`dist`, :ref:`focus`, and :ref:`vcone` combinations can be used to produce the same magnification. Distances less than the object depth will produce views from within @@ -396,8 +397,8 @@ def dist(self, wn: str = "", dval: str = "", kfact: int | str = "", **kwargs): .. _s-DIST_notes: The scale factor is relative to the window shape. For example, for objects centered in a square - window and with parallel projection (no perspective), a distance of :math:```` /2 (+10%) producesa - full window magnification, where nbsp :math:```` isthe largest in-plane vertical or horizontal + window and with parallel projection (no perspective), a distance of :math:`` /2 (+10%) producesa + full window magnification, where :math:`` isthe largest in-plane vertical or horizontal dimension. See also :ref:`auto` and :ref:`user` commands. This command is valid in any processor. From d61118a420416a84c434b3b821c07ceb7b95d6cc Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:34:10 +0200 Subject: [PATCH 10/10] feat: latest enhancements --- src/ansys/mapdl/core/_commands/graphics/labeling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/mapdl/core/_commands/graphics/labeling.py b/src/ansys/mapdl/core/_commands/graphics/labeling.py index afba8753e97..3cd5c96c1ec 100644 --- a/src/ansys/mapdl/core/_commands/graphics/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics/labeling.py @@ -437,7 +437,7 @@ def psf( .. _psf_tab_1: /PSF - Valid Item and Component Labels - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ************************************** .. flat-table:: :header-rows: 1