It is however a kind of a workaround so I included a video in the end to show the workflow, as it is not simple as click-tada!
I must admit that my mind has pondered this problem for some time now. Not being able to solve it (effectively) by any standard means, it was one of the reasons I got interested in dynamo.
I've come to learn that a lot of people have solved this before, by using a class in the Revit API called ReferenceIntersector and it is probably still the best way to solve it. Partly because I think it would use less resources and partly because it is vector driven and therefore able to handle angeled piles with slope.
But since I'm still not a programmer I leave it up to one of you clever readers with programming experience to solve that. What I do is workarounds, and I love it when it works!
First I tried fiddling around in dynamo with the Point.Project node, but as I said in an earlier post, that fell to the ground quickly as the node couldn't read a mesh derived from a topo. (Colin McCrone said they're looking into mesh handling as we speak, though! Nice!)
Then I tried the Intersector way, but that involved heavy programming, so that fell through..
So I thought long about this and it kept getting back to the same question: How do I get the Z-value from a topo when I have the X and Y coords defined?
But then it struck me. What is the easiest way to place something on a topo??
A site component, of course!!
What if I make a small site component, place it with XY-coords and it just automatically snaps to topo? then I could just get the location of top pile and top site component, a simple subtraction and then voila?
Once again it involved programming, and I thought I got very far. But I couldn't get it to work, so I gave up and asked on the forum. And I'll be damned if the forum didn't deliver! Or Andreas Dieckmann to be exact. He didn't just point me in the right direction, he didn't just give me the modified python script on a copy/paste basis but he even annotated it so I could learn what the different parts was for. I'm nearly speechless! Huge thanks, Andreas!
The workflow goes like this:
1. Use the first graph to place site elements by level.
2. Pick all the site elements and pick topo as new host and set offset to 0 in Revit.
3. Open second graph and select both piles and site components
4. Press run, and delete the site objects if you don't want them
How you select elements can of course be edited, I just like the manual way! ;)