Visualization based on Pyvista#

class opstool.vis.OpsVisPyvista(point_size=1, line_width=3, colors_dict=None, theme='document', color_map='jet', on_notebook=False, results_dir='opstool_output')[source]#

A class to visualize OpenSeesPy model based on pyvista.

Parameters#

point_size: float, default=1

The render size of node.

line_width: float, default=3

The width of line element.

colors_dict: dict,

The dict for ele color, default color you can see by the class attribute default_colors.

theme: str, default=’document’

Plot theme for pyvista, optional ‘default’, ‘paraview’, ‘document’, ‘dark’.

color_map: str, default=”jet”

color map to display the cloud plot for pyvista. optional ‘jet’, ‘rainbow’, ‘hot’, ‘afmhot’, ‘copper’, ‘winter’, ‘cool’, ‘coolwarm’, ‘gist_earth’, ‘bone’, ‘binary’, ‘gray’, or any Matplotlib colormap .

on_notebook: bool, default=False

Whether work in a notebook.

results_dir: str, default=”opstool_output”

The dir that results saved.

Returns#

None

deform_anim(input_file='NodeRespStepData-1.hdf5', response='disp', alpha=1.0, show_outline=False, opacity=1, framerate=24, show_face_line=True, save_fig='DefoAnimation.gif', model_update=False)[source]#

Deformation animation of the model.

Parameters#

input_file: str, default = “NodeRespStepData-1.hdf5”,

The filename that node responses data saved by opstool.vis.GetFEMdata.get_node_resp_step().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

response: str, default=’disp’

Response type. Optional, “disp”, “vel”, “accel”.

alpha: float, default=1.0

Scaling factor, scale further on existing display.

show_outline: bool, default=False

Whether to display the axes.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

framerate: int, default=24

The number of frames per second.

opacity: float, default=1.0

Plane and solid element transparency.

save_fig: str, default=’DefoAnimation.gif’

The output file name, must end with .gif or .mp4. You can export to any folder, such as “C:mydir/myfile.gif”, but the folder mydir must exist.

model_update: bool, default False

whether to update the model domain data at each analysis step, this will be useful if model data has changed. For example, some elements and nodes were removed. This parameter must same as that in opstool.vis.GetFEMdata.get_node_resp_step().

Returns#

None

deform_peak_vis(input_file='NodeRespStepData-1.hdf5', response='disp', alpha=1.0, show_outline=False, show_origin=False, show_face_line=True, opacity=1, save_fig='DefoVis.svg')[source]#

Visualize the node peak responses of the model at all analysis steps. That is to say, the response of each node in each direction is the absolute maximum value in all its time steps.

Note

This method does not support the arg model_update, i.e. model nodes and elements do not change during the analysis.

Parameters#

input_file: str, default = “NodeRespStepData-1.hdf5”,

The filename that node responses data saved by opstool.vis.GetFEMdata.get_node_resp_step().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

response: str, default=’disp’

Response type. Optional, “disp”, “vel”, “accel”.

alpha: float, default=1.0

Scaling factor, scale further on existing display.

show_outline: bool, default=False

Whether to display the axes.

show_origin: bool, default=False

Whether to show undeformed shape.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

opacity: float, default=1.0

Plane and solid element transparency.

save_fig: str, default=’DefoVis.svg’

The file name to output. If False or None, the file will not be generated. The supported formats are:

  • ‘.svg’

  • ‘.eps’

  • ‘.ps’

  • ‘.pdf’

  • ‘.tex’

Returns#

None

deform_vis(input_file='NodeRespStepData-1.hdf5', slider=False, response='disp', alpha=1.0, show_outline=False, show_origin=False, show_face_line=True, opacity=1, save_fig='DefoVis.svg', model_update=False)[source]#

Visualize the deformation of the model at a certain analysis step.

Parameters#

input_file: str, default = “NodeRespStepData-1.hdf5”,

The filename that node responses data saved by opstool.vis.GetFEMdata.get_node_resp_step().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

response: str, default=’disp’

Response type. Optional, “disp”, “vel”, “accel”.

alpha: float, default=1.0

Scaling factor, scale further on existing display.

show_outline: bool, default=False

Whether to display the axes.

show_origin: bool, default=False

Whether to show undeformed shape.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

opacity: float, default=1.0

Plane and solid element transparency.

save_fig: str, default=’DefoVis.svg’

