@hippe013 wrote:
It looks like you are trying to get the elevation from the surface from the end points and then computing the midpoint. You will need to compute this mid-point first and then place that into the arguments for the surface elevation.
;Lets create a copy of the two points as 2D points.
(setq p02d (list (car p0) (cadr p0) 0))
(setq p12d (list (car p1) (cadr p1) 0))
;Get the Angle between the two points
(setq ang (angle p02d p12d))
;Get the 2D Distance and cut the distance in half
(setq dist (/ (distance p02d p12d) 2.0))
;Compute the Mid-Point
(setq midPnt (polar p02d ang dist))
;Try and get the Surface Elevation at MidPoint
(setq args0 (list surf 'FindElevationAtXY (car midPnt) (cadr midPnt)))
(setq elev0 (vl-catch-all-apply 'vlax-invoke-method args0))
I hope that this helps clarify things for you.
Hello @hippe013,
Thank you for the reply, when I saw your reply and you just posted the partial code I thought it will now take months to finalize my requested code because of me not having enough knowledge of these codes. I tried again for a long time to compile it and see what mistakes are there in my last compiled code. I saw I have changed and removed last part where we have to give start and end invert levels which we have taken from surface at pipe middle point. Before I thought that we have to give that level at pipe middle only but then realized there is no such thing pipe middle level in civil3d. Then I tried few more changing and at last I got the code I was looking for.
Thanks to you for your codes and helping me to understand these things. It will save my time from manually inputting levels of pipes.
But please remember I really don't know that much of these codes if I have to built this kind of code from scratch I really can't because I don't know how to start what coding, arguments and commands are needed to built that code.
Thank you so much again for your time and help.