I have the following lisp which calculates elevations in a block (spot shot block). However, all the blocks are 2d with 0.0 elevation to them. I would Like to know if they can be set to the elevation of the block to a Z value being the same as the block.
(defun c:sltag ( / scft nstelev nslope FIRSTPT PT1 PT2 distm dist1 nxtelev)
;Set defaults on first use
(if (= stelev nil) (setq stelev 800.00))
(if (= slope nil) (setq slope -0.02))
(command ".undo" "begin")
(setvar "cmdecho" 0)
(setvar "attdia" 0)
(setvar "texteval" 1)
(setq scft (getvar "LTscale"))
(if (= 2 (getvar "lunits")) (setq tunit 2 tprec 3) )
(if (= 4 (getvar "lunits")) (setq tunit 4 tprec 4) )
(if (setq nstelev (getdist (strcat "Enter Starting Elevation <" (RTOS stelev) ">: ")))
(setq stelev nstelev)
)
(if (setq nslope (getreal (strcat "Enter Slope Factor (Negative For Down) <" (RTOS slope 2 8) ">: ")))
(setq slope nslope)
)
(setq FIRSTPT (getpoint "Select Starting point ")
PT2 (getpoint FIRSTPT "\nNext point ")
distm (distance firstpt pt2)
nxtelev (+ (* distm slope) stelev)
)
(princ (strcat "\n Distance is " (rtos (distance firstpt pt2))))
(princ (strcat "\n Slope is " (rtos (* distm slope))))
(princ (strcat "\n Elevation is " (rtos nxtelev tunit tprec)))
;;;; (txstla)
(command "-insert" "E:/CAD/Ielev" "s" scft "r" "0" pt2 (strcat (rtos nxtelev 2 2)""))
(while (/= PT2 nil)
(setq PT1 PT2)
(setq PT2 (getpoint PT1 "\n\nNext point "))
(if (/= PT2 nil)
(progn
(setq dist1 (distance pt1 pt2)
distm (+ distm dist1)
nxtelev (+ (* dist1 slope) nxtelev)
)
(princ (strcat "\n Distance is " (rtos dist1)))
(princ (strcat "\n Slope is " (rtos (* dist1 slope))))
(princ (strcat "\n Elevation is " (rtos nxtelev tunit tprec)))
(princ (strcat "\n Running Total Distance is " (rtos distm)))
(command "-insert" "E:/CAD/Ielev" "s" scft "r" "0" pt2 (strcat (rtos nxtelev 2 2)""))
)
)
)
(princ (strcat "\n\n Final Total Distance is " (rtos distm)))
(setvar "attdia" 1)
(command ".undo" "end")
(princ)
)
thanks
<edit: code tags added>