def hideCone(self): print("Hiding cone.") self.cone1Display = simple.Hide(self.cone1, self.renderView1) self.renderView1.Update() self.coneShown = False return "**** executed hideCone() ****"
def __init__(self, dataCatalogEntry): self.debug = True self.dataFile = dataCatalogEntry["fileName"] self.description = dataCatalogEntry["description"] self.renderView = simple.GetActiveViewOrCreate('RenderView') # create a new 'EnSight Reader' self.caseData = simple.EnSightReader(CaseFileName=self.dataFile) # show data in view self.caseDataDisplay = simple.Show(self.caseData, self.renderView) # Get variables and range data from the newly-opened file. self.variables = {} #***************************TBD # Set some defaults for the display properties. self.caseDataDisplay.Representation = 'Surface' # show color bar/color legend self.caseDataDisplay.SetScalarBarVisibility(self.renderView, True) # hide data in view simple.Hide(self.caseData, self.renderView) # update the view to ensure updated data information self.renderView.Update() self.tankGeometryShown = False self.tankGeometryInit = False
def hideAll(): """This hides all sources/filters on the pipeline from the current view """ import paraview.simple as pvs for f in pvs.GetSources().values(): pvs.Hide(f) return None
def loadData(self): global dataPath mainpath = os.path.join(dataPath, "main") if os.path.isdir(mainpath): files = os.listdir(mainpath) for file in files: fullpath = os.path.join(mainpath, file) if os.path.isfile(fullpath): self.srcObj = simple.OpenDataFile(fullpath) simple.SetActiveSource(self.srcObj) self.rep = simple.GetDisplayProperties() simple.Hide() print 'Loaded %s into scene' % fullpath else: print 'Error: ' + mainpath + ' does not exist\n' raise Exception("The main directory does not exist") surfacespath = os.path.join(dataPath, "surfaces") files = os.listdir(surfacespath) for file in files: fullpath = os.path.join(surfacespath, file) if os.path.isfile(fullpath): self._loadSurfaceWithProperties(fullpath) simple.SetActiveSource(self.srcObj) simple.ResetCamera() simple.Render()
def writeLightArray(self, path, source): rep = simple.Show(source, self.view) rep.Representation = 'Surface' rep.DiffuseColor = [1, 1, 1] simple.ColorBy(rep, ('POINTS', None)) # Grab data tmpFileName = path + '__.png' self.view.LockBounds = 1 simple.SaveScreenshot(tmpFileName, self.view) self.view.LockBounds = 0 if self.canWrite: # Convert data self.reader.SetFileName(tmpFileName) self.reader.Update() rgbArray = self.reader.GetOutput().GetPointData().GetArray(0) arraySize = rgbArray.GetNumberOfTuples() rawArray = vtkUnsignedCharArray() rawArray.SetNumberOfTuples(arraySize) for idx in range(arraySize): light = rgbArray.GetTuple3(idx)[0] rawArray.SetTuple1(idx, light) with open(path, 'wb') as f: f.write(buffer(rawArray)) # Delete temporary file if self.cleanAfterMe: os.remove(tmpFileName) simple.Hide(source, self.view)
def runCode(self, text): log.warn(text) for source in simple.GetSources().values(): simple.Hide(source) simple.ResetSession() # temporary highly insecure krak.object_registry = {} exec(text)
def extractSubgrid(self, bounds): if (self.subgrid is not None): simple.Delete(self.subgrid) simple.SetActiveSource(self.srcObj) self.subgrid = simple.ExtractSubset() self.subgrid.VOI = bounds simple.SetActiveSource(self.subgrid) self.rep = simple.Show() self.rep.ScalarOpacityFunction = self.sof self.rep.ColorArrayName = self.colorArrayName self.rep.Representation = 'Volume' self.rep.SelectionPointFieldDataArrayName = self.colorArrayName self.rep.LookupTable = self.lookupTable simple.Hide(self.srcObj) simple.SetActiveSource(self.subgrid) simple.Render()
def _sliceSurfaces(self, slice): if self.meshSlice is not None: simple.Delete(self.meshSlice) self.meshSlice = None for surface in self.surfaces: rep = simple.Show(surface) if self.sliceMode == 'XY Plane': origin = [ 0.0, 0.0, math.cos(math.radians(rep.Orientation[2])) * slice ] normal = [0.0, 0.0, 1.0] elif self.sliceMode == 'XZ Plane': origin = [ 0.0, math.cos(math.radians(rep.Orientation[1])) * slice, 0.0 ] normal = [0.0, 1.0, 0.0] else: origin = [ math.cos(math.radians(rep.Orientation[0])) * slice, 0.0, 0.0 ] normal = [1.0, 0.0, 0.0] simple.Hide(surface) self.meshSlice = simple.Slice(Input=surface, SliceType='Plane') simple.SetActiveSource(self.srcObj) self.meshSlice.SliceOffsetValues = [0.0] self.meshSlice.SliceType = 'Plane' self.meshSlice.SliceType.Origin = origin self.meshSlice.SliceType.Normal = normal meshDataRep = simple.Show(self.meshSlice) meshDataRep.Representation = 'Points' meshDataRep.LineWidth = self.CONTOUR_LINE_WIDTH meshDataRep.PointSize = self.CONTOUR_LINE_WIDTH meshDataRep.AmbientColor = rep.DiffuseColor meshDataRep.Orientation = rep.Orientation simple.SetActiveSource(self.srcObj)
def test2(): w = simple.Wavelet() c = simple.Contour(ComputeScalars=1, Isosurfaces=range(50, 250, 10)) r = simple.Show(c) lut = simple.GetLookupTableForArray("RTData", 1, RGBPoints=[ 43.34006881713867, 0.23, 0.299, 0.754, 160.01158714294434, 0.865, 0.865, 0.865, 276.68310546875, 0.706, 0.016, 0.15 ]) r.LookupTable = lut r.ColorArrayName = ('POINT_DATA', 'RTData') view = simple.Render() exp = ThreeSixtyImageStackExporter( FileNameGenerator('/tmp/z', 'w_{theta}_{phi}.jpg'), view, [0, 0, 0], 100, [0, 0, 1], [10, 20]) exp.UpdatePipeline() exp = ThreeSixtyImageStackExporter( FileNameGenerator('/tmp/y', 'cone_{theta}_{phi}.jpg'), view, [0, 0, 0], 100, [0, 1, 0], [10, 20]) exp.UpdatePipeline() exp = ThreeSixtyImageStackExporter( FileNameGenerator('/tmp/x', 'cone_{theta}_{phi}.jpg'), view, [0, 0, 0], 100, [1, 0, 0], [10, 20]) exp.UpdatePipeline() simple.ResetCamera() simple.Hide(c) slice = SliceExplorer( FileNameGenerator('/tmp/slice', 'w_{sliceColor}_{slicePosition}.jpg'), view, w, {"RTData": { "lut": lut, "type": 'POINT_DATA' }}, 50, [0, 1, 0]) slice.UpdatePipeline()
def writeArray(self, path, source, name, component=0): rep = simple.Show(source, self.view) rep.Representation = 'Surface' rep.DiffuseColor = [1, 1, 1] dataRange = [0.0, 1.0] fieldToColorBy = ['POINTS', name] self.view.ArrayNameToDraw = name self.view.ArrayComponentToDraw = component pdi = source.GetPointDataInformation() cdi = source.GetCellDataInformation() if pdi.GetArray(name): self.view.DrawCells = 0 dataRange = pdi.GetArray(name).GetRange(component) fieldToColorBy[0] = 'POINTS' elif cdi.GetArray(name): self.view.DrawCells = 1 dataRange = cdi.GetArray(name).GetRange(component) fieldToColorBy[0] = 'CELLS' else: print("No array with that name", name) return realRange = dataRange if dataRange[0] == dataRange[1]: dataRange = [dataRange[0] - 0.1, dataRange[1] + 0.1] simple.ColorBy(rep, fieldToColorBy) # Grab data tmpFileName = path + '__.png' self.view.ScalarRange = dataRange self.view.LockBounds = 1 self.view.StartCaptureValues() simple.SaveScreenshot(tmpFileName, self.view) self.view.StopCaptureValues() self.view.LockBounds = 0 if self.canWrite: # Convert data self.reader.SetFileName(tmpFileName) self.reader.Update() rgbArray = self.reader.GetOutput().GetPointData().GetArray(0) arraySize = rgbArray.GetNumberOfTuples() rawArray = vtkFloatArray() rawArray.SetNumberOfTuples(arraySize) minValue = 10000.0 maxValue = -100000.0 delta = (dataRange[1] - dataRange[0]) / 16777215.0 # 2^24 - 1 => 16,777,215 for idx in range(arraySize): rgb = rgbArray.GetTuple3(idx) if rgb[0] != 0 or rgb[1] != 0 or rgb[2] != 0: value = dataRange[0] + delta * float( rgb[0] * 65536 + rgb[1] * 256 + rgb[2] - 1) rawArray.SetTuple1(idx, value) minValue = min(value, minValue) maxValue = max(value, maxValue) else: rawArray.SetTuple1(idx, float('NaN')) # print ('Array bounds', minValue, maxValue, 'compare to', dataRange) with open(path, 'wb') as f: f.write(buffer(rawArray)) # Delete temporary file if self.cleanAfterMe: os.remove(tmpFileName) # Remove representation from view simple.Hide(source, self.view) return realRange
min_sphr_disp[start_p].DiffuseColor = [0.0, 0.0, 0.0] Bmag_calc = pv.Calculator(Input=t96_128) Bmag_calc.ResultArrayName = 'Bmag' Bmag_calc.Function = 'mag(B)' Bmag_slice = pv.Slice(Input=Bmag_calc) Bmag_slice.SliceType = 'Plane' Bmag_slice.SliceOffsetValues = [0.0] Bmag_slice.SliceType.Origin = [-20.0, 0.0, 0.0] Bmag_slice.SliceType.Normal = [0.0, 1.0, 0.0] Bmag_contour = {} for key in contsphere_b: for x in contsphere_f[key]: pv.Hide(x, view=rvs) for x in contsphere_b[key]: pv.Hide(x, view=rvs) pv.Render(view=rvs) for key in contours: for x in contsphere_f[key]: pv.Show(x, view=rvs) for x in contsphere_b[key]: pv.Show(x, view=rvs) Bmag_contour[key] = pv.Contour(Input=Bmag_slice) Bmag_contour[key].ContourBy = ['POINTS', 'Bmag'] Bmag_contour[key].PointMergeMethod = 'Uniform Binning' Bmag_contour[key].Isosurfaces = contours[key]
def hide(self): assert self._data is not None assert self._view is not None ps.Hide(self._data, self._view)
loc_disp.append(pv.Show(loc_spheres[-1], rvs4)) # create a new 'Poly Line Source' polyLineSource1 = pv.PolyLineSource() polyLineSource2 = pv.PolyLineSource() # Properties modified on polyLineSource1 polyLineSource1.Closed = 1 polyLineSource2.Closed = 1 # show data in view polyLineSource1Display = pv.Show(polyLineSource1, rvs4) polyLineSource2Display = pv.Show(polyLineSource2, rvs4) pv.Hide(polyLineSource2, rvs4) pv.Hide(polyLineSource1, rvs4) # trace defaults for the display properties. polyLineSource1Display.AmbientColor = [0.16993972686350806, 0.16993972686350806, 0.16993972686350806] polyLineSource1Display.ColorArrayName = [None, ''] polyLineSource1Display.DiffuseColor = [1.0, 1.0, 0.0] polyLineSource1Display.BackfaceDiffuseColor = [0.3799038681620508, 0.3799038681620508, 0.3799038681620508] polyLineSource2Display.AmbientColor = [0.16993972686350806, 0.16993972686350806, 0.16993972686350806] polyLineSource2Display.ColorArrayName = [None, ''] polyLineSource2Display.DiffuseColor = [1.0, 1.0, 0.0] polyLineSource2Display.BackfaceDiffuseColor = [0.3799038681620508, 0.3799038681620508, 0.3799038681620508] points = []
def toggleTankGeometry(self): self.printDebug() if not self.tankGeometryInit: # create a new 'Contour' self.contour2 = simple.Contour(Input=self.caseData) self.contour2.PointMergeMethod = 'Uniform Binning' # Properties modified on self.contour2 self.contour2.ContourBy = ['POINTS', 'wall_shear'] self.contour2.Isosurfaces = [0.0002] # show data in view self.contour2Display = simple.Show(self.contour2, self.renderView) # trace defaults for the display properties. self.contour2Display.Representation = 'Surface' self.contour2Display.ColorArrayName = [None, ''] self.contour2Display.OSPRayScaleFunction = 'PiecewiseFunction' self.contour2Display.SelectOrientationVectors = 'None' self.contour2Display.ScaleFactor = -2.0000000000000002e+298 self.contour2Display.SelectScaleArray = 'None' self.contour2Display.GlyphType = 'Arrow' self.contour2Display.GlyphTableIndexArray = 'None' self.contour2Display.GaussianRadius = -1.0000000000000001e+298 self.contour2Display.SetScaleArray = [None, ''] self.contour2Display.ScaleTransferFunction = 'PiecewiseFunction' self.contour2Display.OpacityArray = [None, ''] self.contour2Display.OpacityTransferFunction = 'PiecewiseFunction' self.contour2Display.DataAxesGrid = 'GridAxesRepresentation' self.contour2Display.SelectionCellLabelFontFile = '' self.contour2Display.SelectionPointLabelFontFile = '' self.contour2Display.PolarAxes = 'PolarAxesRepresentation' # init the 'GridAxesRepresentation' selected for 'DataAxesGrid' self.contour2Display.DataAxesGrid.XTitleFontFile = '' self.contour2Display.DataAxesGrid.YTitleFontFile = '' self.contour2Display.DataAxesGrid.ZTitleFontFile = '' self.contour2Display.DataAxesGrid.XLabelFontFile = '' self.contour2Display.DataAxesGrid.YLabelFontFile = '' self.contour2Display.DataAxesGrid.ZLabelFontFile = '' # init the 'PolarAxesRepresentation' selected for 'PolarAxes' self.contour2Display.PolarAxes.PolarAxisTitleFontFile = '' self.contour2Display.PolarAxes.PolarAxisLabelFontFile = '' self.contour2Display.PolarAxes.LastRadialAxisTextFontFile = '' self.contour2Display.PolarAxes.SecondaryRadialAxesTextFontFile = '' # Properties modified on contour2Display self.contour2Display.Opacity = 0.1 # change solid color self.contour2Display.DiffuseColor = [0.0, 0.5, 0.5] self.tankGeometryInit = True self.tankGeometryShown = True else: if self.tankGeometryShown: self.contour2Display = simple.Hide(self.contour2, self.renderView) self.tankGeometryShown = False else: self.contour2Display = simple.Show(self.contour2, self.renderView) self.tankGeometryShown = True self.renderView.Update()
contour1Display.OpacityTransferFunction.Points = [0.5744097232818604, 0.0, 0.5, 0.0, 0.5745317935943604, 1.0, 0.5, 0.0] # show color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, True) # set active source pv.SetActiveSource(contour1) # Properties modified on contour1 contour1.Isosurfaces = [0.5744097200222313, 0.6, 0.7] # show data in view contour1Display = pv.Show(contour1, renderView1) # hide data in view pv.Hide(ablnek5000, renderView1) # show color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, True) # update the view to ensure updated data information renderView1.Update() animationScene1.GoToNext() animationScene1.GoToNext() animationScene1.GoToNext() animationScene1.GoToNext()
# ----------------------------------------------------------------------------- # Data Generation # ----------------------------------------------------------------------------- db = LayerDataSetBuilder(clip, outputDir, { 'type': 'spherical', 'phi': range(-10, 11, 10), 'theta': range(-10, 11, 10) }, [400, 400]) # Setup view with camera position view = db.getView() simple.Show(wavelet, view) simple.Render(view) simple.ResetCamera(view) simple.Hide(wavelet, view) db.start() layerIdx = 0 for layer in cores: # Select only one layer contour.Isosurfaces = isoValues[layerIdx] # Capture each field of each layer for field in fields: db.setActiveLayer(layer, field, layerMesh[layer]) db.writeLayerData() # Move to the next layer layerIdx += 1
def Save_PV_data_to_picture_file(inputFileName, field_name, node_or_cell,outputFileName ): pvs._DisableFirstRenderCameraReset() #pvs.HideAll(view=None)#Not available in paraview 5.1.2 view = pvs.GetActiveView() sources = pvs.GetSources().values() for aSource in sources: pvs.Hide(aSource, view) # create a new 'XML Unstructured Grid Reader' reader = pvs.XMLUnstructuredGridReader(FileName=[inputFileName]) if node_or_cell== 'CELLS': reader.CellArrayStatus = [field_name] elif node_or_cell== 'NODES': reader.PointArrayStatus = [field_name] else: raise ValueError("unknown type : should be CELLS or NODES") # get active view renderView1 = pvs.GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size # renderView1.ViewSize = [1057, 499] # show data in view display = pvs.Show(reader, renderView1); # trace defaults for the display properties. display.ColorArrayName = [None, ''] display.GlyphType = 'Arrow' display.ScalarOpacityUnitDistance = 0.02234159571242408 # reset view to fit data renderView1.ResetCamera() # set scalar coloring if node_or_cell== 'CELLS': pvs.ColorBy(display, ('CELLS', field_name)) elif node_or_cell== 'NODES': pvs.ColorBy(display, ('POINTS', field_name)) else: raise ValueError("unknown type : should be CELLS or NODES") # rescale color and/or opacity maps used to include current data range display.RescaleTransferFunctionToDataRange(True) # show color bar/color legend display.SetScalarBarVisibility(renderView1, True) pvs.SaveScreenshot(outputFileName+".png", magnification=1, quality=100, view=renderView1) display.SetScalarBarVisibility(renderView1, False) if field_name=='Velocity' : #pvs.HideAll(view=None)#Not available in paraview 5.1.2 view = pvs.GetActiveView() sources = pvs.GetSources().values() for aSource in sources: pvs.Hide(aSource, view) # create a new 'Stream Tracer' streamTracer1 = pvs.StreamTracer(Input=reader, SeedType='Point Source') streamTracer1.Vectors = ['CELLS', 'Velocity'] # init the 'Point Source' selected for 'SeedType' streamTracer1.SeedType.Center = [0.5, 0.5, 0.0] streamTracer1.SeedType.Radius = 0.0 # Properties modified on streamTracer1 streamTracer1.SeedType = 'High Resolution Line Source' # Properties modified on streamTracer1.SeedType streamTracer1.SeedType.Point1 = [0.0, 0.0, 0.0] streamTracer1.SeedType.Point2 = [1.0, 1.0, 0.0] streamTracer1.SeedType.Resolution = 20# Pb : claims attribute Resolution does not exist # show data in view streamTracer1Display = pvs.Show(streamTracer1, renderView1) # create a new 'Stream Tracer' streamTracer2 = pvs.StreamTracer(Input=reader, SeedType='Point Source') streamTracer2.Vectors = ['CELLS', 'Velocity'] # init the 'Point Source' selected for 'SeedType' streamTracer2.SeedType.Center = [0.5, 0.5, 0.0] streamTracer2.SeedType.Radius = 0.0 # Properties modified on streamTracer2 streamTracer2.SeedType = 'High Resolution Line Source' # Properties modified on streamTracer2.SeedType streamTracer2.SeedType.Point1 = [0.0, 1.0, 0.0] streamTracer2.SeedType.Point2 = [1.0, 0.0, 0.0] streamTracer2.SeedType.Resolution = 25# Pb : claims attribute Resolution does not exist # show data in view streamTracer2Display = pvs.Show(streamTracer2, renderView1) pvs.SaveScreenshot(outputFileName+"_streamlines.png", magnification=1, quality=100, view=renderView1) pvs.Delete()
def initialize(self): # Bring used components self.registerVtkWebProtocol(pv_protocols.ParaViewWebMouseHandler()) self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPort()) self.registerVtkWebProtocol( pv_protocols.ParaViewWebViewPortImageDelivery()) self.registerVtkWebProtocol(amsProtocol()) self.updateSecret(_DemoServer.authKey) # Disable interactor-based render calls simple.GetRenderView().EnableRenderOnInteraction = 0 simple.GetRenderView().Background = [0, 0, 0] #cone = simple.Cone() #simple.Show(cone) # create a new 'EnSight Reader' #### disable automatic camera reset on 'Show' #paraview.simple._DisableFirstRenderCameraReset() # create a new 'EnSight Reader' matvizmofTFF90L91lpm100rpmcase = simple.EnSightReader( CaseFileName= '/Users/tomfool/tech/18/amgen/ams-102-AgileViz/EnSight/mat-viz-mofTFF-90L-9.1lpm-100rpm/mat-viz-mofTFF-90L-9.1lpm-100rpm.case' ) matvizmofTFF90L91lpm100rpmcase.PointArrays = [ 'pressure', 'pressure_coefficient', 'dynamic_pressure', 'absolute_pressure', 'total_pressure', 'rel_total_pressure', 'density', 'density_all', 'velocity_magnitude', 'x_velocity', 'y_velocity', 'z_velocity', 'axial_velocity', 'radial_velocity', 'tangential_velocity', 'rel_velocity_magnitude', 'relative_x_velocity', 'relative_y_velocity', 'relative_z_velocity', 'rel_tangential_velocity', 'mesh_x_velocity', 'mesh_y_velocity', 'mesh_z_velocity', 'velocity_angle', 'relative_velocity_angle', 'vorticity_mag', 'helicity', 'x_vorticity', 'y_vorticity', 'z_vorticity', 'cell_reynolds_number', 'turb_kinetic_energy', 'turb_intensity', 'turb_diss_rate', 'production_of_k', 'viscosity_turb', 'viscosity_eff', 'viscosity_ratio', 'y_star', 'y_plus', 'uds_0_scalar', 'uds_0_diff_scalar', 'viscosity_lam', 'wall_shear', 'x_wall_shear', 'y_wall_shear', 'z_wall_shear', 'skin_friction_coef', 'cell_partition_active', 'cell_partition_stored', 'cell_id', 'cell_element_type', 'cell_type', 'cell_zone', 'partition_neighbors', 'cell_weight', 'x_coordinate', 'y_coordinate', 'z_coordinate', 'axial_coordinate', 'angular_coordinate', 'abs_angular_coordinate', 'radial_coordinate', 'face_area_magnitude', 'x_face_area', 'y_face_area', 'z_face_area', 'cell_volume', 'orthogonal_quality', 'cell_equiangle_skew', 'cell_equivolume_skew', 'face_handedness', 'mark_poor_elememts', 'interface_overlap_fraction', 'cell_wall_distance', 'adaption_function', 'adaption_curvature', 'adaption_space_gradient', 'adaption_iso_value', 'boundary_cell_dist', 'boundary_normal_dist', 'cell_volume_change', 'cell_surface_area', 'cell_warp', 'cell_children', 'cell_refine_level', 'mass_imbalance', 'strain_rate_mag', 'dx_velocity_dx', 'dy_velocity_dx', 'dz_velocity_dx', 'dx_velocity_dy', 'dy_velocity_dy', 'dz_velocity_dy', 'dx_velocity_dz', 'dy_velocity_dz', 'dz_velocity_dz', 'dp_dx', 'dp_dy', 'dp_dz', 'velocity' ] # get active view renderView1 = simple.GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size # renderView1.ViewSize = [1638, 1076] # show data in view matvizmofTFF90L91lpm100rpmcaseDisplay = simple.Show( matvizmofTFF90L91lpm100rpmcase, renderView1) # get color transfer function/color map for 'pressure' pressureLUT = simple.GetColorTransferFunction('pressure') # get opacity transfer function/opacity map for 'pressure' pressurePWF = simple.GetOpacityTransferFunction('pressure') # trace defaults for the display properties. matvizmofTFF90L91lpm100rpmcaseDisplay.Representation = 'Surface' matvizmofTFF90L91lpm100rpmcaseDisplay.ColorArrayName = [ 'POINTS', 'pressure' ] matvizmofTFF90L91lpm100rpmcaseDisplay.LookupTable = pressureLUT matvizmofTFF90L91lpm100rpmcaseDisplay.OSPRayScaleArray = 'pressure' matvizmofTFF90L91lpm100rpmcaseDisplay.OSPRayScaleFunction = 'PiecewiseFunction' matvizmofTFF90L91lpm100rpmcaseDisplay.SelectOrientationVectors = 'velocity' matvizmofTFF90L91lpm100rpmcaseDisplay.ScaleFactor = 0.07445502169430256 matvizmofTFF90L91lpm100rpmcaseDisplay.SelectScaleArray = 'pressure' matvizmofTFF90L91lpm100rpmcaseDisplay.GlyphType = 'Arrow' matvizmofTFF90L91lpm100rpmcaseDisplay.GlyphTableIndexArray = 'pressure' matvizmofTFF90L91lpm100rpmcaseDisplay.GaussianRadius = 0.03722751084715128 matvizmofTFF90L91lpm100rpmcaseDisplay.SetScaleArray = [ 'POINTS', 'pressure' ] matvizmofTFF90L91lpm100rpmcaseDisplay.ScaleTransferFunction = 'PiecewiseFunction' matvizmofTFF90L91lpm100rpmcaseDisplay.OpacityArray = [ 'POINTS', 'pressure' ] matvizmofTFF90L91lpm100rpmcaseDisplay.OpacityTransferFunction = 'PiecewiseFunction' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid = 'GridAxesRepresentation' matvizmofTFF90L91lpm100rpmcaseDisplay.SelectionCellLabelFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.SelectionPointLabelFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.PolarAxes = 'PolarAxesRepresentation' matvizmofTFF90L91lpm100rpmcaseDisplay.ScalarOpacityFunction = pressurePWF matvizmofTFF90L91lpm100rpmcaseDisplay.ScalarOpacityUnitDistance = 0.007476863260594431 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' matvizmofTFF90L91lpm100rpmcaseDisplay.ScaleTransferFunction.Points = [ -152.6022491455078, 0.0, 0.5, 0.0, 144.73870849609375, 1.0, 0.5, 0.0 ] # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' matvizmofTFF90L91lpm100rpmcaseDisplay.OpacityTransferFunction.Points = [ -152.6022491455078, 0.0, 0.5, 0.0, 144.73870849609375, 1.0, 0.5, 0.0 ] # init the 'GridAxesRepresentation' selected for 'DataAxesGrid' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.XTitleFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.YTitleFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.ZTitleFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.XLabelFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.YLabelFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.DataAxesGrid.ZLabelFontFile = '' # init the 'PolarAxesRepresentation' selected for 'PolarAxes' matvizmofTFF90L91lpm100rpmcaseDisplay.PolarAxes.PolarAxisTitleFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.PolarAxes.PolarAxisLabelFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.PolarAxes.LastRadialAxisTextFontFile = '' matvizmofTFF90L91lpm100rpmcaseDisplay.PolarAxes.SecondaryRadialAxesTextFontFile = '' # reset view to fit data renderView1.ResetCamera() # show color bar/color legend matvizmofTFF90L91lpm100rpmcaseDisplay.SetScalarBarVisibility( renderView1, True) # update the view to ensure updated data information renderView1.Update() # hide data in view simple.Hide(matvizmofTFF90L91lpm100rpmcase, renderView1) # create a new 'Contour' contour1 = simple.Contour(Input=matvizmofTFF90L91lpm100rpmcase) contour1.ContourBy = ['POINTS', 'pressure'] contour1.Isosurfaces = [-3.9317703247070312] contour1.PointMergeMethod = 'Uniform Binning' # Properties modified on contour1 contour1.ContourBy = ['POINTS', 'uds_0_scalar'] contour1.Isosurfaces = [480.0, 570.0] # show data in view contour1Display = simple.Show(contour1, renderView1) # trace defaults for the display properties. contour1Display.Representation = 'Surface' contour1Display.ColorArrayName = ['POINTS', 'pressure'] contour1Display.LookupTable = pressureLUT contour1Display.OSPRayScaleArray = 'Normals' contour1Display.OSPRayScaleFunction = 'PiecewiseFunction' contour1Display.SelectOrientationVectors = 'velocity' contour1Display.ScaleFactor = 0.07228952534496784 contour1Display.SelectScaleArray = 'None' contour1Display.GlyphType = 'Arrow' contour1Display.GlyphTableIndexArray = 'None' contour1Display.GaussianRadius = 0.03614476267248392 contour1Display.SetScaleArray = ['POINTS', 'Normals'] contour1Display.ScaleTransferFunction = 'PiecewiseFunction' contour1Display.OpacityArray = ['POINTS', 'Normals'] contour1Display.OpacityTransferFunction = 'PiecewiseFunction' contour1Display.DataAxesGrid = 'GridAxesRepresentation' contour1Display.SelectionCellLabelFontFile = '' contour1Display.SelectionPointLabelFontFile = '' contour1Display.PolarAxes = 'PolarAxesRepresentation' # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' contour1Display.ScaleTransferFunction.Points = [ -0.9995924830436707, 0.0, 0.5, 0.0, 0.9998393058776855, 1.0, 0.5, 0.0 ] # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' contour1Display.OpacityTransferFunction.Points = [ -0.9995924830436707, 0.0, 0.5, 0.0, 0.9998393058776855, 1.0, 0.5, 0.0 ] # init the 'GridAxesRepresentation' selected for 'DataAxesGrid' contour1Display.DataAxesGrid.XTitleFontFile = '' contour1Display.DataAxesGrid.YTitleFontFile = '' contour1Display.DataAxesGrid.ZTitleFontFile = '' contour1Display.DataAxesGrid.XLabelFontFile = '' contour1Display.DataAxesGrid.YLabelFontFile = '' contour1Display.DataAxesGrid.ZLabelFontFile = '' # init the 'PolarAxesRepresentation' selected for 'PolarAxes' contour1Display.PolarAxes.PolarAxisTitleFontFile = '' contour1Display.PolarAxes.PolarAxisLabelFontFile = '' contour1Display.PolarAxes.LastRadialAxisTextFontFile = '' contour1Display.PolarAxes.SecondaryRadialAxesTextFontFile = '' # reset view to fit data renderView1.ResetCamera() # hide data in view simple.Hide(matvizmofTFF90L91lpm100rpmcase, renderView1) # show color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, True) # update the view to ensure updated data information renderView1.Update() # set scalar coloring simple.ColorBy(contour1Display, ('POINTS', 'velocity_magnitude')) # rescale color and/or opacity maps used to include current data range contour1Display.RescaleTransferFunctionToDataRange(True, False) # show color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, True) # get color transfer function/color map for 'velocity_magnitude' velocity_magnitudeLUT = simple.GetColorTransferFunction( 'velocity_magnitude') #### saving camera placements for all active views # current camera placement for renderView1 renderView1.CameraPosition = [ 1.3051878628081257, -1.32358496378265, -0.017141331493847792 ] renderView1.CameraFocalPoint = [ -0.052487090229988105, 0.03264869749546056, -0.3026974257081747 ] renderView1.CameraViewUp = [ -0.5051031518286454, -0.33848038039346323, 0.7939155106820026 ] renderView1.CameraParallelScale = 0.5021485229089222 #### uncomment the following to render all views # RenderAllViews() # alternatively, if you want to write images, you can use SaveScreenshot(...). ### OLD FOLLOWS simple.Render() # Update interaction mode pxm = simple.servermanager.ProxyManager() interactionProxy = pxm.GetProxy('settings', 'RenderViewInteractionSettings') print(dir(interactionProxy)) interactionProxy.Camera3DManipulators = [ 'Rotate', 'Pan', 'Zoom', 'Pan', 'Roll', 'Pan', 'Zoom', 'Rotate', 'Zoom' ] print("done with initialize()")
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())
def makeStream(self): # get color transfer function/color map for the data to color with. dataLUT = simple.GetColorTransferFunction(self.plotRecipe.get('EnumColorVariable')) # create a new 'Stream Tracer' streamTracer = simple.StreamTracer(Input=self.dataObject.getData(), SeedType='High Resolution Line Source') # Properties modified on streamTracer.SeedType streamTracer.SeedType.Resolution = 450 # Properties modified on streamTracer streamTracer.MaximumSteps = 600 # show data in view streamTracerDisplay = simple.Show(streamTracer, self.dataObject.renderView) # trace defaults for the display properties. streamTracerDisplay.Representation = 'Surface' # show color bar/color legend streamTracerDisplay.SetScalarBarVisibility(self.dataObject.renderView, False) # update the view to ensure updated data information self.dataObject.renderView.Update() # create a new 'Ribbon' ribbon = simple.Ribbon(Input=streamTracer) # Properties modified on ribbon ribbon.Scalars = ['POINTS', self.plotRecipe.get('EnumColorVariable')] # show data in view ribbonDisplay = simple.Show(ribbon, self.dataObject.renderView) # trace defaults for the display properties. ribbonDisplay.Representation = 'Surface' # hide data in view simple.Hide(streamTracer, self.dataObject.renderView) # show color bar/color legend ribbonDisplay.SetScalarBarVisibility(self.dataObject.renderView, True) # update the view to ensure updated data information self.dataObject.renderView.Update() # set scalar coloring ColorBy(ribbonDisplay, ('POINTS', self.plotRecipe.get('EnumColorVariable'))) # Hide the scalar bar for this color map if no visible data is # colored by it. simple.HideScalarBarIfNotNeeded(dataLUT, self.dataObject.renderView) # rescale color and/or opacity maps used to include current data range ribbonDisplay.RescaleTransferFunctionToDataRange(True, False) # show color bar/color legend ribbonDisplay.SetScalarBarVisibility(self.dataObject.renderView, True) # get color transfer function/color map for 'uds_0_scalar' colorLUT = simple.GetColorTransferFunction(self.plotRecipe.get('EnumColorVariable')) # Properties modified on ribbon ribbon.Width = 0.003 self.dataObject.renderView.ResetCamera() # update the view to ensure updated data information self.dataObject.renderView.Update() # set active source simple.SetActiveSource(streamTracer) # Properties modified on streamTracer.SeedType streamTracer.SeedType.Resolution = 200 # update the view to ensure updated data information self.dataObject.renderView.Update()