ansys / pymapdl

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

TypeError: DisplayPlot() missing 1 required positional argument: 'text' #34

Closed csevast closed 6 years ago

csevast commented 6 years ago

Dear Alex,

I tried to start the interactive_plotting mode of pyansys in my old laptop with Windows 7 and the following error raised.

""" In [7]: ansys = pyansys.ANSYS(run_location=path, interactive_plotting=True) Cached ANSYS executable not found Found ANSYS at C:\Program Files\ANSYS Inc\v181\ANSYS\bin\winx64\ansys181.exe Use this location? [Y/n]y

Exception Traceback (most recent call last)

in () ----> 1 ansys = pyansys.ANSYS(run_location=path, interactive_plotting=True) C:\dev\Miniconda3\lib\site-packages\pyansys\ansys.py in __init__(self, exec_file, run_location, jobname, nproc, override, loglevel, additional_switches, start_timeout, interactive_plotting, log_broadcast, check_version, prefer_pexpect) 387 raise Exception('Lock file exists for jobname %s \n' % self.jobname + 388 ' at %s' % self.lockfile + --> 389 'Set override=True to delete lock and start ANSYS') 390 else: 391 os.remove(self.lockfile) Exception: Lock file exists for jobname file at C:\Users\csevast\Documents\file.lockSet override=True to delete lock and start ANSYS In [8]: ansys = pyansys.ANSYS(run_location=path, interactive_plotting=True) Cached ANSYS executable not found Found ANSYS at C:\Program Files\ANSYS Inc\v181\ANSYS\bin\winx64\ansys181.exe Use this location? [Y/n]y 2018-08-06 19:20:19,103 [INFO] pyansys.ansys: Connecting to ANSYS via CORBA 2018-08-06 19:20:25,386 [INFO] pyansys.ansys: /SHOW SWITCH PLOTS TO PNG - RASTER MODE. In [9]: ansys.Prep7() 2018-08-06 19:20:43,127 [INFO] pyansys.ansys: *** ANSYS - ENGINEERING ANALYSIS SYSTEM RELEASE Release 18.1 18.1 *** ANSYS Academic Teaching Advanced 01039803 VERSION=WINDOWS x64 19:20:43 AUG 06, 2018 CP= 0.593 ***** ANSYS ANALYSIS DEFINITION (PREP7) ***** --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 ansys.Prep7() C:\dev\Miniconda3\lib\site-packages\pyansys\ansys_functions.py in Prep7(self, **kwargs) 26206 """ 26207 command = "/PREP7," % () > 26208 return self.Run(command, **kwargs) 26209 26210 def Force(self, lab="", **kwargs): C:\dev\Miniconda3\lib\site-packages\pyansys\ansys.py in Run(self, command) 486 def Run(self, command): 487 if self.using_corba: --> 488 return self.RunCorbaCommand(command) 489 else: 490 return self.RunProcessCommand(command) C:\dev\Miniconda3\lib\site-packages\pyansys\ansys.py in RunCorbaCommand(self, command) 679 680 if self._interactive_plotting: --> 681 self.DisplayPlot() 682 683 return text, additional_text TypeError: DisplayPlot() missing 1 required positional argument: 'text' In [10]: """
akaszynski commented 6 years ago

Good catch. Fixed in 0.31.1 https://pypi.org/project/pyansys/0.30.1/

csevast commented 6 years ago

It is tested in the new release and it is ok.

Christos

akaszynski commented 6 years ago

Just so you know, I'm still not completely satisfied with the CORBA interface. Either ANSYS didn't put a lot of time into their software, or there's some fundamental limitations to the interface. Any command that changes the stdin or stdout breaks connection to the server or doesn't work. This includes the following commands that I know of:

I'm going to have to find a workaround within ANSYS or write a wrapper for these commands that redirects the output through the CORBA interface using Python. Any help would be greatly appreciated.

Thanks for testing the changes and updates thus far!

Alex

csevast commented 6 years ago

Dear Alex,

The /INPUT is very important for me because I am using it intensively in my APDL scripting. I am not sure that I can help you for the moment because I am abroad for holidays. After August I will start again. In meantime I found the following broken commands in pyansys github page examples:

""" Loading and Plotting an ANSYS Archive File

Get the 1st bending mode shape. Nodes are ordered according to nnum.

-- disp = result.GetNodalResult(0, True) # uses 0 based indexing ++ disp = result.NodalSolution(0) # uses 0 based indexing

Loading and Plotting an ANSYS Result File

Plot the displacement of the 1st in the x direction

-- result.PlotNodalResult(0, 'x', label='Displacement') ++ result.PlotNodalSolution(0, 'x', label='Displacement')

Reading a Full File

++ from pyansys import examples

-- fobj = pyansys.FullReader('file.full') ++ fobj = pyansys.FullReader(examples.fullfile)

++ import numpy as np

-- print '{:.3f} Hz'.format(f[i]) ++ print('{:.3f} Hz'.format(f[i])) """

Sincerely Christos

csevast commented 6 years ago

Dear Alex,

I tried the /INPUT command, let say ansys.Input('test.inp", "C:\tmp"), in interactive mode, it was successful and there was no connection breakdown. May be I didn't understand the problem.

Christos

On 8 August 2018 at 09:59, Alex Kaszynski notifications@github.com wrote:

Just so you know, I'm still not completely satisfied with the CORBA interface. Either ANSYS didn't put a lot of time into their software, or there's some fundamental limitations to the interface. Any command that changes the stdin or stdout breaks connection to the server or doesn't work. This includes the following commands that I know of:

  • /INPUT
  • VWRITE
  • CDREAD

I'm going to have to find a workaround within ANSYS or write a wrapper for these commands that redirects the output through the CORBA interface using Python. Any help would be greatly appreciated.

Thanks for testing the changes and updates thus far!

Alex

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akaszynski/pyansys/issues/34#issuecomment-411321420, or mute the thread https://github.com/notifications/unsubscribe-auth/AYDNp1qVf2_rAyl6T7RB7i9gXG5U9hXSks5uOppvgaJpZM4VwzbD .

akaszynski commented 6 years ago

That’s good news. I check again on my end. Thanks for testing it out! Let me know if you encounter any issues.

On Fri, Aug 10, 2018 at 21:00, Christos Sevastiadis < notifications@github.com> wrote:

Dear Alex,

I tried the /INPUT command, let say ansys.Input('test.inp", "C:\tmp"), in interactive mode, it was successful and there was no connection breakdown. May be I didn't understand the problem.

Christos

On 8 August 2018 at 09:59, Alex Kaszynski notifications@github.com wrote:

Just so you know, I'm still not completely satisfied with the CORBA interface. Either ANSYS didn't put a lot of time into their software, or there's some fundamental limitations to the interface. Any command that changes the stdin or stdout breaks connection to the server or doesn't work. This includes the following commands that I know of:

  • /INPUT
  • VWRITE
  • CDREAD

I'm going to have to find a workaround within ANSYS or write a wrapper for these commands that redirects the output through the CORBA interface using Python. Any help would be greatly appreciated.

Thanks for testing the changes and updates thus far!

Alex

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/akaszynski/pyansys/issues/34#issuecomment-411321420 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AYDNp1qVf2_rAyl6T7RB7i9gXG5U9hXSks5uOppvgaJpZM4VwzbD

.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/akaszynski/pyansys/issues/34#issuecomment-412175744, or mute the thread https://github.com/notifications/unsubscribe-auth/ALbTP1HR8vKm9VdNDcO39xHGGL1kkFD3ks5uPdhlgaJpZM4VwzbD .