Utility commands#

n2vscripting.common.change_active_view(view: int) None#

Change the active view.

Parameters:

view (int) – Index of the view to be activated. Must be between 0 and the number of views - 1.

Examples

>>> n2v.change_active_view(1)
n2vscripting.common.create_view(name: str) None#

Create a new view in the active window.

Parameters:

name (str) – Name of the new view. Must be unique.

Examples

>>> n2v.create_view('MyNewView')
n2vscripting.common.get_active_scene()#

Get the scene from the active view.

n2vscripting.common.get_lcs_list()#

Get the list of load cases in the active view.

n2vscripting.common.hide_connectors() None#

Hide connectors in the active view.

n2vscripting.common.import_results(results_files: list[str]) None#

Import results from a results file.

Parameters:

results_files (list[str]) – A list of paths to results files.

Examples

>>> n2v.import_results(['C:/path/to/results1.op2', 'C:/path/to/results2.op2'])
n2vscripting.common.load_model(file_path: str) None#

Load model from a file. If it is a results file, load results as well

Parameters:

file_path (str) – Path to the model file.

Examples

>>> n2v.load_model('C:/path/to/model.op2')
>>> n2v.load_model('C:/path/to/model.bdf')
n2vscripting.common.take_screenshot(file_path: str, background: str = 'White', file_format: str = 'PNG') None#

Take a screenshot of the current view and save it to a file.

Parameters:
  • file_path (str) – Save file path.

  • background (str, optional) – Background color of the screenshot. Options are: ‘White’, ‘Current’ and ‘Transparent’. Default is ‘White’.

  • file_format (str, optional) – Format of the save file. Options are ‘PNG’ and ‘JPG’. Default is ‘PNG’.

Examples

>>> n2v.take_screenshot('C:/path/to/screenshot.png')
>>> n2v.take_screenshot('C:/path/to/screenshot.jpg', background='Transparent')
>>> n2v.take_screenshot('C:/path/to/screenshot.jpg', background='Current', file_format='JPG')