The file name to output. If False or None, the file will not be generated. The supported formats are:

  • ‘.svg’

  • ‘.eps’

  • ‘.ps’

  • ‘.pdf’

  • ‘.tex’

model_update: bool, default False

whether to update the model domain data at each analysis step, this will be useful if model data has changed. For example, some elements and nodes were removed. This parameter must same as that in opstool.vis.GetFEMdata.get_node_resp_step().

Returns#

None

eigen_anim(mode_tag=1, input_file='EigenData.hdf5', n_cycle=5, alpha=1.0, show_outline=False, label_size=15, opacity=1, framerate=3, show_face_line=True, save_fig='EigenAnimation.gif')[source]#

Animation of Modal Analysis.

Parameters#

mode_tag: int

The mode tag.

input_file: str, default = ‘EigenData.hdf5’,

The filename that eigen data saved by opstool.vis.GetFEMdata.get_eigen_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

n_cycle: int, default = 5,

The number of cycles in the positive and negative directions of the modal deformation.

alpha: float, default=1.0

Scaling factor, scale further on existing display.

show_outline: bool, default=False

Whether to display the axes.

label_size: float, default=15

The fontsize of text labels.

opacity: float, default=1.0

Plane and solid element transparency.

framerate: int

The number of frames per second.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

save_fig: str, default=’EigenAnimation.gif’

The output file name, must end with .gif or .mp4. You can export to any folder, such as “C:mydir/myfile.gif”, but the folder mydir must exist.

Returns#

None

eigen_vis(mode_tags, input_file='EigenData.hdf5', subplots=False, link_views=True, alpha=1.0, show_outline=False, show_origin=False, label_size=15, opacity=1.0, show_face_line=True, save_fig='EigenVis.svg')[source]#

Eigenvalue Analysis Visualization.

Parameters#

mode_tags: list[int], or tuple[int]

Mode tags to be shown, if list or tuple [mode1, mode2], display the multiple modes from mode1 to mode2.

input_file: str, default = ‘EigenData.hdf5’,

The filename that eigen data saved by opstool.vis.GetFEMdata.get_eigen_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

subplots: bool, default=False

If True, subplots in a figure. If False, plot in a slider style.

link_views: bool, default=True

If True, link the views’ cameras, only usefuly when subplots is True.

alpha: float, default=1.0

Model scaling factor, scale further on existing display.

show_outline: bool, default=True

Whether to display the axes.

show_origin: bool, default=False

Whether to show undeformed shape.

label_size: float, default=15

The fontsize of text labels.

opacity: float, default=1.0

Plane and solid element transparency.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

save_fig: str, default=’EigenVis.svg’

The file name to output. If False or None, the file will not be generated. The supported formats are:

  • ‘.svg’

  • ‘.eps’

  • ‘.ps’

  • ‘.pdf’

  • ‘.tex’

Returns#

None

frame_resp_vis(input_file='BeamRespStepData-1.hdf5', ele_tags=None, slider=False, response='Mz', show_values=True, alpha=1.0, opacity=1, save_fig='FrameRespVis.svg')[source]#

Display the force response of frame elements.

Parameters#

input_file: str, default = “BeamRespStepData-1.hdf5”,

The filename that beam frame elements responses data saved by opstool.vis.GetFEMdata.get_frame_resp_step().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

ele_tags: int or list[int], default=None

Element tags to display, if None, all frame elements will display.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

response: str, default=’Mz’

Response type. Optional, “Fx”, “Fy”, “Fz”, “My”, “Mz”, “Mx”.

show_values: bool, default=True

If True, will show the response values.

alpha: float, default=1.0

Scaling factor, scale further on existing display..

opacity: float, default=1.0

Plane and solid element transparency.

save_fig: str, default=’FrameRespVis.svg’

The file name to output. If False or None, the file will not be generated. The supported formats are:

  • ‘.svg’

  • ‘.eps’

  • ‘.ps’

  • ‘.pdf’

  • ‘.tex’

Returns#

None

model_vis(input_file='ModelData.hdf5', show_node_label=False, show_ele_label=False, label_size=10, show_local_crd=False, show_local_crd_shell=False, local_crd_alpha=1.0, show_fix_node=True, fix_node_alpha=1.0, show_load=False, load_alpha=1.0, show_constrain_dof=False, show_beam_sec=False, beam_sec_paras=None, show_outline=True, opacity=1.0, save_fig='ModelVis.svg')[source]#

