CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Clip Filter as Type Cylinder

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2015, 08:29
Default Clip Filter as Type Cylinder
  #1
New Member
 
Join Date: Jun 2015
Posts: 3
Rep Power: 10
Mr.Robot is on a distinguished road
Hello!

I am using ParaView 4.1.0 and I require to apply slices, as well as cuts to my model- but in cylindrical shapes.

I went through the forums thoroughly and was able to find programmable filters for the same. The Cylindrical Slice worked, but with a slight modification to cutter.SetInput() -> cutter.SetInputData().
You can see the complete code

Code:
#Change 'Output Data Set Type' to vtkPolyData

input = self.GetInputDataObject(0, 0)
inp_copy = input.NewInstance()
inp_copy.ShallowCopy(input)
inp_copy.UnRegister(None)
cutter = vtk.vtkCutter()
transf = vtk.vtkTransform()
transf.RotateX(90)
cyl = vtk.vtkCylinder()

#Define radius and cylinder centre- in the following two lines of code

cyl.SetCenter(0,0,0)
cyl.SetRadius(0.00375)
cyl.SetTransform(transf)
cutter.SetCutFunction(cyl)
cutter.SetInputData(inp_copy)
cutter.Update()
self.GetOutputDataObject(0).ShallowCopy(cutter.GetOutputDataObject(0))
I found a similar post by the same user for a cylindrical clip function which is quite consistent but for some reason it does not work. The code is below, followed by the error message I get,

Code:
input = self.GetInputDataObject(0, 0)
inp_copy = input.NewInstance()
inp_copy.ShallowCopy(input)
inp_copy.UnRegister(None)

transf = vtk.vtkTransform()
transf.RotateX(90)
cyl = vtk.vtkCylinder()
cyl.SetCenter(0,0,0)
cyl.SetRadius(0.00375)
cyl.SetTransform(transf)

clipper = vtk.vtkClipDataSet()
clipper.SetClipFunction(cyl)
clipper.SetInputData(inp_copy)
#clipper.InsideOutOn()
clipper.Update()

self.GetOutputDataObject(0).ShallowCopy(clipper.GetOutputDataObject(0))
Traceback (most recent call last):
File "<string>", line 22, in <module>
File "<string>", line 14, in RequestData
AttributeError: 'module' object has no attribute 'vtkClipDataSet'


Could someone please explain what is wrong with the Clip Programmable Filter?

The link for the original posts by wyldckat :

http://www.cfd-online.com/Forums/ope...-cylinder.html
http://www.cfd-online.com/Forums/ope...ere-plane.html


Would really appreciate a quick reply,

thank you in advance!

Last edited by wyldckat; August 20, 2015 at 15:40. Reason: Mr.Robot: formal - wyldckat: Added [CODE] markers
Mr.Robot is offline   Reply With Quote

Old   August 20, 2015, 15:43
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Mr.Robot,

Sorry for the late reply, but only today did I finally manage to look into this. The problem is that you were missing this line:
Code:
import vtk
This will load the complete "vtk" module. I don't know why the "Programmable Filter" doesn't load it all at once

The complete script therefore being this:
Code:
import vtk

input = self.GetInputDataObject(0, 0)
inp_copy = input.NewInstance()
inp_copy.ShallowCopy(input)
inp_copy.UnRegister(None)

transf = vtk.vtkTransform()
transf.RotateX(90)
cyl = vtk.vtkCylinder()
cyl.SetCenter(0,0,0)
cyl.SetRadius(0.00375)
cyl.SetTransform(transf)

clipper = vtk.vtkClipDataSet()
clipper.SetClipFunction(cyl)
clipper.SetInputData(inp_copy)
#clipper.InsideOutOn()
clipper.Update()

self.GetOutputDataObject(0).ShallowCopy(clipper.GetOutputDataObject(0))
Best regards,
Bruno
ashim and Bahram like this.
wyldckat is offline   Reply With Quote

Reply

Tags
cut, cylinder, paraview, programmable filter, slice


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with continuity simpleFoam kkl omega airfoils ibelunatic OpenFOAM Running, Solving & CFD 0 March 20, 2018 11:48
Strange high velocity in centrifugal pump simulation huangxianbei OpenFOAM Running, Solving & CFD 26 August 15, 2014 02:27
SimpleFoam - instable simulation Specialist OpenFOAM Running, Solving & CFD 17 August 12, 2014 04:52
interFoam/kOmegaSST tank filling with printStackError/Mules simpomann OpenFOAM Running, Solving & CFD 3 February 17, 2014 17:06
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28


All times are GMT -4. The time now is 19:37.