i have this lisp which allows me to place result in drawing,but i want to write out to a text file with select y/n,how to do it?
thanks!
; (c) Marker Engineering Surveying Co.
;Place CH,O/S,Easting and Northing on drawing with leader to point
(prompt "\nMarker Engineering Surveying Co.")
(defun c:chosen (/ endpt ent off offpt onpt ss sta startpt)
(defun Xmarksthespot (x y / leglen start)
(setq start (list x y)
leglen (* 0.03 (getvar "viewsize"))
)
(grdraw (polar start (angtof "135" 1) leglen)
(polar start (angtof "315" 1) leglen)
7)
(grdraw (polar start (angtof "45" 1) leglen)
(polar start (angtof "225" 1) leglen)
7)
)
(while (setq ss (ssget ":S" '((0 . "LINE,*POLYLINE,SPLINE,ARC"))))
(setq ent (ssname ss 0))
(setq startpt (vlax-curve-getstartpoint ent)
endpt (vlax-curve-getendpoint ent)
)
(xmarksthespot (car startpt)(cadr startpt))
(setq startptch(getreal "\nStart Point Ch="))
(setq t1 "Text Height: <default = ")
(setq t2 " >: ")
(setq t3 (getvar "textsize"))
(terpri)
(setq HT (getreal (strcat t1 (rtos t3 2 2) t2)))
(if (= HT nil)
(setq HT t3)
)
(command "dim" "dimtxt" ht "exit")
(command "dim" "dimasz" ht "exit")
(setq a " N ")
(setq b " E ")
(setq c "CH=")
(setq d "O/S=")
(while (setq offpt (getpoint "\nOffset point: "))
(setq onPt (vlax-curve-getclosestpointto ent offpt)
sta (vlax-curve-getdistatpoint ent onpt)
off (distance onpt offpt)
)
(setq ch (rtos (+ sta startptch) 2 3))
(setq off1 (rtos off 2 3))
;(setq p1 (getpoint "\nCoordinates of which point?"))
(setq e (rtos (car offpt) 2 3))
(setq n (rtos (cadr offpt) 2 3))
(setq coorde (strcat e b))
(setq coordn (strcat n a))
(setq chainage (strcat c ch))
(setq offset (strcat d off1))
(setq p2 (getpoint offpt"\nText Location:"))
(command "_leader" offpt p2 "a" chainage offset coorde coordn "")
;(princ (strcat "Station: " (rtos sta 2 2) " - Offset: " (rtos off 2 2)))
)
(redraw)
)
(princ)
)
(prompt "\nType CHOSEN to start routine ")
original lisp
Re: Baseline Station and Offset
Thanks for the reply, I got a wonderful routine from the customization NG.
BTW, just using vanilla AutoCAD. Here is the routine I got from there, I'll
share here for the curious. This seems to work well for my needs. Thanks
all.
;;station/offset listing
(defun c:sta-off (/ endpt ent off offpt onpt ss sta startpt)
;; Marker for point location on the screen
;; Oct. 2004 by Jeff Mishler
(defun Xmarksthespot (x y / leglen start)
(setq start (list x y)
leglen (* 0.03 (getvar "viewsize"))
)
(grdraw (polar start (angtof "135" 1) leglen)
(polar start (angtof "315" 1) leglen)
7)
(grdraw (polar start (angtof "45" 1) leglen)
(polar start (angtof "225" 1) leglen)
7)
)
(while (setq ss (ssget ":S" '((0 . "LINE,*POLYLINE,SPLINE,ARC"))))
(setq ent (ssname ss 0))
(setq startpt (vlax-curve-getstartpoint ent)
endpt (vlax-curve-getendpoint ent)
)
(xmarksthespot (car startpt)(cadr startpt))
(while (setq offpt (getpoint "\nOffset point: "))
(setq onPt (vlax-curve-getclosestpointto ent offpt)
sta (vlax-curve-getdistatpoint ent onpt)
off (distance onpt offpt)
)
(princ (strcat "Station: " (rtos sta 2 2) " - Offset: " (rtos off 2
2)))
)
(redraw)
)
(princ)
)