Hi,
What I got from your description & attached Image -
1 You should enter the datum value (say 929.00) into attribute blocks (that will be fixed value for the building).
2 At the time of Inserting Block you should select raw site elevation data (say 929.67) & pick Block Insertion Point.
3 After that Block will placed with the relative elevation of raw site elevation with relation to datum value.
If I an right then try the attached code.....
Only one thing you have to consider that, when you enter the datum value into attribute blocks that always keep integer/ float value (say 929 or 929.67), do not place any special character there (say + - ( )..etc.). otherwise code can not calculate the relative value.
It will give you your desired result (say 929.67(+0.67) or 929.67(+29.67) or 500.75(-399.25) etc.)
(defun c:CAT()
(setq Blk (getstring "\nEnter Block Name: "))
(while (setq entt (car (entsel "\nSelect Raw Elevation:")))
(setq enttx (entget entt))
(setq txt (cdr (assoc 1 enttx)))
(setq Ins (getpoint "\nPick/Enter Insertion Point: "))
(command "_.insert" blk ins "" "" "")
(setq elst1 (setq elst1 (entget (entnext (entlast)))))
(setq ff1 (assoc 1 elst1))
(setq Dat_Val (atof (cdr ff1)))
(if (> (- (atof txt) Dat_Val) 0)
(setq Att_text (strcat txt "(+" (rtos (- (atof txt) Dat_Val) 2 2) ")"))
(setq Att_text (strcat txt "(" (rtos (- (atof txt) Dat_Val) 2 2) ")"))
)
(setq xx (cons 1 Att_text))
(entmod (subst xx ff1 elst1))
(command "regen")
)
)
Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....