Plotting commands#

NaxToView functions to plot results in the active view.

n2vscripting.plot.clear_plot()#

Clear the plot in the currently active view.

n2vscripting.plot.plot_contour(lc: int, incr: int, result: str, component: str, sections: str, domain: Literal['Displayed', 'Selected', 'All'] = 'Displayed', avg_sec: Literal['Maximum', 'Minimum', 'Difference', 'Average', 'Extreme'] = 'Maximum', avg_pos: Literal['None', 'Maximum', 'Minimum', 'Difference', 'Average', 'Extreme'] = 'Maximum', corner_data: bool = False, cmplx_format: Literal['Real', 'Cartesian', 'Polar'] = 'Real', variation: int = 100) None#

Plot contour in the currently active view.

Parameters:
  • lc (int) – Id of the desired load case.

  • incr (int) – Number of the requested increment.

  • result (str) – Name of the requested result.

  • component (str) – Name of the requested component.

  • sections (str) – A string specifying the requested sections.

  • domain (str, optional) – Element/node domain which results are to be plotted on. Default is ‘Displayed’. Other options are ‘Selected’ and ‘All’.

  • avg_sec (str, optional) – Averaging criterion for sections. Default is ‘Maximum’. Other options are ‘Minimum’, ‘Difference’, ‘Average’ and ‘Extreme’.

  • avg_pos (str, optional) – Averaging criterion for positions. Default is ‘Maximum’. Other options are ‘Minimum’, ‘Difference’, ‘Average’ and ‘Extreme’.

  • corner_data (bool, optional) – Whether to express the results at nodal positions. Default is False.

  • cmplx_format (str, optional) – Format for complex results. Options are: ‘Real’, ‘Cartesian’ and ‘Polar’. Default is ‘Real’.

  • variation (int, optional) – % variation for nodal results averaging. Default is 100.

Examples

>>> # Plot the Von Mises stress in the first load case and increment, for Z1 and Z2 sections
>>> n2v.plot_contour(1, 1, 'STRESSES', 'VON_MISES', 'Z1#Z2#')
>>> # Plot X component of displacements in the first load case and increment, only in selected nodes
>>> n2v.plot_contour(1, 1, 'DISPLACEMENTS', 'X', 'NONE#', domain='Selected')
n2vscripting.plot.plot_tensors(lc: int, incr: int, result: str, sections: str, domain: Literal['Displayed', 'Selected', 'All'] = 'Displayed', coord_sys_id: int = 0, cmp_xx_displayed: bool = True, cmp_yy_displayed: bool = True, cmp_zz_displayed: bool = True, cmp_xy_displayed: bool = True, cmp_yz_displayed: bool = True, cmp_zx_displayed: bool = True, set_min_value: bool = False, min_value: float = 0.0, set_max_value: bool = False, max_value: float = 0.0, arrow_resolution: int = 2, scaling_used: Literal['Auto', 'ByValue', 'Uniform'] = 'Auto', scale_factor: float = 1.0, color_by_val: bool = True, xx_color_hex: str = '#FFFF0000', yy_color_hex: str = '#FF00FF00', zz_color_hex: str = '#FF0000FF', xy_color_hex: str = '#FFFFFF00', yz_color_hex: str = '#FF00B0F0', zx_color_hex: str = '#FFF324D9', show_labels_normals: bool = False, show_labels_shears: bool = False) None#

Plot tensors on the currently active view.

