question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mapdl.get() gives an empty string if we have mapdl.nopr() issued before mapdl.get()

See original GitHub issue

The below mapdl.get() command should get the number of result sets in the rst file. In the below command deck, Anzset_python is correctly printed (float).

mapdl.post1()
mapdl.file(fname="Simple_Cantilever",ext="rst")
mapdl.set(1, 1)
#mapdl.nopr()
Anzset_python = mapdl.get(par="Anzset_mapdl", entity="ACTIVE", entnum="", item1="set", it1num="nset")
print('Number of sets: Python Variable -->', Anzset_python)
Number of sets: Python Variable --> 1.0

However, when I activate the mapdl.nopr() command, Anzet_python gives an empty string. Is this a bug?

mapdl.post1()
mapdl.file(fname="Simple_Cantilever",ext="rst")
mapdl.set(1, 1)
mapdl.nopr()
Anzset_python = mapdl.get(par="Anzset_mapdl", entity="ACTIVE", entnum="", item1="set", it1num="nset")
print('Number of sets: Python Variable -->', Anzset_python)
Number of sets: Python Variable --> 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
akaszynskicommented, Sep 30, 2021

What about Query? Is it also likely to be deprecated?

The Query methods are unlikely to be deprecated in the near future as they perform several valuable, but we’re going to fix the documentation to use mapdl.queries instead of from ansys.mapdl.core import Query.

Agree in regards to using get_value rather than get. @jgd10, can you refactor this?

1reaction
akaszynskicommented, Sep 29, 2021

The legacy method get relies on printing an output and then parsing the text and will likely be deprecated (or moved) as we work to expose more features using modern, direct methods. The get_value method does this as it directly requests the data from the server, thus avoiding writing any intermediate text.

In the meantime, I’d do the following:

  • Use get_value rather than get unless you need to store the parameter within MAPDL and grab it at the same time.
  • @germa89, make /NOPR a unsupported when issued from mapdl.nopr and run() (really, just capture the request at run). We can allow it to be run from _run just in case we need to issue it temporarily, but I think that you’re right, there overlap already with mute.
Read more comments on GitHub >

github_iconTop Results From Across the Web

ANSYS Mechanical APDL Command Reference - BME-MM
If you are unable to access the Legal Notice, please contact ANSYS, Inc. Published in the ... as shown in this example:*GET command...
Read more >
Manipulating Text Strings in ANSYS Mechanical APDL - PADT
Before we talk about manipulating strings, we should do some background on strings. Strings can either be stored as a character parameter or...
Read more >
Using *TREAD in Ansys Mechanical APDL to Read External ...
Engineers using TREAD command in Ansys or the *VREAD command to get data into Ansys Mechanical APDL, sometimes get stuck in the process....
Read more >
Implement the APDL *GET shortcuts in PyMAPDL #504 - GitHub
Implement pymapdl versions of APDL *GET shortcuts. See the APDL *GET documentation to see the exact values N can take in the examples...
Read more >
sheldon's ansys.net-Undocumented Features
Undocumented commands & features are not guaranteed or supported by ANSYS ... The answer is to get the msgpop status before you change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found