I am attempting to use lisp to change a TIN Surface point elevation using visual lisp.
I get the surface object with ename->vla-object
I retrieve the points safearray with vlax-get-property and then vlax-variant-value.
I now have a safearray from which I can extract each point's x y z using a counter.
I then thought I could use vlax-safearray-put-element to change the elevation. Debugging responds that the value has been 'put,' but I don't know how I need to figure out how to put it all back into the surface.
I notice that 'Points property of the surface object is read only. Does that mean I am spinning my wheels or is there a way to do this.
;This code evaluates surface points on Groundwater surface and changes them to equal OG surface if groundwater is higher. (defun c:go () (setq ogsrfv (vlax-ename->vla-object (car (entsel "\nSelect OG surface:"))) gwsrfv (vlax-ename->vla-object (car (entsel "\nSelect GW surface: "))) ) ; (vlax-dump-object ogsrfv t) ; (vlax-dump-object gwsrfv t) (setq gwpts (vlax-get-property gwsrfv 'Points)) (setq gwptsvar (vlax-variant-value gwpts)) (setq lb (vlax-safearray-get-l-bound gwptsvar 1)) (setq ub (vlax-safearray-get-u-bound gwptsvar 1)) (setq ctr lb) (while (<= ctr ub) (setq p1x (vlax-safearray-get-element gwptsvar ctr)) (setq p1y (vlax-safearray-get-element gwptsvar (+ ctr 1))) (setq p1z (vlax-safearray-get-element gwptsvar (+ ctr 2))) ;Get OG elevation (setq OGz (vlax-invoke-method ogsrfv 'FindElevationAtXY p1x p1y)) ;if gw elevation is higher than og, modify gw to match og (if (> p1z ogz) (vlax-safearray-put-element gwptsvar (atoi (rtos (+ ctr 2) 2 0)) OGz) );end if (setq ctr (+ ctr 3)) );end while (princ) );end defun
I am attaching a test drawing with a couple of very simple surfaces.
Please don't tell me to go learn .net. I know it's better and Autodesk doesn't want to support vlisp for Civil 3D, but vlisp is just so convenient for us non-programmers.
Thanks in advance for any sage advice...
Tim
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
@tcorey wrote:
I am attempting to use lisp to change a TIN Surface point elevation using visual lisp.
I am attaching a test drawing with a couple of very simple surfaces.
Please don't tell me to go learn .net. I know it's better and Autodesk doesn't want to support vlisp for Civil 3D, but vlisp is just so convenient for us non-programmers.
Thanks in advance for any sage advice...
Tim
Well...... I won't tell you, then, that the EditOperations are not available in the COM API but they are in the managed .NET API....
I figured that was the case. Dang it.
Thanks, Jeff.
Tim