Parameters:
  • lc (int, optional) – Id of the requested load case.

  • incr (int, optional) – Id of the requested increment.

  • result (str, optional) – Name of the requested result.

  • sections (str, optional) – A string specifying the requested sections.

  • domain (str, optional) – A string specifying the domain in which to plot the vectors. Default is “Displayed”. Other options are: “Selected” and “All”.

  • coord_sys_id (int, optional) – Id of the coordinate system in which to express results.

  • cmp_xx_displayed (bool, optional) – Whether to show XX component of the requested result. Default is True.

  • cmp_yy_displayed (bool, optional) – Whether to show YY component of the requested result. Default is True.

  • cmp_zz_displayed (bool, optional) – Whether to show ZZ component of the requested result. Default is True.

  • cmp_xy_displayed (bool, optional) – Whether to show XY component of the requested result. Default is True.

  • cmp_yz_displayed (bool, optional) – Whether to show YZ component of the requested result. Default is True.

  • cmp_zx_displayed (bool, optional) – Whether to show ZX component of the requested result. Default is True.

  • set_min_value (bool, optional) – Whether to set a minimum threshold for plotted results. Default is False.

  • min_value (float, optional) – Minimum threshold for plotted results. Default is 0.

  • set_max_value (bool, optional) – Whether to set a maximum threshold for plotted results. Default is False.

  • max_value (float, optional) – Maximum threshold for plotted results. Default is 0.

  • arrow_resolution (int, optional) – Number of polygons used to draw the arrow tip. Default: 2.

  • scaling_used (bool, optional) – Whether to scale results by a factor. Default is False.

  • scale_factor (float, optional) – Scale factor for results. Default is 1.0.

  • color_by_val (bool, optional) – Whether to color tensor arrows by value. Default is True.

  • xx_color_hex (str, optional) – Hex color code for XX component of tensor if not colored by value. Default is “#FFFF0000”.

  • yy_color_hex (str, optional) – Hex color code for YY component of tensor if not colored by value. Default is “#FF00FF00”.

  • zz_color_hex (str, optional) – Hex color code for ZZ component of tensor if not colored by value. Default is “#FF0000FF”.

  • xy_color_hex (str, optional) – Hex color code for XY component of tensor if not colored by value. Default is “#FFFFFF00”.

  • yz_color_hex (str, optional) – Hex color code for YZ component of tensor if not colored by value. Default is “#FF00B0F0”.

  • zx_color_hex (str, optional) – Hex color code for ZX component of tensor if not colored by value. Default is “#FFF324D9”.

  • show_labels_normals (bool, optional) – Whether to show labels for normal components. Default is False.

  • show_labels_shears (bool, optional) – Whether to show labels for shear components. Default is False.

Examples

>>> # Plot stress tensor results
>>> n2v.plot_tensors(1, 1, 'STRESSES', 'Z1#Z2#')
>>> # Plot stress tensor results, showing XX and YY components only and only for selected elements
>>> n2v.plot_tensors(1, 1, 'STRESSES', 'Z1#Z2#', domain='Selected', cmp_zz_displayed=False, cmp_yz_displayed=False, cmp_zx_displayed=False)
n2vscripting.plot.plot_vectors(lc: int, incr: int, result: str, sections: str, domain: Literal['Displayed', 'Selected', 'All'] = 'Displayed', coord_sys_id: int = 0, is_rotation: bool = False, cmp_x_displayed: bool = True, cmp_y_displayed: bool = True, cmp_z_displayed: bool = True, resultant_displayed: bool = True, resultant_use_cmpx: bool = True, resultant_use_cmpy: bool = True, resultant_use_cmpz: bool = True, set_min_value: bool = False, min_value: float = 0, set_max_value: bool = False, max_value: float = 0, arrow_resolution: int = 2, scaling_used: Literal['Auto', 'ByValue', 'Uniform'] = 'Auto', scale_factor: float = 1, arrow_origin: Literal['Tail', 'Center', 'Tip'] = 'Tail', arrow_tip: Literal['Arrow', 'None'] = 'Arrow', color_by_val: bool = True, x_color_hex: str = '#FFFF0000', y_color_hex: str = '#FF00FF00', z_color_hex: str = '#FF0000FF', r_color_hex: str = '#FFE1E1E1', show_label_text: bool = False) None#

Plot vectors on the currently active view.

