Code:
;;;;;;;;;;;;;;;;;;;;;;;;;select polyline
;;select the centerline of the project (it will probablly be a 2d polyline, *polyline will work)
;;;;;;;;;;;;;;;;;;;;;;;;;select beginning
;;select the beginning point of the polyline (start point may not be necassary)
;;;;;;;;;;;;;;;;;;;;;;;;;select start station
;;some projects dont nessasarily start at 0+00, some might start at 100+00, this part should account for that)
(setq startsta (getint "\nEnter Start Station\n"))
;;;;;;;;;;;;;;;;;;;;;;;;;select points
;;select blocks on only particular layers with particular names (use insert point)
(setq pointlist
(ssget
"_X"
(LIST
'(-4 . "<AND")
(CONS 410 (GETVAR "ctab"))
'(-4 . "<OR")
'(0 . "insert")
'(8
.
"BNDPT,BNDPTS,FEATURE,FEATIURE,GDRL,EXIST TELE,TREELINE,UTILELEC,UTILSTORM,UTILCOMM,UTILSAN,UTILGAS,TREELINE,BLDGPT"
)
'(-4 . "OR>")
'(-4 . "AND>")
);END LIST
);END SSGET
);END SETQ
;;;;;;;;;;;;;;;;;;;;;;;;;get offset of point
;;find the perpindicular distance from the selected point to the centerline
;;;;;;;;;;;;;;;;;;;;;;;;;get station of point
;;find the distance along the centerline to the perpindicular point in the last step
(while (setq staoff (ssname ss 0))
(setq whole (/ sta 100)
remainder (* (rem sta 100) 100)
station (strcat whole "+" remainder));this part of the code converts the distance to the text that will be used below
;;;;;;;;;;;;;;;;;place text starting at 0+00 on both sides at 0,0 with proper scale distances
;;using the station value, place text beginning as though 0 is 0+00
(vl-load-com)
;(defun C:OffsetText ()
(setq acadObject (vlax-get-acad-object)) ;get Autocad object
(setq acadDocument (vla-get-ActiveDocument acadObject))
;get the Activedocument object
(setq acadModelSpace (VLA-GET-MODELSPACE acadDocument))
;get the modelspace block
(if (< (- sta sta1) (* 1.5 text_height))
(setq sta (+ sta1 (* 1.5 text_height)))
(setq sta1 sta)
);end if
(setq ofsl (* 22.5235 aoscale)
ofsr (* 7.35 aoscale)
);end setq
(if (< (atoi offset) 0)
(setq Insertpoint (list (sta,ofsl, "0")))
(setq Insertpoint (list (sta,ofsr, "0")))
);end if
(setq textObj (vla-addtext
acadModelSpace
(strcat station description offset);offset will be calculated above in the offset portion, description needs to be extracted from the appropriate attribute of the selected block
(vlax-3d-point Insertpoint)
text_height
);end vla-addtext
);end setq
(if (< (atoi offset) 0)
(vla-put-Alignment textObj 11) ;set text Justification
(vla-put-Alignment textObj 9) ;set text Justification
) ;end if
;(setq mytextObj myTextobj);retrun the text object
) ;end while
the while loop is to get this thing to loop until all points in the selection set have been annotated originally I had station first, but it might be easier to calc the offset first, then use that information to get the station, it might not be the proper way to loop the program, any better ideas are definitely welcome.