Thursday, November 3, 2011

Lisp Routine to Label Contour Gaps by Inserting Automatic Text Aligned Between Two Points

I had to write this quick routine this morning so I could label a bunch of contour gaps for 3D polyline contours in AutoCAD. I donate it to the public domain.

;;; Text Between Points
;;; For labeling 3D polyline contour gaps
;;; By Thomas Gail Haws
;;; Donated to the public domain.
;;; "The master knows she is going to die, and she has nothing left to hold onto." Lao Tze in Tao Te Ching
;;; Revisions
;;; 2011-11-03 TGH Created program
(defun c:tbp ()
(setq pt1 (getpoint)
pt2 (getpoint pt1)
(text-between-points pt1 pt2)

(defun text-between-points (pt1 pt2 / ang)
str1 (rtos (caddr pt1) 2)
ang1 (angle pt1 pt2)
(/ (+ (car pt1) (car pt2)) 2.0)
(/ (+ (cadr pt1) (cadr pt2)) 2.0)
(command "._text"
(* (getvar "dimtxt") (getvar "dimscale"))
(angtos ang1)

No comments: