I’m trying to create a Dynamo script to generate annotative spot elevation labels. I have two surfaces — EG and FG — and I want to subtract FG from EG to show the elevation difference. But I’m stuck; it doesn’t seem to work as expected. Has anyone run into this before or found a workaround? Any help would be greatly appreciated. Thanks in advance!
Hi and welcome to the forum! I would suggest that you read the warnings as they are usually quite helpful and will explain what is going wrong.
For example, the Surface.ElevationAtXY node wants a Surface object as the first input, and as Anton pointed out, the Choose TIN Surface Name will only give you a String output.
What you need for that is the Selection.SurfaceByName node.
Object.Geometry will also only give a Function call without any input and requires some additional nodes do give X and Y coordinates for the Surface.ElevationAtXY node.
Here is an example where I’ve selected a Circle in Civil 3D Modelspace with the Select Object node and then taken the center of that circle with Circle.CenterPoint, after which I can use Point.X and Point.Y to get coordinates as inputs for Surface.ElevationAtXY.
This in turn will give you the elevation difference in the center point of that circle.
I hope this was helpful and gets you started on getting what you need from the script
Hi, thank you so much for the warm welcome and for taking the time to explain things so clearly!
I really appreciate your detailed breakdown—especially the clarification about the Surface.ElevationAtXY input and the use of Selection.SurfaceByName instead of just the string from Choose TIN Surface Name. That definitely helps me understand where I went wrong.
The example you shared using a Circle and extracting the center point coordinates was also very helpful. I’ll try to follow your approach and build around that. Thanks again for pointing me in the right direction—this really helps me get started!
Thank you for the clarification! That makes sense now—I was mistakenly feeding a geometry object instead of a number for X and Y, and I see now that the Surface input requires the actual Surface object, not just its name. I’ll make those adjustments. Appreciate your help!
I tried switching surfaces just to check, and the same issue occurred. The script still says ‘running’ on the command line — it seems to be taking an unusually long time to complete.