;;;Label contour polylines with their elevation. ;;; ;;; ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 3-16-96 ;;;> EDITED: 10-06-2005 ;;; (defun c:clbl (/); line1 line2 pt1 pt2 pt3 pt4 (c:svlayr) (setq osnap_mode (getvar"osmode")) (setvar "osmode" 0) (if (tblsearch "style" "simplex") (setvar "textstyle" "simplex") ) (IF uint NIL (LOAD "uint" "\nFile UINT.LSP not loaded! ")) (SETQ contprec (uint 1 "" "Contour label precision:" (IF contprec contprec 0))) (while (setq nent (nentsel "\nPick contour at point to label")) (if dimscl nil (load"dimscl")) (dimscl) (if (>(getvar"viewtwist")0) (setq txt_twst (-(* pi 2)(getvar "viewtwist"))) (setq txt_twst (getvar "viewtwist")) ) (setq pt0 (nth 1 nent) line1 (entget(car nent)) pt1 (cdr(assoc 10 line1)) txtht (if do_cmud (* 0.0750 dimsc)(* 0.110 dimsc)) nent_layr (cdr(assoc 8 line1)) pt2 (cond ((eq "VERTEX"(cdr(assoc 0 line1))) (cdr(assoc 10(entget(entnext(cdr(assoc -1 line1))))))) ((eq "LINE"(cdr(assoc 0 line1))) (cdr(assoc 11 line1))) ((eq "AECC_CONTOUR" (cdr(assoc 0 line1))) (upoint 1 "" "Pick rotation angle" nil pt0) ) );cond ) (IF (eq "AECC_CONTOUR" (cdr(assoc 0 line1))) (SETQ conti (cdr (assoc 40 LINE1)) lang (angle pt0 pt2) contz (RTOS conti 2 contprec) ) (SETQ conti (caddr pt1) lang (angle pt1 pt2) contz (RTOS conti 2 contprec) ) ) (setq chkang (+ lang (getvar"viewtwist"))) (if (or (and(> chkang 1.8675)(< chkang 5.009)) (and(> chkang (+(* 2 pi)1.8675))(< chkang (+(* 2 pi)5.009))) ) (setq txang (*(/(+ pi lang)2 pi)360)) (setq txang (*(/ lang 2 pi)360)) );if (IF gvpno nil (LOAD "gvpno") ) ;_ end of if (gvpno) (setq pt0 (trans(list(car pt0)(cadr pt0))0 1) pt1 (trans(list(car pt1)(cadr pt1))0 1) pt2 (trans(list(car pt2)(cadr pt2))0 1) mjrg "C" llt (if(or(wcmatch (STRCASE nent_layr) "CSTTPX##|*") (wcmatch (STRCASE nent_layr) "CSTECX##|*") ) "E" "-" ) ;;; prod "CONT" colr (if(or(wcmatch (STRCASE nent_layr) "CSTTPX##|*") (wcmatch (STRCASE nent_layr) "CSTECX##|*") do_cmud ) "1" "6" ) );setq (IF (not (eq "AECC_CONTOUR" (cdr(assoc 0 line1)))) (SETQ pt0 (polar pt1 (angle pt1 pt2)(distance pt1 pt0))) ) (cond ((eq(rem conti 10)0) (setq modf "TX10")) ((eq(rem conti 5)0) (setq modf "TX05")) ((eq(rem conti 2)0) (setq modf "TX02")) ((setq modf "TX01")) );cond (setq dont_ask_ltyp T) (c:mklayr) (setq dont_ask_ltyp NIL) (command ".text" "j" "mc" pt0 txtht txang contz) (setq cltxt (entget(entlast)) cltxt (subst (cons 51 0.2618) (assoc 51 cltxt) cltxt ) );setq (entmod cltxt) );while (c:rslayr) (setvar "osmode" osnap_mode) (princ) );defun