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

[OpenFOAM] Clip by an stl file

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Carlo_P

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2019, 15:21
Default Clip by an stl file
  #1
Member
 
Join Date: May 2017
Posts: 41
Rep Power: 8
Ryan. is on a distinguished road
Hello everyone,

is possible to clip my data using an STL file? At the moment, I am using a programmable filter with a cylinder but I would like to replace the cylinder with an STL file or any other format that allows me to use an arbitrary geometry for clipping my original data.

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.05,0,-0)
cyl.SetRadius(0.0095)
cyl.SetTransform(transf)
clipper = vtk.vtkClipDataSet()
clipper.SetClipFunction(cyl)
clipper.SetInputData(inp_copy)
clipper.Update()
self.GetOutputDataObject(0).ShallowCopy(clipper.GetOutputDataObject(0))
Thanks,
Ryan
Ryan. is offline   Reply With Quote

Old   October 16, 2019, 07:56
Default
  #2
Senior Member
 
Carlo_P
Join Date: May 2019
Location: Italy
Posts: 176
Rep Power: 7
Carlo_P is on a distinguished road
You can use a sampleDict file in openFOAM.
It will create some points on your .stl file and create some "sample" points.


{ // Sampling on triSurface type sampledTriSurfaceMesh; surface integrationPlane.stl; source boundaryFaces; // sample cells or boundaryFaces interpolate true; }


Here you can find the original file:


https://github.com/OpenFOAM/OpenFOAM...ple/sampleDict




Let me know if it can be ok.
Ryan. likes this.
Carlo_P is offline   Reply With Quote

Reply

Tags
clip, programmable filter, stl file


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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 35 April 29, 2022 15:35
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 08:46
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


All times are GMT -4. The time now is 02:00.