Parameters:
  • lc (int) – Id of the requested load case.

  • incr (int) – Id of the requested increment.

  • result (str) – Name of the requested result.

  • sections (str) – A string specifying the requested sections.

  • domain (str, optional) – A string specifying the domain in which to plot the vectors. Default is “Displayed”. Other options are: “Selected” and “All”.

  • coord_sys_id (int, optional) – Id of the coordinate system in which to express results

  • is_rotation (bool, optional) – If true, the vector is to be rotated. Default: False

  • cmp_x_displayed (bool, optional) – Whether to show X component of the requested result. Default: True

  • cmp_y_displayed (bool, optional) – Whether to show Y component of the requested result. Default: True

  • cmp_z_displayed (bool, optional) – Whether to show Z component of the requested result. Default: True

  • resultant_displayed (bool, optional) – Whether to show resultant of the requested result. Default: True

  • resultant_use_cmpx (bool, optional) – Whether to use X component of the requested result for the resultant. Default: True

  • resultant_use_cmpy (bool, optional) – Whether to use Y component of the requested result for the resultant. Default: True

  • resultant_use_cmpz (bool, optional) – Whether to use Z component of the requested result for the resultant. Default: True

  • set_min_value (bool, optional) – Whether to set a minimum threshold for plotted results. Default: False

  • min_value (float, optional) – Minimum threshold for plotted results. Default: 0

  • set_max_value (bool, optional) – Whether to set a maximum threshold for plotted results. Default: False

  • max_value (float, optional) – Maximum threshold for plotted results. Default: 0

  • arrow_resolution (int, optional) – Number of polygons used to draw the arrow tip. Default: 2.

  • scaling_used (bool, optional) – Whether to scale results by a factor. Default: False

  • scale_factor (float, optional) – Scale factor for results. Default: 1.0

  • arrow_origin (str, optional) – Origin of the arrow. Default: “Tail”

  • arrow_tip (str, optional) – Type of arrow tip. Default: “Arrow”

  • color_by_val (bool, optional) – Whether to color vector arrows by value. Default: True

  • x_color_hex (str, optional) – Hex color code for X component of vector if not colored by value. Default: “#FFFF0000”

  • y_color_hex (str, optional) – Hex color code for Y component of vector if not colored by value. Default: “#FF00FF00”

  • z_color_hex (str, optional) – Hex color code for Z component of vector if not colored by value. Default: “#FF0000FF”

  • r_color_hex (str, optional) – Hex color code for resultant of vector if not colored by value. Default: “#FFE1E1E1”

  • show_label_text (bool, optional) – Whether to show label text. Default: False

Examples

>>> # Plot displacement vectors
>>> n2v.plot_vectors(1, 1, 'DISPLACEMENTS', 'NONE#')
>>> # Plot forces vectors, showing X and Y components only and only for selected elements
>>> n2v.plot_vectors(1, 1, 'FORCES', 'NONE#', domain='Selected', cmp_z_displayed=False, resultant_use_cmpz=False)
n2vscripting.plot.set_deformed_scale(value: float = 1.0) None#

Set the scale of the deformed shape on the active view.

Parameters:

value (float, optional) – Scale multiplier. Default is 1.0.

Examples

>>> n2v.set_deformed_scale(2.0)
n2vscripting.plot.set_deformed_style(repr_type: Literal[0, 1, 2, 3, 4] = 0, color: str = '#FFFDFDFD') None#

Set the style of the deformed shape on the active view.

Parameters:
  • repr_type (int, optional) – Mesh representation type. Default is 0.

  • color (str, optional) – Hex color code for the mesh representation. Default: #FFFDFDFD.

Examples

>>> # Set deformed style to opaque wireframe, with color set to a dim gray (#FF6B6B7C)
>>> n2v.set_deformed_style(1, '#FF6B6B7C')
n2vscripting.plot.toggle_deformed() None#

Activate/deactivate deformed view.

n2vscripting.plot.toggle_undeformed() None#

Activate/deactivate the undeformed shaped view on the active view.