ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
424 stars 120 forks source link

Use chain_commands in convert_script #3153

Closed mikerife closed 3 months ago

mikerife commented 3 months ago

Description of the feature

In an MAPDL input file the following commands: type,11 $real,11 $mat,11 Will be translated to the following by the PyMAPDL convert_script:

mapdl.type("11 $real", "11 $mat", 11)

Would it be possible to instead translate them to a chain_commands style like so?


with mapdl.chain_commands:
     mapdl.type(11)
     mapdl.real(11)
     mapdl.mat(11)

### Steps for implementing the feature

Do that Python scripting that you do....

### Useful links and references

_No response_
germa89 commented 3 months ago

mmhh...

The easiest would be to just avoid converting that line if there is a $ symbol.

Wrapping it in a context manager requires more work I think