- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im having troubles with this lips routine, I think it once worked but not sure its not working anymore. I am trying to get values from 2 attributes and then get an average number between them by adding them and then dividing by 2. ELEV always reports nil so I need help with this
(defun c:interp (/ txtheight txtht txtht1 tp1At TP1T tp2At TP2T newpt elev)
(SETVAR "ATTREQ" 1)
(SETVAR "ATTDIA" 0)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(command "osmode" 😎
(setq txtheight(getvar "txtht"))
(setq txtht 0.05)
(setq txtht1 (* txtht 20))
(setq Currentla (getvar "clayer"))
(prompt "\nPick Elevation Marker : ")
(SETQ tbdata(entget (car (entsel))))
(setq tp1At (dxf 10 tbdata))
(setq tbdata (entget (entnext (dxf -1 tbdata))))
(setq TP1T (atof(dxf 1 tbdata)))
(prompt "\nPick Elevation Marker : ")
(SETQ tbdata(entget (car (entsel))))
(setq tp2At (dxf 10 tbdata))
(setq tbdata (entget (entnext (dxf -1 tbdata))))
(setq TP2T (atof(dxf 1 tbdata)))
(setvar "osmode" 0)
(setq newpt (getpoint "\npick point for new elevation: "))
(setq elev (rtos(/ (+ tp1t tp2t)2)2 2))
;;(atof (rtos elev 2 2));round to 2 decimal places
;;(rtos elev 2 2);round to 2 decimal places
(setq aa (/ (* (angle tp2At tp1At) 180.0) pi))
(command "-insert" "level" newpt "" "" aa elev )
;;(setq elev 0)
(setvar "osmode" 545)
(setvar "cmdecho" 1)
(setvar "blipmode" 1)
(SETVAR "ATTDIA" 1)
(setvar "clayer" Currentla)
(SETQ txtht TXTHEIGHT)
(princ)
)
Solved! Go to Solution.