CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Projecting Points onto .stl Defined Surface (

mchurchf August 17, 2012 16:50

Projecting Points onto .stl Defined Surface
I want to read in a .stl file and use it to define a surface. Then given an x,y location, I'd like to project onto the surface to find the z height. Can anyone help with how to do that. The surfaceDisplacement boundary condition that can be used for the "pointMotion" field with the moveDynamicMesh solver seems to be able to do this, but I can't figure out how to do that. I've taken the "transformPoints" utility and modified it to take a block mesh made with "blockMesh" and translate points vertically to conform to an analytical surface definition at the bottom, but now I want to have the ability to conform to a general surface definition that comes in the form of an .stl file.

Thank you,


l_r_mcglashan August 17, 2012 17:04

Would functions such as findLine in triSurfaceMesh be what you're looking after?

mchurchf August 17, 2012 17:13


If I'm reading the code correctly, one would give start and end point fields of a segments, and findLine will return the intersections? If so, that's pretty neat.


l_r_mcglashan August 17, 2012 17:19

Yes and an octree is used for the search, useful if you have a large surface. Hope that helps!

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