|
[Sponsors] |
[General] selected cells in python programmable filter |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 19, 2017, 11:44 |
selected cells in python programmable filter
|
#1 |
Senior Member
Giles Richardson
Join Date: Jun 2012
Location: Cambs UK
Posts: 102
Rep Power: 14 |
How do you operate on screen selected cells (Select Cells On) from within the Python Programmable Filter?
|
|
April 22, 2017, 04:14 |
|
#2 |
Senior Member
Giles Richardson
Join Date: Jun 2012
Location: Cambs UK
Posts: 102
Rep Power: 14 |
managed to achieve this using the code below (using tools > python shell):
from paraview.simple import * ####extract ExtractSelection() Show() ####filter trans_prog_filter = ProgrammableFilter() RenameSource("Translate", trans_prog_filter) trans_prog_filter.Script = """ pdi = self.GetInput() pdo = self.GetOutput() newPoints = vtk.vtkPoints() numPoints = pdi.GetNumberOfPoints() for i in range(0, numPoints): coord = pdi.GetPoint(i) x, y, z = coord[:3] x = x - 1.0 y = y + 0.0 z = z + 0.0 newPoints.InsertPoint(i, x, y, z) pdo.SetPoints(newPoints) """ Show() |
|
May 29, 2017, 13:46 |
|
#3 |
New Member
MASc Student
Join Date: Sep 2016
Posts: 25
Rep Power: 10 |
hey there,
I am having and issue that you may have experience or have some knowledge on. Do you know if its possible to specify the selected cells from the python shell? Instead of using "Select Cells" and dragging over an area, maybe specifying a bounding box in python to select the cells automatically? Regards, Derek |
|
May 30, 2017, 11:05 |
|
#4 |
Senior Member
Giles Richardson
Join Date: Jun 2012
Location: Cambs UK
Posts: 102
Rep Power: 14 |
I would suggest using the "start trace" feature in the "Tools" section to explore which python script corresponds to which cell selection method. You should be able to come up with a solution that way, by trying different methods. Try the "Clip" filter based on sphere radius and location to start with, and see how that is done using python commands. The start/stop trace feature is a really useful method (I think) to explore different python script, without having to Google it first. Good luck.
|
|
Tags |
paraview |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with divergence | TDK | FLUENT | 13 | December 14, 2018 07:00 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
[snappyHexMesh] problems using snappyHexMesh 2.1.0 on a supercomputer | Sunxing | OpenFOAM Meshing & Mesh Conversion | 9 | September 20, 2014 10:30 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |
physical boundary error!! | kris | Siemens | 2 | August 3, 2005 01:32 |