Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Use MATLAB to call ANSYS

TAGGED: 

    • Yinzhong Hu
      Subscriber

      In matlab, I use statements like this "s1="E:ANSYS2022ANSYSv221ansysbinwinx64ANSYS221.exe -b -i C:UsersLYDesktoptesttxt write to override experimenttest01 (test).txt -o C:UsersLYDesktoptesttxt to write override experiment"; "to call ansys and execute the command stream I've written.Now I hope that in this way I can save the calculated stress contour diagram, I don't know if this way is possible, I hope you can help me achieve this requirement. I've used a statement like this in the picture in the command flow, but I can't save the stress contour diagram. However, I opened ansys APDL and imported the written command stream (.txt) text, which saved the stress contours

    • mrife
      Ansys Employee

      Hi Yinzhong

      In Batch mode (the -b flag on the command line) there is no graphics window to capture.  Instead use the /SHOW command to redirect a plot to a file:

      /eshape,1,,

      /show,png

      plnsol,s,eqv

      /show

       

      • Yinzhong Hu
        Subscriber

        Thank you very much, I managed to save the picture, but it didn't meet my expectations, I want to be able to save the 3D model, not a line. That's how I modeled it .

         

    • mrife
      Ansys Employee

      Looks like the /eshape,1 is missing

    • Yinzhong Hu
      Subscriber
      The command I used was:
      /eshape,1,,
       
      /show,png
       
      plnsol,s,eqv
       
      /show
      I used the /eshape,1 command, and now I'm confused

    • mrife
      Ansys Employee

      Hi Yinzhong

      Sorry, I forgot about the /GRAPHICS command!  We need to change the graphics display as well to Power Graphics.  So try:

      /post1
      set,last
      /graph,power
      /eshape,1
      /view,1,1,1,1
      eplot
      /show,png
      plnsol,s,eqv
      /show
      /rep
      finish

       

      • Yinzhong Hu
        Subscriber

        Thank you, this way I open Mecheanical APDL Product Launcher, and then read the file I wrote in advance (.dat) can meet the requirements. But I use matlab invoking ansys (" s1 = "E: ANSYS2022ANSYSv221ansysbinwinx64ANSYS221. Exe - b - C: I UsersLYDesktoptesttxt write to override experimenttest01 (test).txt -o C:UsersLYDesktoptesttxt to write override experiment";) There are still problems. As you can see from the result file, the program will stop at this step (plnsol,s,eqv), and eventually the program will stop running. I wonder if there is something wrong with my ansys setup?

Viewing 4 reply threads
  • The topic ‘Use MATLAB to call ANSYS’ is closed to new replies.
[bingo_chatbox]