[Python] Anys Fluent PyVista view orientation

Discussão em 'Python' iniciado por Stack, Junho 21, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use the PyFluent visualization package that has PyVista implemented in it for displaying the 3D results etc. The problem is that I have no idea how to manipulate the orientation (camera) of the displays and that there is very little info online.

    The example code is below. velocity_vector object is a pyvista object but I have no idea how to add the attributes to change the orientation (its always in the default isometric perspective).

    How can I achieve this with PyVista?

    import ansys.fluent.core as pyfluent

    from ansys.fluent.visualization import set_config
    from ansys.fluent.visualization.matplotlib import Plots
    from ansys.fluent.visualization.pyvista import Graphics

    set_config(blocking=True, set_view_on_display="isometric")

    %matplotlib notebook

    # Start a Solver session
    #The line bellow should not have the show_gui=False as the Fluent always returns an error
    solver_session = pyfluent.launch_fluent(
    precision="double", processor_count=2, mode="solver", show_gui=True)

    solver_session.file.read_case_data(file_name = "SYS-18.1-1.cas.h5")

    # Display velocity vectors on the symmetry plane
    graphics = Graphics(solver_session)
    velocity_vector()
    velocity_vector = graphics.Vectors["velocity-vector"]
    velocity_vector.field = "velocity-magnitude"
    velocity_vector.surfaces_list = ['symmetry_pipe']
    velocity_vector.camera_position = 'zy'
    velocity_vector.display()

    Continue reading...

Compartilhe esta Página