Visualize the model in the current domain.

Parameters#

input_file: str, default = “ModelData.hdf5”,

The filename that model data saved by opstool.vis.GetFEMdata.get_model_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

show_node_label: bool, default=False

Whether to display the node label.

show_ele_label: bool, default=False

Whether to display the ele label.

show_local_crd: bool, default=False

Whether to display the local axes of beam and link elements.

show_local_crd_shell: bool, default=False

Whether to display the local axes of shell elements.

local_crd_alpha: float, default=1.0

On existing displays, the scaling factor for the local axis sizes.

show_fix_node: bool, default=True

Whether to display the fix nodes.

fix_node_alpha: float, default=1.0

On existing displays, the scaling factor for the boundary symbol sizes.

show_load: bool, default = False

Whether to display node and beam element loads. The sizes of the arrow are related to the size of its load. If you want to further control the size, you can use load_alpha. Currently only supported beam element load types include <beamUniform2D, beamUniform3D, beamPoint2D, beamPoint3D>.

Note

Please make sure that all dofs (or directions) have values when adding the load or eleLoad command, even if the value is 0.

load_alpha: float, default = 1.0

On existing displays, the scaling factor for the load arrow sizes.

show_constrain_dof: bool, default=False

Whether to display labels for constrained degrees of freedom.

show_beam_sec: bool default = False

Whether to render the 3d section of beam or truss elements. If True, the Arg beam_sec in opstool.vis.GetFEMdata.get_model_data() must be assigned in advance.

beam_sec_paras: dict defalut = None,

A dict to control beam section render, optional key: color, opacity, texture. For texture, you can pass an image file with color=None, if texture is None, it will be ignored.

label_size: float, default=8

The foontsize of node and ele labels, as well as local axis labels.

show_outline: bool, default=True

Whether to show the axis frame.

opacity: float, default=1.0

Plane and solid element transparency.

save_fig: str, default=’ModelVis.svg’

The file name to output. If False or None, the file will not be generated. The supported formats are:

  • ‘.svg’

  • ‘.eps’

  • ‘.ps’

  • ‘.pdf’

  • ‘.tex’

Returns#

None

react_vis(input_file='NodeReactionStepData-1.hdf5', slider=False, direction='Fz', show_values=True, show_outline=False, save_fig='ReactionVis.svg')[source]#

Plot the node reactions.

Parameters#

input_filestr, optional, default=”NodeReactionStepData-1.hdf5”

The filename that eigen data saved by opstool.vis.GetFEMdata.get_node_react_step() or opstool.vis.GetFEMdata.save_resp_all().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

directionstr, optional, by default “Fz”

Type of reaction, if 2D, only be one of [‘Fx’, ‘Fy’, ‘Mz’]; if 3D, one of [‘Fx’, ‘Fy’, ‘Fz’, ‘Mx’, ‘My’, ‘Mz’]

show_valuesbool, optional, by default True

If True, will show the reaction values.

show_outline: bool, default=False

Whether to display the axes.

save_fig: str, default=’ReactionVis.svg’

The output file name, must end with .gif or .mp4. You can export to any folder, such as “C:mydir/myfile.gif”, but the folder mydir must exist.

set_anti_aliasing(aa_type='msaa')[source]#

Make edges (lines) appear softer and less pixelated.

Parameters#

aa_type: str, default = “msaa”

Anti-aliasing type. See the notes below. One of the following:

  • "ssaa" - Super-Sample Anti-Aliasing

  • "msaa" - Multi-Sample Anti-Aliasing

  • "fxaa" - Fast Approximate Anti-Aliasing

set_color(point='#580f41', line='#0504aa', face='#00c16e', solid='#0cb9c1', truss='#7552cc', link='#01ff07', constraint='#00ffff')[source]#

Set the color for various element types.

Paramaters#

point: str, default=”#580f41”

Nodal color.

line: str, default=”#0504aa”

Line element color, including beams.

face: str, default=”#00c16e”

The color of planar elements, including 2D solid elements, plate and shell elements.

solid: str, default=”#0cb9c1”

The color of solid elements.

truss: str, default=”#7552cc”

Truss color.

link: str, default=”#01ff07”

The color of link and bearing elements.

constraint: str, default=”#00ffff”

The color of multi-point constraint.