Forge Analytics

Deleting a ParaView Data Object

Instructions for removing data objects and filters from the ParaView pipeline.

Overview

There are times in scripting for ParaView when it is useful to delete data objects or filters from the Pipeline Browser.

Most often, this occurs when you want to use a given ParaView session to produce multiple outputs (many slices, contours, variables, etc), instead of having to re-load your original data for each output.

Deleting from the Pipeline Browser can offer large savings in computational expense for long batch processes.

Notes

For the purposes of this article, we will be using Paraview 5.4.1.

For installation instructions, please see the guide for CPU-based rendering or GPU-based rendering.

For help running ParaView scripts, please see the batch-execution instructions.

Manual Instructions

Deleting objects from the Pipeline Browser manually is a simple process.

Simply highlight the object you wish to select in the browser, and press the “Delete” button.

Delete Button

Scripted Instructions

Removing a data or filter object programatically is just as simple.

First make sure the paraview.simple module has been imported:

import paraview.simple

Then, ensure you have a variable handle to your data object.

case = paraview.simple.OpenFOAMReader(FileName='/path/to/run.foam')
data_display = paraview.simple.Show(case, render_view)

Then, simply delete the data object. The display object will be taken care of automatically. It’s also best practice to clean up the variable afterward with the del built-in.

paraview.simple.Delete(case)
del case

Have a Question?

Contact Us