Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im trying to place my text centered at the angle of the line. Is it possible to use 72 or 73 to center it? Or perhaps some other way? Currently with the 72 or 73 the text doesnt appear.
(defun c:TEST (/ pnt1 BD D DD DD2 QD DG MN MN2 SEC BEARING BRGDIS lastline linedata startPoint endPoint cont objl size1 size2 zoomScale label centerPoint 1x 1y labeltxtpnt labelrot)
(setq pnt1 (getpoint "\nPick point: "))
(setq cont t)
(while cont
(setq BD (getstring "\nBearing (Qddmmss): "))
(if (not (equal BD ""))
(progn
(setq D (getstring "\nEnter distance: "))
(setq DD2 (strcat D "'"))
(setq DD (strcat "@" D))
(setq QD (substr BD 1 1))
(setq DG (substr BD 2 2))
(setq MN (strcat "d" (substr BD 4 2) "'"))
(setq MN2 (strcat "°" (substr BD 4 2) "'"))
(setq SEC (substr BD 6 2))
(cond
((= QD "1") (setq QD (strcat "N")) (setq SEC (strcat SEC "\"E")))
((= QD "2") (setq QD (strcat "S")) (setq SEC (strcat SEC "\"E")))
((= QD "3") (setq QD (strcat "S")) (setq SEC (strcat SEC "\"W")))
((= QD "4") (setq QD (strcat "N")) (setq SEC (strcat SEC "\"W")))
)
(setq QD1 (strcat "<" QD))
(setq BEARING (strcat QD1 DG MN SEC))
(setq BRGDIS (strcat DD BEARING))
(setq label (strcat QD DG MN2 SEC " " DD2))
(command "_line" pnt1 BRGDIS "" "");@123<S12d34'56"E
(setq lastline (entlast))
(setq size1 5)
(setq linedata (entget lastline))
(setq startPoint (cdr (assoc 10 linedata)))
(setq endPoint (cdr (assoc 11 linedata)))
(setq centerPoint (polar startPoint (angle startPoint endPoint) (/ (distance startPoint endPoint) 2.0)))
(setq labelRotation (angle startPoint endPoint))
(setq offsetDistance 1.0)
(setq offsetVector (polar centerPoint (+ labelRotation (/ pi 2)) offsetDistance))
(setq objl (distance startPoint endPoint))
(setq textScaleFactor (/ objl 100.0))
(setq textSize (* size1 textScaleFactor))
(setq textEntity (entmake
(list
'(0 . "TEXT")
(cons 8 "BDLABEL")
(cons 10 offsetVector)
(cons 40 textSize)
(cons 50 labelRotation)
(cons 1 label)
(cons 72 2)
(cons 73 2)
)
)
)
(setq size 2.5)
(setq zoomScale (/ size objl))
;-----ZOOMS------
(command "_.zoom" "O" lastline "")
(command "_.zoom" "W" startPoint endPoint "")
(command "_.zoom" "S" zoomScale "")
(setq pnt1 endPoint)
)
(setq cont nil)
)
)
)
Solved! Go to Solution.