def _apply_clip(self, data): """ Apply the Clip filter to the data. Returns clipped data. """ # Apply clip only if needed if (not self.clip_normal is None) and (not self.clip_origin is None): data = pv.Clip(Input=data) self._filters += [data] # Settings are generated mostly by ParaView Trace function data.ClipType = 'Plane' data.Scalars = ['CELLS', cfg.coloring_name] data.Value = 17.925 data.ClipType.Origin = self.clip_origin data.ClipType.Normal = self.clip_normal return data
if options: # add coda about extracts generation. trace.append_separated(["", "if __name__ == '__main__':", " # generate extracts", " SaveExtracts(ExtractsOutputDirectory='%s')" % options.ExtractsOutputDirectory]) del trace_config smtrace.stop_trace() #print (trace) return str(trace) if not raw else trace.raw_data() if __name__ == "__main__": print ( "Running test") simple.Mandelbrot() simple.Show() simple.Hide() simple.Shrink().ShrinkFactor = 0.4 simple.UpdatePipeline() simple.Clip().ClipType.Normal[1] = 1 rep = simple.Show() view = simple.Render() view.ViewSize=[500, 500] rep.SetScalarBarVisibility(view, True) simple.Render() # rep.SetScalarBarVisibility(view, False) print ("====================================================================") print (get_state())
from paraview.web.dataset_builder import * # ----------------------------------------------------------------------------- # VTK Pipeline creation # ----------------------------------------------------------------------------- wavelet = simple.Wavelet() calc = simple.Calculator() calc.Function = 'coordsX' calc.ResultArrayName = 'x' contour = simple.Contour(PointMergeMethod="Uniform Binning", ComputeScalars=1, ComputeNormals=1, Isosurfaces=157.09, ContourBy=['POINTS', 'RTData']) clip = simple.Clip() clip.ClipType.Normal = [0.0, 0.0, -1.0] # ----------------------------------------------------------------------------- # Data To Export # ----------------------------------------------------------------------------- layerMesh = { 'core1': False, 'core2': True, 'core3': True, 'core4': True, 'core5': True } fields = ['RTData', 'x']
outputDir = '/Users/seb/Desktop/Geometry-diskout/' inputFile = '/Users/seb/Downloads/ParaViewData-3.10.1/Data/disk_out_ref.ex2' # ----------------------------------------------------------------------------- from paraview import simple from paraview.web.dataset_builder import * # ----------------------------------------------------------------------------- # Pipeline creation # ----------------------------------------------------------------------------- reader = simple.OpenDataFile(inputFile) reader.PointVariables = ['Temp', 'V', 'Pres', 'AsH3', 'GaMe3', 'CH4', 'H2'] clip = simple.Clip(Input=reader) clip.ClipType.Normal = [0.0, 1.0, 0.0] streamLines = simple.StreamTracer(Input=reader, SeedType="High Resolution Line Source", Vectors=['POINTS', 'V'], MaximumStreamlineLength=20.16) streamLines.SeedType.Point2 = [5.75, 5.75, 10.15999984741211] streamLines.SeedType.Point1 = [-5.75, -5.75, -10.0] streamTubes = simple.Tube(Input=streamLines, Radius=0.2) sections = { "LookupTables": { "AsH3": { "range": [0.0804768, 0.184839], "preset": "wildflower"
# Load the LFRic reader plugin if it has not been loaded already. It may be # necessary to provide the full path to the library, depending on the installation. # As of ParaView v5.7, the library is named "netCDFLFRicReader.so". # Set remote=True if you connect ParaView with a separate server. pluginPath = '' pvs.LoadPlugin(pluginPath + 'libnetCDFLFRicReader.so', remote=False) # Create a new data source with the LFRic output data, load the pressure field, # and use Cartesian coordinates rather than lon-lat-rad filePath = '' data = pvs.NetCDFLFRicReader(FileName=filePath + 'lfric_output.nc') data.CellArrayStatus = ['pressure'] data.UseCartesiancoordinates = 1 # Add a clip filter to the pipeline and set plane orientation clip = pvs.Clip(Input=data) clip.ClipType = 'Plane' clip.ClipType.Normal = [0.0, 0.0, 1.0] # Set up a new render view for displaying the grid and data renderView = pvs.CreateView('RenderView') renderView.ViewSize = [1600, 800] renderView.CameraPosition = [-43.0, 39.0, 32.0] renderView.CameraViewUp = [0.76, 0.44, 0.49] # Define a colour look-up table using (data value, r, g, b) tuples # Use value range from first timestep lut = pvs.GetColorTransferFunction('pressure') valueRange = data.CellData['pressure'].GetRange() lut.RGBPoints = [ valueRange[0], 0.23, 0.30, 0.75, valueRange[1], 0.71, 0.02, 0.15
# ----------------------------------------------------------------------------- from paraview import simple from paraview.web.dataset_builder import * # ----------------------------------------------------------------------------- # Pipeline creation # ----------------------------------------------------------------------------- variables = ['Temp', 'V', 'Pres', 'AsH3', 'GaMe3', 'CH4', 'H2'] reader = simple.OpenDataFile(inputFile) reader.PointVariables = variables clip = simple.Clip(Input=reader, Crinkleclip=1) clip.ClipType.Normal = [0.0, 1.0, 0.0] contourA = simple.Contour( Input = reader, PointMergeMethod = "Uniform Binning", ContourBy = 'AsH3', Isosurfaces = [0.1], ComputeScalars = 1) contourB = simple.Contour( Input = reader, PointMergeMethod = "Uniform Binning", ContourBy = 'AsH3', Isosurfaces = [0.14], ComputeScalars = 1) # -----------------------------------------------------------------------------
def _add_clip(pv_input, origin, normal): clip = pvs.Clip(Input=pv_input) clip.ClipType = 'Plane' clip.ClipType.Origin = origin clip.ClipType.Normal = normal return clip