ansys / ansys/pymapdl-examples

Needs to improve mapdl.get() functionality

Open
#116 1 comment 0 reactions 1 assignee Claimed by @clatapie View on GitHub
bug
Dominant language
Python
Stars
7
Forks
6
PR merge metrics
No merged PRs in 30d

Description

### 🔍 Before submitting the issue

- [X] I have searched among the existing issues
- [X] I am using a Python virtual environment

### 🐞 Description of the bug

In PyMAPDL, to store the parameter value, we use direct python assignment as shown below.
strss_tens = mapdl.get("STS_TENS", "SECR", 1, "S", "X", "MAX")

Hence, the value return by *Get command is stored to the variable. So, if the command echo's value along with String, it will also be stored to the variable. Due to this reason, above variable ("strss_tens") type is string instead of floating/integer.

The current GET class implementation in PyMAPDL, is simply a mirror image of MAPDL *get command functionality. Using below workaround we can still store the floating value to the variable.
strss_tens = **float**(mapdl.get("STS_TENS", "SECR", 1, "S", "X", "MAX")**[:11]**

However, it will be nice, if PyMAPDL Get function handle it internally and return floating value to the variable.
![download1](https://github.com/ansys/pymapdl-examples/assets/126097319/ffbb47d6-fb35-402a-b1f3-f4c49e16553a)
![download2](https://github.com/ansys/pymapdl-examples/assets/126097319/12beecb4-9a7a-454d-8e4d-8b97ed87eb96)

### 📝 Steps to reproduce

Described as above.

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

Ansys v2023R2

### 🐍 Which Python version are you using?

3.8

### 📦 Installed packages

```shell
pip install ansys-mapdl-core
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.