@pbejse wrote:
EDIT: This offer will expire in the next 10 minutes from now , my current time is 2:30 pm
Ow well, since i'm such a nice guy [as i like to think so] I will post the code anyway
Part of this routine is from this link Adding 0+ symbol by Kent Cooper [station function]
(defun c:gdst (/ station e p p2 dist dist2 newstr)
;;; pBe Dec 201 ;;;
;;; Station function by Kent Cooper ;;;
(defun station (numstr)
(setq intlen (strlen (itoa (atoi numstr))))
(while (< intlen 4)
(setq
numstr (strcat "0" numstr)
intlen (1+ intlen)
) ; setq
) ; while
(strcat
(substr numstr 1 (- intlen 3))
"+"
(substr numstr (- intlen 2))
) ; strcat
)
(if (setq e (car (nentselp "\nSelect road center line")))
(while (and (setq p (getpoint "\nPick point for label:"))
(setq txt (car (entsel "\nSelect label to update")))
)
(setq dist (vlax-curve-getDistAtPoint
e
(setq p2 (vlax-curve-getclosestpointto e p))
)
)
(setq dist2 (distance p p2))
(setq newstr (Strcat (station (rtos dist 2 3))
" (R/"
(rtos dist2 2 2)
")"
)
)
(vla-put-textstring (vlax-ename->vla-object txt) newstr)
)
)
(princ)
)
Command: GDST
Select road center line
[select the road center line once]
Pick point for label:
Select label to update
Pick point for label:
Select label to update
..........
You can continue to pick the point and text until you are done , i did notice a coupe of errors on the sample drawing such as
"0+304.326 (R/44.10)" that should've been 4.10. The routine above will help you avoid this.
But remember to reverse the direction of the road centerline that doesn't match the station start point.
HTH