So change that line to cell = np.array(, ], dtype=np. The first entry in a cell definition needs to be the number of points defining the cell. There is also a problem with how you are defining cells. (Caveat: this only works when you are running in built-in server mode because of GetClientSideObject(), which is fairly common). All it does is take a dataset and pass that to any downstream filters that request it. This creates a ParaView proxy ( TrivialProducer) that is a proxy for a simple VTK data source called a vtkTrivialProducer. Tp.GetClientSideObject().SetOutput(uGrid) # create a trivial producer to bridge between the VTK object and ParaView To get it to a place where ParaView can use it add the following: # how to put uGrid into the following codes In your original example, you are creating an unstructured grid in VTK just fine. What you are missing is a bridge between the two levels in your script. The higher level lets you control the operation of ParaView, e.g., show data, set display properties, etc. The lower level is where you can create or filter data with VTK. The key thing to understand is that there are two levels of Python scripting available in ParaView. TypeError: Show argument 1: method requires a vtkSMSourceProxy, a vtkPythonAlgorithm was provided. Rep = controller.Show(proxy, proxy.Port, view)įile "/home/why/local/lib/python3.6/site-packages/paraview/servermanager.py", line 158, in _ConvertArgumentsAndCall Output = (outInfo)īut I got some error : Traceback (most recent call last):įile "/home/why/local/lib/python3.6/site-packages/paraview/simple.py", line 482, in Show (vtk.VTK_TRIANGLE, cells)ĭef RequestData(self, request, inInfo, outInfo): I try to code a source class like following: import numpy as npįrom import VTKPythonAlgorithmBaseįrom vtkmodules.numpy_interface import dataset_adapter as dsaįrom import smproxy, smproperty, label="triangle mesh!")Ĭlass MeshSource(VTKPythonAlgorithmBase): I can not find any example from the internet to do such thing in python script. View = GetActiveViewOrCreate('RenderView') # how to put uGrid into the following codes see MayaVi (written in Python + numpy + scipy + VTK) or VisIt note that VTK can be used from C++, Tcl, Java, Python as a standalone. Import _support as vnpĬell = np.array(, ], dtype=np.int)Ĭells.SetCells(NC, vnp.numpy_to_vtkIdTypeArray(cell)) Both interactive and Python scripting Uses MPI for distributed-memory parallelism on HPC clusters ParaView is based on VTK (Visualization Toolkit) not the only VTK-based open-source scientic visualizer, e.g. import numpy as npįrom _interface import dataset_adapter as dsa This training mixes theory and application with a set of tutorials and exercises.I install paraview 5.6 on my Ubuntu 18.04 system and I want to write a python script to show a vtkUnstructuredGrid. The examples are based on use cases from several scientific domains. This course provides an overview of ParaView, including how to visualize and process data. ParaView is both a general purpose, end-user application with a distributed architecture that can be seamlessly leveraged by your desktop or other remote parallel computing resources and an extensible framework with a collection of tools and libraries for various applications including scripting (using Python), web visualization (through ParaViewWeb), or in-situ analysis (with Catalyst). ParaView is an open-source, multi-platform scientific data analysis and visualization tool that enables the analysis and visualization of extremely large datasets.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |