How to export a mesh file as STL in ansys fluent?

CoolHarrison
CoolHarrison Member Posts: 18
10 Comments
**

This is the main section of code where I try to export a mesh file:

generate_volume_mesh = workflow.TaskObject["Generate the Volume Mesh"]
generate_volume_mesh.Arguments.update_dict({"VolumeFill": "poly-hexcore"})
generate_volume_mesh.Execute()

mesh_file = r"C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\my_mesh.stl"
session.tui.file.export.stl("ANSYS Fluent", "2024R1", "meshing", mesh_file)

The error happens at the last line of code. When that code is ran, it tells me this:

Exception has occurred: RuntimeError
menu not found
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.UNKNOWN
    details = "menu not found"
    debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-10-20T20:51:02.9016385+00:00", grpc_status:2, grpc_message:"menu not found"}"
>

During handling of the above exception, another exception occurred:

  File "C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\fluentTest2.py", line 109, in <module>
    session.tui.file.export.stl("ANSYS Fluent", "2024R1", "meshing", mesh_file)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: menu not found

In the Pyfluent documentation, it says that the stl class has 4 inputs; service, version, mode and path. It's possible that these inputs are wrong, but I'm not really sure what they should be changed to. It's also possible that the function is wrong, but again i'm not sure.

Answers

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 312
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited October 2024

    Hi

    I have not used pyfluent, but try just adding like here (
    https://github.com/ansys/pyfluent/issues/2188 ):

    ...tui.file.export.stl(file_name = r"C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\my_mesh.stl")

    If this does not help then post here for more help:

    https://github.com/ansys/pyfluent/discussions

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 312
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    @CoolHarrison

    Can you try not saving on Onedrive - just save on C or D somewhere.

    All the best

    Erik

    PS: use this way:

    .tui.file.export.stl(file_name = r"C:\Users....\Documents\GitHub\F1car-wAI\my_mesh.stl")

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 312
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
  • CoolHarrison
    CoolHarrison Member Posts: 18
    10 Comments
    **

    Hello Erik,

    I was the one who posted that question as you advised me to do. However, this code:
    session.tui.file.export.stl(file_name=r"C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\my_mesh.msh.h5")
    or this code:
    session.tui.file.export.stl("D:\Pyfluent\my_mesh.msh.h5")
    has ended in failure. Every single variation I'e tried with and without file_name= has always given me this error:

    Exception has occurred: RuntimeError
    menu not found
    grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "menu not found"
        debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-10-28T18:33:43.2009622+00:00", grpc_status:2, grpc_message:"menu not found"}"
    >
    
    During handling of the above exception, another exception occurred:
    
      File "C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\fluentTest2.py", line 215, in <module>
        session.tui.file.export.stl("D:\Pyfluent\my_mesh.msh.h5")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: menu not found
    

    The code from the github said that this works:
    meshing.tui.file.export.stl("D:\pyfluent\FM_AAPQ13pUvWxQtxN_86052\TaskObject23.msh.h5")
    But since my computer doesn't have this exact file location, I haven't been able to replicate it accurately. Instead of D\Pyfluent, my files generate in C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI. I tried making it generate in C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\FM_LAPTOP-U99GAPOP_1260. but nothing.

    In truth, I really think it would help me if I understood why the problem is happening. I'm just not sure why the file location should have any effect on the effectiveness of the code. Maybe it's a version issue or a function issue, but I can't seem to make it work. Would you like my entire code more some incite into it? Maybe something else is having an effect.