Pyvista-based Visualization¶
- opstool.vis.pyvista.set_plot_props(*, point_size=1.0, line_width=2.0, cmap='jet', cmap_model=None, n_colors=256, theme='default', window_size=(1024, 768), render_points_as_spheres=True, render_lines_as_tubes=True, anti_aliasing='msaa', msaa_multi_samples=16, smooth_shading=None, lighting=None, line_smoothing=True, polygon_smoothing=True, notebook=False, jupyter_backend='trame', font_family=None, scale_factor=0.05, show_mesh_edges=True, mesh_edge_color='black', mesh_edge_width=1.0, mesh_opacity=1.0, font_size=15, title_font_size=18, off_screen=False)[source]¶
Set ploting properties.
Parameters¶
- point_sizefloat, optional
Point size of any nodes. Default
5.0- line_widthfloat, optional
Thickness of line elements. Only valid for wireframe and surface representations. Default
3.0.- cmapstr, list, optional
Name of the Matplotlib colormap to us when mapping the scalars. See available Matplotlib colormaps. Only applicable for when displaying
scalars. Requires Matplotlib to be installed.colormapis also an accepted alias for this. Ifcolorcetorcmoceanare installed, their colormaps can be specified by name.You can also specify a list of colors to override an existing colormap with a custom one. For example, to create a three color colormap you might specify
['green', 'red', 'blue'].- cmap_modelstr, list, optional, default=None
Matplotlib colormap used for geometry model visualization. Same as
cmap, except that this parameter will be used for geometry model visualization and will be automatically mapped according to different element types. If None, If None, the color specified in the function``set_plot_colors`` will be used.Available color maps are shown in Colormaps in Matplotlib
- n_colorsint, optional
Number of colors to use when displaying scalars. Default to 256. The scalar bar will also have this many colors.
- themestr, optional,
Theme name. Either ‘default’, ‘document’, ‘dark’, or ‘paraview’. Defaults to “default” theme.
- window_sizelist, optional
Window size in pixels. Defaults to
[1024, 768]- render_points_as_spheresbool, optional
Render points as spheres.
- render_lines_as_tubesbool, optional
Renders lines as tubes.
- anti_aliasing: str, optional, default=”msaa”
Enable or disable antialiasing. *
"ssaa"- Super-Sample Anti-Aliasing *"msaa"- Multi-Sample Anti-Aliasing *"fxaa"- Fast Approximate Anti-AliasingNote
SSAA, or Super-Sample Anti-Aliasing is a brute force method of antialiasing. It results in the best image quality but comes at a tremendous resource cost. SSAA works by rendering the scene at a higher resolution. The final image is produced by downsampling the massive source image using an averaging filter. This acts as a low pass filter which removes the high frequency components that would cause jaggedness.
MSAA, or Multi-Sample Anti-Aliasing is an optimization of SSAA that reduces the number of pixel shader evaluations that need to be computed by focusing on overlapping regions of the scene. The result is antialiasing along edges that are on par with SSAA and less antialiasing along surfaces as these make up the bulk of SSAA computations. MSAA is substantially less computationally expensive than SSAA and results in comparable image quality.
FXAA, or Fast Approximate Anti-Aliasing is an Anti-Aliasing technique performed entirely in post-processing. FXAA operates on the rasterized image rather than the scene geometry. As a consequence, forcing FXAA or using FXAA incorrectly can result in the FXAA filter smoothing out parts of the visual overlay that are usually kept sharp for reasons of clarity as well as smoothing out textures. FXAA is inferior to MSAA but is almost free computationally and is thus desirable on high-end platforms.
- msaa_multi_samplesint, optional, default=16
The number of multi-samples when
anti_aliasingis"msaa". Note that using this setting automatically enables this for all renderers.- smooth_shadingbool, optional,
Smoothly render curved surfaces when plotting. Not helpful for all meshes.
- line_smoothingbool, default: True
If
True, enable line smoothing.- polygon_smoothingbool, default: True
If
True, enable polygon smoothing.- lightingbool, optional
Enable or disable view direction lighting. Default False.
- notebookbool, optional
When True, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. Automatically enables off_screen.
- jupyter_backendstr, optional, default: “trame”
Jupyter backend to use when plotting. Must be one of the following:
'static': Display a single static image within the Jupyterlab environment. It Still requires that a virtual framebuffer be set up when displaying on a headless server, but does not require any additional modules to be installed.'client': Export/serialize the scene graph to be rendered with VTK.js client-side throughtrame. Requirestrameandjupyter-server-proxyto be installed.'server': Render remotely and stream the resulting VTK images back to the client usingtrame. This replaces the'ipyvtklink'backend with better performance. Supports the most VTK features, but suffers from minor lag due to remote rendering. Requires that a virtual framebuffer be set up when displaying on a headless server. Must have at leasttrameandjupyter-server-proxyinstalled for cloud/remote Jupyter instances. This mode is also aliased by'trame'.'trame': The full Trame-based backend that combines both'server'and'client'into one backend. This requires a virtual frame buffer.'html': Export/serialize the scene graph to be rendered with the Trame client backend but in a static HTML file.'none': Do not display any plots within jupyterlab, instead display using dedicated VTK render windows. This will generate nothing on headless servers even with a virtual framebuffer.
- font_familystr, optional
Font family. Must be either
'courier','times', orarial.- scale_factorfloat, optional
Scale factor between the maximum deformation of the model and the maximum boundary size. Default
1 / 20.- show_mesh_edges: bool, default: True
Whether to display the mesh edges of
planes,plates,shells, andsolidelements.- mesh_edge_color: str, default: black
Color of the mesh edges for
planes,plates,shells, andsolidelements.- mesh_edge_width: float, default: 1.0
Width of the mesh edges for
planes,plates,shells, andsolidelements.- mesh_opacity: float, default: 1.0
Display opacity of
surfaceandsolidelements.- font_size: int, default: 15
Font size of labels.
- title_font_size: int, default: 18
Font size of title.
- off_screen: bool, optional
Renders off-screen when True. Useful for automated screenshots.
Returns¶
None
- opstool.vis.pyvista.set_plot_colors(point='#FF0055', frame='#0652ff', truss='#FF8C00', link='#39FF14', shell='#769958', plane='#00FFFF', brick='#FF4500', tet='#FFFF33', joint='#7FFF00', contact='#ff9408', pfem='#8080FF', constraint='#FF1493', bc='#15b01a', cmap='jet', cmap_model=None)[source]¶
Set the display color of various element types.
Parameters¶
- pointstr, list[int, int, int], optional
Color for nodal points. Either a string, RGB list, or hex color string. For example,
point='white',point='w',point=[1, 1, 1], orpoint='#FFFFFF'.- framestr, list[int, int, int], optional
Color for frame elements.
- trussstr, list[int, int, int], optional
Color for truss elements.
- linkstr, list[int, int, int], optional
Color for link elements.
- shellstr, list[int, int, int], optional
Color for shell elements.
- planestr, list[int, int, int], optional
Color for plane elements.
- brickstr, list[int, int, int], optional
Color for brick (solid) elements.
- tetstr, list[int, int, int], optional
Color for tetrahedral (solid) elements.
- jointstr, list[int, int, int], optional
Color for beam-column joint elements.
- contactstr, list[int, int, int], optional
Color for contact elements.
- pfemstr, list[int, int, int], optional
Color for PFEM elements.
- constraintstr, list[int, int, int], optional
Color for constraint.
- bcstr, list[int, int, int], optional
Color for boundary conditions.
- cmapstr, list, optional
Name of the Matplotlib colormap to us when mapping the scalars. See available Matplotlib colormaps. Only applicable for when displaying
scalars. Requires Matplotlib to be installed.colormapis also an accepted alias for this. Ifcolorcetorcmoceanare installed, their colormaps can be specified by name.You can also specify a list of colors to override an existing colormap with a custom one. For example, to create a three color colormap you might specify
['green', 'red', 'blue'].- cmap_modelstr, list, optional, default=None
Matplotlib colormap used for geometry model visualization. Same as
cmap, except that this parameter will be used for geometry model visualization and will be automatically mapped according to different element types. If None, If None, the color specified in the function``set_plot_colors`` will be used.Available color maps are shown in Colormaps in Matplotlib
Returns¶
None
- opstool.vis.pyvista.plot_model(odb_tag=None, show_node_numbering=False, show_ele_numbering=False, style='surface', color=None, show_bc=True, bc_scale=1.0, show_link=True, show_mp_constraint=True, show_constraint_dofs=False, show_nodal_loads=False, show_ele_loads=False, load_scale=1.0, show_local_axes=False, local_axes_scale=1.0, show_outline=False, show_legend=False, cpos='iso')[source]¶
Geometric model visualization based on
pyvista.Parameters¶
- odb_tag: Union[int, str], default: None
Tag of output databases (ODB) to be visualized. If None, data will be saved automatically.
- show_node_numbering: bool, default: False
Whether to display node tag labels.
- show_ele_numbering: bool, default: False
Whether to display element tag labels.
- style: str, default: surface
Visualization mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
- color: str, default: black
Model display color.
- show_bc: bool, default: True
Whether to display boundary supports.
- bc_scale: float, default: 1.0
Scale the size of boundary support display.
- show_link: bool, default: True
Whether to show link elements.
- show_mp_constraint: bool, default: True
Whether to show multipoint (MP) constraint.
- show_constraint_dofs: bool, default: False
Whether to show dofs of mp-constraints.
- show_nodal_loads: bool, default: False
Whether to show nodal loads.
- show_ele_loads: bool, default: False
Whether to show element loads.
- load_scale: float, default: 1.0
Scale the size of load arrow presentation.
- show_local_axes: bool, default: False
Whether to display element local axes, including
beam-column,link, andshellelements.- local_axes_scale: float, default: 1.0
Scales the presentation size of the local axes.
- show_outline: bool, default: False
Whether to display the outline of the model.
- show_legend: bool, default: False
Whether to show legend.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_eigen(mode_tags, odb_tag=None, subplots=False, link_views=True, scale=1.0, show_outline=False, show_origin=False, style='surface', cpos='iso', show_bc=True, bc_scale=1.0, show_mp_constraint=True, solver='-genBandArpack')[source]¶
Modal visualization.
Parameters¶
- mode_tags: Union[List, Tuple]
The modal range to visualize, [mode i, mode j].
- odb_tag: Union[int, str], default: None
Tag of output databases (ODB) to be visualized. If None, data will be saved automatically.
- subplots: bool, default: False
If True, multiple subplots are used to present mode i to mode j. Otherwise, they are presented as slides.
- link_views: bool, default: True
Link the views’ cameras when subplots=True.
- scale: float, default: 1.0
Zoom the presentation size of the mode shapes.
- show_outline: bool, default: False
Whether to display the outline of the model.
- show_origin: bool, default: False
Whether to show the undeformed shape.
- style: str, default: surface
Visualization the mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- show_bc: bool, default: True
Whether to display boundary supports.
- bc_scale: float, default: 1.0
Scale the size of boundary support display.
- show_mp_constraint: bool, default: True
Whether to show multipoint (MP) constraint.
- solverstr, optional,
OpenSees’ eigenvalue analysis solver, by default “-genBandArpack”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_eigen_animation(mode_tag, odb_tag=None, n_cycle=5, framerate=3, savefig='EigenAnimation.gif', off_screen=True, cpos='iso', solver='-genBandArpack', **kargs)[source]¶
Modal animation visualization.
Parameters¶
- mode_tag: int
The mode tag to display.
- odb_tag: Union[int, str], default: None
Tag of output databases (ODB) to be visualized. If None, data will be saved automatically.
- n_cycle: int, default: five
Number of cycles for the display.
- framerate: int, default: three
Framerate for the display, i.e., the number of frames per second.
- savefig: str, default: EigenAnimation.gif
Path to save the animation. The suffix can be
.gifor.mp4.- off_screen: bool, default: True
Whether to display the plotting window. If True, the plotting window will not be displayed.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- solverstr, optional,
OpenSees’ eigenvalue analysis solver, by default “-genBandArpack”.
- kargs: dict, optional parameters,
see
plot_eigen.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_nodal_responses(odb_tag=1, slides=False, scale=1.0, show_defo=True, resp_type='disp', resp_dof=('UX', 'UY', 'UZ'), cpos='iso', show_bc=True, bc_scale=1.0, show_mp_constraint=False, show_undeformed=False, style='surface', show_outline=False)[source]¶
Visualizing Node Responses.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- slides: bool, default: False
Display the response for each step in the form of a slideshow. Otherwise, show the step with the largest response.
- scale: float, default: 1.0
Scales the size of the deformation presentation.
- show_defo: bool, default: True
Whether to display the deformed shape.
- resp_type: str, default: disp
Type of response to be visualized. Optional: “disp”, “vel”, “accel”, “reaction”, “reactionIncInertia”, “rayleighForces”, “pressure”.
- resp_dof: str, default: (“UX”, “UY”, “UZ”)
Component to be visualized. Optional: “UX”, “UY”, “UZ”, “RX”, “RY”, “RZ”. You can also pass on a list or tuple to display multiple dimensions, for example, [“UX”, “UY”], [“UX”, “UY”, “UZ”], [“RX”, “RY”, “RZ”], [“RX”, “RY”], [“RY”, “RZ”], [“RX”, “RZ”], and so on.
Note
If the nodes include fluid pressure dof, such as those used for …UP elements, the pore pressure should be extracted using
resp_type="vel", andresp_dof="UZ".- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- show_bc: bool, default: True
Whether to display boundary supports.
- bc_scale: float, default: 1.0
Scale the size of boundary support display.
- show_mp_constraint: bool, default: False
Whether to show multipoint (MP) constraint.
- show_undeformed: bool, default: False
Whether to show the undeformed shape of the model.
- show_outline: bool, default: False
Whether to display the outline of the model.
- style: str, default: surface
Visualization mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_nodal_responses_animation(odb_tag=1, framerate=None, savefig='NodalRespAnimation.gif', off_screen=True, scale=1.0, show_defo=True, resp_type='disp', resp_dof=('UX', 'UY', 'UZ'), show_bc=True, bc_scale=1.0, show_mp_constraint=False, cpos='iso', show_undeformed=False, style='surface', show_outline=False)[source]¶
Visualize node response animation.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- framerate: int, default: 5
Framerate for the display, i.e., the number of frames per second.
- savefig: str, default: NodalRespAnimation.gif
Path to save the animation. The suffix can be
.gifor.mp4.- off_screen: bool, default: True
Whether to display the plotting window. If True, the plotting window will not be displayed.
- scale: float, default: 1.0
Scales the size of the deformation presentation.
- show_defo: bool, default: True
Whether to display the deformed shape.
- resp_type: str, default: disp
Type of response to be visualized. Optional: “disp”, “vel”, “accel”, “reaction”, “reactionIncInertia”, “rayleighForces”, “pressure”.
- resp_dof: str, default: (“UX”, “UY”, “UZ”)
Component to be visualized. Optional: “UX”, “UY”, “UZ”, “RX”, “RY”, “RZ”. You can also pass on a list or tuple to display multiple dimensions, for example, [“UX”, “UY”], [“UX”, “UY”, “UZ”], [“RX”, “RY”, “RZ”], [“RX”, “RY”], [“RY”, “RZ”], [“RX”, “RZ”], and so on.
- show_bc: bool, default: True
Whether to display boundary supports.
- bc_scale: float, default: 1.0
Scale the size of boundary support display.
- show_mp_constraint: bool, default: False
Whether to show multipoint (MP) constraint.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- show_undeformed: bool, default: False
Whether to show the undeformed shape of the model.
- show_outline: bool, default: False
Whether to display the outline of the model.
- style: str, default: surface
Visualization mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_truss_responses(odb_tag=1, ele_tags=None, slides=False, show_values=True, resp_type='axialForce', alpha=1.0, line_width=1.5, cpos='iso')[source]¶
Visualizing Truss Response.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of truss elements to be visualized. If None, all truss elements are selected.
- slides: bool, default: False
Display the response for each step in the form of a slideshow. Otherwise, show the step with the largest response.
- show_values: bool, default: True
Whether to display the response value.
- resp_type: str, default: “axialForce”
Response type, optional, one of [“axialForce”, “axialDefo”, “Stress”, “Strain”].
- alpha: float, default: 1.0
Scale the size of the response graph.
Note
You can adjust the scale to make the response graph more visible. A negative number will reverse the direction.
- line_width: float, default: 1.5.
Line width of the response graph.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_truss_responses_animation(odb_tag=1, ele_tags=None, framerate=None, savefig='TrussRespAnimation.gif', off_screen=True, show_values=False, resp_type='axialForce', alpha=1.0, line_width=1.5, cpos='iso')[source]¶
Truss response animation.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of truss elements to be visualized. If None, all truss elements are selected.
- framerate: int, default: None
Framerate for the display, i.e., the number of frames per second.
- savefig: str, default: TrussRespAnimation.gif
Path to save the animation. The suffix can be
.gifor.mp4.- off_screen: bool, default: True
Whether to display the plotting window. If True, the plotting window will not be displayed.
- show_values: bool, default: False
Whether to display the response value.
- resp_type: str, default: “axialForce”
Response type, optional, one of [“axialForce”, “axialDefo”, “Stress”, “Strain”].
- alpha: float, default: 1.0
Scale the size of the response graph.
Note
You can adjust the scale to make the response graph more visible. A negative number will reverse the direction.
- line_width: float, default: 1.5.
Line width of the response graph.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_frame_responses(odb_tag=1, ele_tags=None, resp_type='sectionForces', resp_dof='MZ', slides=False, scale=1.0, show_values=False, cpos='iso', line_width=1.5)[source]¶
Plot the responses of the frame element.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of frame elements to be visualized. If None, all frame elements are selected.
- resp_type: str, default: “sectionforces”
Response type, optional, one of [“localForces”, “basicForces”, “basicDeformations”, “plasticDeformation”, “sectionForces”, “sectionDeformations”].
- resp_dof: str, default: “MZ”
Component type corrsponding to the resp_type.
For localForces: [“FX”, “FY”, “FZ”, “MX”, “MY”, “MZ”]
For basicForces: [“N”, “MZ”, “MY”, “T”]
For basicDeformations: [“N”, “MZ”, “MY”, “T”]
For plasticDeformation: [“N”, “MZ”, “MY”, “T”]
For sectionForces: [“N”, “MZ”, “VY”, “MY”, “VZ”, “T”]
For sectionDeformations: [“N”, “MZ”, “VY”, “MY”, “VZ”, “T”]
Note
For sectionForces and sectionDeformations, not all sections include the shear dof VY and VZ. For instance, in the most commonly used 3D fiber cross-sections, only the axial force N, bending moments MZ and MY, and torsion T are available.
- slides: bool, default: False
Display the response for each step in the form of a slideshow. Otherwise, show the step with the largest response.
- show_values: bool, default: True
Whether to display the response value.
- scale: float, default: 1.0
Scale the size of the response graph.
Note
You can adjust the scale to make the response graph more visible. A negative number will reverse the direction.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- line_width: float, default: 1.5.
Line width of the response graph.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_frame_responses_animation(odb_tag=1, ele_tags=None, resp_type='sectionForces', resp_dof='MZ', scale=1.0, show_values=False, cpos='iso', framerate=None, savefig='FrameForcesAnimation.gif', off_screen=True, line_width=1.5)[source]¶
Animate the responses of frame elements.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of frame elements to be visualized. If None, all frame elements are selected.
- resp_type: str, default: “sectionforces”
Response type, optional, one of [“localForces”, “basicForces”, “basicDeformations”, “plasticDeformation”, “sectionForces”, “sectionDeformations”].
- resp_dof: str, default: “MZ”
Component type corrsponding to the resp_type.
For localForces: [“FX”, “FY”, “FZ”, “MX”, “MY”, “MZ”]
For basicForces: [“N”, “MZ”, “MY”, “T”]
For basicDeformations: [“N”, “MZ”, “MY”, “T”]
For plasticDeformation: [“N”, “MZ”, “MY”, “T”]
For sectionForces: [“N”, “MZ”, “VY”, “MY”, “VZ”, “T”]
For sectionDeformations: [“N”, “MZ”, “VY”, “MY”, “VZ”, “T”]
Note
For sectionForces and sectionDeformations, not all sections include the shear dof VY and VZ. For instance, in the most commonly used 3D fiber cross-sections, only the axial force N, bending moments MZ and MY, and torsion T are available.
- scale: float, default: 1.0
Scale the size of the response graph.
Note
You can adjust the scale to make the response graph more visible. A negative number will reverse the direction.
- show_values: bool, default: True
Whether to display the response value.
- framerate: int, default: None
Framerate for the display, i.e., the number of frames per second.
- savefig: str, default: FrameForcesAnimation.gif
Path to save the animation. The suffix can be
.gifor.mp4.- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
- off_screen: bool, default: True
Whether to display the plotting window. If True, the plotting window will not be displayed.
- line_width: float, default: 1.5.
Line width of the response graph.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_unstruct_responses(odb_tag=1, ele_type='Shell', ele_tags=None, slides=False, resp_type='sectionForces', resp_dof='MXX', style='surface', cpos='iso')[source]¶
Visualizing unstructured element (Shell, Plane, Brick) Response.
Note
The responses at all Gaussian points are averaged.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of elements to be visualized. If None, all elements are selected.
- slides: bool, default: False
Display the response for each step in the form of a slideshow. Otherwise, show the step with the largest response.
- ele_type: str, default: “Shell”
Element type, optional, one of [“Shell”, “Plane”, “Solid”].
- resp_type: str, default: None
Response type, which dependents on the element type ele_type.
- For
Shellelements, one of [“sectionForces”, “sectionDeformations”]. I.e., section forces and deformations at Gaussian integration points (per unit length). If None, defaults to “sectionForces”.
- For
- For
Planeelements, one of [“stresses”, “strains”]. I.e., stresses and strains at Gaussian integration points. If None, defaults to “stresses”.
- For
- For
BrickorSolidelements, one of [“stresses”, “strains”]. I.e., stresses and strains at Gaussian integration points. If None, defaults to “stresses”.
- For
- resp_dof: str, default: None
Dof to be visualized, which dependents on the element type ele_type.
Note
The resp_dof here is consistent with stress-strain (force-deformation), and whether it is stress or strain depends on the parameter resp_type.
- For
Shellelements, one of [“FXX”, “FYY”, “FXY”, “MXX”, “MYY”, “MXY”, “VXZ”, “VYZ”]. If None, defaults to “MXX”.
- For
For
Planeelements, one of [“sigma11”, “sigma22”, “sigma12”, “p1”, “p2”, “sigma_vm”, “tau_max”].“sigma11, sigma22, sigma12”: Normal stress and shear stress (strain) in the x-y plane.
“p1, p2”: Principal stresses (strains).
“sigma_vm”: Von Mises stress.
“tau_max”: Maximum shear stress (strains).
If None, defaults to “sigma_vm”.
For
BrickorSolidelements, one of [“sigma11”, “sigma22”, “sigma33”, “sigma12”, “sigma23”, “sigma13”, “p1”, “p2”, “p3”, “sigma_vm”, “tau_max”, “sigma_oct”, “tau_oct”]“sigma11, sigma22, sigma33”: Normal stress (strain) along x, y, z.
“sigma12, sigma23, sigma13”: Shear stress (strain).
“p1, p2, p3”: Principal stresses (strains).
“sigma_vm”: Von Mises stress.
“tau_max”: Maximum shear stress (strains).
“sigma_oct”: Octahedral normal stress (strains).
“tau_oct”: Octahedral shear stress (strains).
If None, defaults to “sigma_vm”.
- style: str, default: surface
Visualization the mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.
- opstool.vis.pyvista.plot_unstruct_responses_animation(odb_tag=1, ele_tags=None, framerate=None, ele_type='Shell', resp_type=None, resp_dof=None, savefig=None, off_screen=True, style='surface', cpos='iso')[source]¶
Unstructured element (Shell, Plane, Brick) response animation.
Note
The responses at all Gaussian points are averaged.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be visualized.
- ele_tags: Union[int, list], default: None
The tags of truss elements to be visualized. If None, all truss elements are selected.
- ele_type: str, default: “Shell”
Element type, optional, one of [“Shell”, “Plane”, “Solid”].
- framerate: int, default: None
Framerate for the display, i.e., the number of frames per second.
- savefig: str, default: None
Path to save the animation. The suffix can be
.gifor.mp4.- off_screen: bool, default: True
Off-screen rendering, i.e., not showing the rendering window. If False, the rendering window will be displayed.
- resp_type: str, default: None
Response type, which dependents on the element type ele_type.
- For
Shellelements, one of [“sectionForces”, “sectionDeformations”]. I.e., section forces and deformations at Gaussian integration points (per unit length). If None, defaults to “sectionForces”.
- For
- For
Planeelements, one of [“stresses”, “strains”]. I.e., stresses and strains at Gaussian integration points. If None, defaults to “stresses”.
- For
- For
BrickorSolidelements, one of [“stresses”, “strains”]. I.e., stresses and strains at Gaussian integration points. If None, defaults to “stresses”.
- For
- resp_dof: str, default: None
Dof to be visualized, which dependents on the element type ele_type.
Note
The resp_dof here is consistent with stress-strain (force-deformation), and whether it is stress or strain depends on the parameter resp_type.
- For
Shellelements, one of [“FXX”, “FYY”, “FXY”, “MXX”, “MYY”, “MXY”, “VXZ”, “VYZ”]. If None, defaults to “MXX”.
- For
For
Planeelements, one of [“sigma11”, “sigma22”, “sigma12”, “p1”, “p2”, “sigma_vm”, “tau_max”].“sigma11, sigma22, sigma12”: Normal stress and shear stress (strain) in the x-y plane.
“p1, p2”: Principal stresses (strains).
“sigma_vm”: Von Mises stress.
“tau_max”: Maximum shear stress (strains).
If None, defaults to “sigma_vm”.
For
BrickorSolidelements, one of [“sigma11”, “sigma22”, “sigma33”, “sigma12”, “sigma23”, “sigma13”, “p1”, “p2”, “p3”, “sigma_vm”, “tau_max”, “sigma_oct”, “tau_oct”]“sigma11, sigma22, sigma33”: Normal stress (strain) along x, y, z.
“sigma12, sigma23, sigma13”: Shear stress (strain).
“p1, p2, p3”: Principal stresses (strains).
“sigma_vm”: Von Mises stress.
“tau_max”: Maximum shear stress (strains).
“sigma_oct”: Octahedral normal stress (strains).
“tau_oct”: Octahedral shear stress (strains).
If None, defaults to “sigma_vm”.
- style: str, default: surface
Visualization the mesh style of surfaces and solids. One of the following: style=’surface’, style=’wireframe’, style=’points’, style=’points_gaussian’. Defaults to ‘surface’. Note that ‘wireframe’ only shows a wireframe of the outer geometry.
- cpos: str, default: iso
Model display perspective, optional: “iso”, “xy”, “yx”, “xz”, “zx”, “yz”, “zy”. If 3d, defaults to “iso”. If 2d, defaults to “xy”.
Returns¶
Plotting object of PyVista to display vtk meshes or numpy arrays. See pyvista.Plotter.
You can use Plotter.show. to display the plotting window.
You can also use Plotter.export_html. to export this plotter as an interactive scene to an HTML file.