;;;Update profile location and station / elevation text ;;;Requirements: ;;; Requires UUTILS.LSP and STAIT.LSP to be loaded. ;;; ;;;Drawing must contain: ;;; The profile viewport on layer "*VI01*NPLT*" (preferably "??VI01?NPLT" per CLG) ;;; The profile grid block named "cpp##spl" or "##ppgrid*" or "##spclgrid" or "##spfbgrid" ;;; (#'s are wildcards which must be replaced with digits representing profile horizontal scale) ;;; These profile grid blocks must contain specific attribute tags for stations and elevations, ;;; i.e.: ;;; ;;; left side attribute tags (ordered before right side tags) ;;; LB+0, LB+5, LB+10, etc. ordered from highest LB+## to LB+0; ;;; (The total number of these tags is unlimited) ;;; ;;; right side attribute tags ;;; RB+0, RB+5, RB+10, etc. also ordered from highest RB+## to RB+0; ;;; (The total number of these tags is unlimited) ;;; ;;; station attribute tags ;;;; 0, +0, 1, +1, 2, +2, etc. from left to right as many as are required ;;; place these in pairs at scaled 100' increments (english), 50m increments (metric). ;;; integer tags are right justified and +integer tags are left justified so that the first character, ;;; typically a plus sign (+), will lay directly under the grid line. This solves justification related ;;; misalignment of labels. ;;; (The total number of these tags is unlimited) ;;; ;;; ;;; ;;; ;;;**************************************************************************** ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 1-14-98 ;;;> EDITED: 03-09-2006 ;;; (DEFUN ustael_error (msg / ) (princ (strcat "\nError: " msg)) (SETQ *error* orig_error) (IF old_ustaelDIMZIN (SETVAR "DIMZIN" old_ustaelDIMZIN)) (COMMAND ".mview" "lock" "on" "all" "") (PRINC) ) ;;;**************************************************************************** (DEFUN c:USTAEL () (SETQ orig_error *error* *error* ustael_error) (SETQ old_ustaelDIMZIN (GETVAR "DIMZIN")) (SETVAR "DIMZIN" 0) (IF (AND (> (GETVAR "cvport") 1) (EQ (GETVAR "tilemode") 0)) nil (IF (EQ (GETVAR "tilemode") 0) (COMMAND "._mspace") (PRINC "\nPaper space is not active") ) ;_ end of if ) ;_ end of if (IF (AND ukword ureal) nil (LOAD "uutils") ) ;_ end of if (SETQ rtview (ukword 1 "continue" "Make the profile view current before continuing." "continue" ) ;_ end of ukword ) ;_ end of setq (COMMAND ".mview" "lock" "off" "all" "") (SETQ curvno (GETVAR "cvport")) ;;; (REGAPP "ACAD") (SETQ cvpss (SSGET "X" (LIST (CONS 69 curvno)))) (SETQ cvpent (ENTGET (SSNAME cvpss 0) (LIST "ACAD"))) (SETQ vpscl (/ (GETVAR "viewsize") (CDR (ASSOC 41 cvpent)))) (SETQ vpscl_tst (ATOI(RTOS(/ (GETVAR "viewsize") (CDR (ASSOC 41 cvpent)))2 0))) (IF(/= vpscl vpscl_tst) (PROGN (COMMAND "'.zoom" (strcat "1/"(ITOA vpscl_tst)"xp")) (PRINC (STRCAT "\nViewport scale was 1\"="(RTOS vpscl 2 4)"' Viewport zoomed 1/"(ITOA vpscl_tst)"XP ")) (SETQ vpscl (/ (GETVAR "viewsize") (CDR (ASSOC 41 cvpent)))) ) ) (COND ((OR (EQ (GETVAR "lunits") 1) (EQ (GETVAR "lunits") 5)) (PRINC (STRCAT "Viewport scale is: 1:" (RTOS vpscl 2 4) " (1:" (RTOS vpscl 2 4) ")" ) ;_ end of strcat ) ;_ end of princ ) ((EQ (GETVAR "lunits") 2) (PRINC (STRCAT "Viewport scale is: 1\"=" (RTOS vpscl 2 4) "' (1:" (RTOS vpscl 2 4) ")" ) ;_ end of strcat ) ;_ end of princ ) ((EQ (GETVAR "lunits") 3) (PRINC (STRCAT "Viewport scale is: 1\"=" (RTOS (/ vpscl 12) 2 4) "' (1:" (RTOS vpscl 2 4) ")" ) ;_ end of strcat ) ;_ end of princ ) ((EQ (GETVAR "lunits") 4) (PRINC (STRCAT "Viewport scale is: " (RTOS (/ 12.0000 vpscl) 5 4) "\"=1'-0\" (1:" (RTOS vpscl 2 4) ")" ) ;_ end of strcat ) ;_ end of princ ) ) ;_ end of cond (SETQ cvcntr (GETVAR "viewctr") vrt_scale (ureal 1 "" (STRCAT "Vertical scale " (CHR 40) "1\"=?" (CHR 41)) (IF vrt_scale vrt_scale 5 ) ;_ end of IF ) ;_ end of ureal vrt_fact (/ vpscl vrt_scale) cvsize (GETVAR "viewsize") cvscle (/ cvsize (CDR (ASSOC 41 cvpent))) cvwdth (* (CDR (ASSOC 40 cvpent)) cvscle) cvpllx (- (CAR cvcntr) (/ cvwdth 2)) cvplly (/ (- (CADR cvcntr) (/ cvsize 2)) vrt_fact) ) ;_ end of SETQ (PRINC (STRCAT "\nCurrent Profile Beginning Station = " (RTOS cvpllx 2 2) ) ;_ end of strcat ) ;_ end of princ (SETQ cursta (ureal 1 "" " Enter Station of 1st Profile Grid Label" cvpllx ) ;_ end of uint ) ;_ end of setq (SETQ viewsta (ureal 1 "" " Enter Station @ Bottom Left Corner of Viewport" cvpllx) ;_ end of uint ) ;_ end of setq (PRINC (STRCAT "\nCurrent Profile Base Elevation = " (RTOS cvplly 2 0) ) ;_ end of strcat ) ;_ end of princ (SETQ cedatum (ureal 1 "" " Enter Base Elevation (@ bottom of viewport)" cvplly)) (SETQ sedata (SSGET "X" '((-4 . "") ) ) ;_ end of SSGET ) ;_ end of SETQ (IF (AND sedata (> (SSLENGTH sedata) 1)) (PROGN (COMMAND "._pspace") (PRINC "\nSelect profile grid label block to update: ") (SETQ sedata (SSGET '((-4 . "") ) ) ;_ end of SSGET ) ;_ end of SETQ (COMMAND "._mspace") ) ;_ end of PROGN ) ;_ end of IF (panprv) (IF sedata (PROGN (SETQ lbelev_lst nil rbelev_lst nil sta_lst NIL ) ;_ end of SETQ (SETQ sedat (ENTNEXT (SSNAME sedata 0)) insert_ent sedat ) ;_ end of SETQ (WHILE (/= (CDR (ASSOC 0 (ENTGET sedat))) "SEQEND") (IF (EQ (CDR (ASSOC 0 (ENTGET sedat))) "ATTRIB") (COND ((EQ (SUBSTR (CDR (ASSOC 2 (ENTGET sedat))) 1 2) "LB") (IF lbelev_lst (SETQ lbelev_lst (APPEND lbelev_lst (LIST sedat))) (SETQ lbelev_lst (LIST sedat)) ) ;_ end of IF (SETQ sedat (ENTNEXT sedat)) ) ((EQ (SUBSTR (CDR (ASSOC 2 (ENTGET sedat))) 1 2) "RB") (IF rbelev_lst (SETQ rbelev_lst (APPEND rbelev_lst (LIST sedat))) (SETQ rbelev_lst (LIST sedat)) ) ;_ end of IF (SETQ sedat (ENTNEXT sedat)) ) ((EQ (TYPE (READ (CDR (ASSOC 2 (ENTGET sedat))))) 'INT) (IF sta_lst (SETQ sta_lst (APPEND sta_lst (LIST (LIST sedat (ENTNEXT sedat))) ) ;_ end of APPEND ) ;_ end of SETQ (SETQ sta_lst (LIST (LIST sedat (ENTNEXT sedat)))) ) ;_ end of IF (SETQ sedat (ENTNEXT (ENTNEXT sedat))) ) ) ;_ end of COND (SETQ sedat (ENTNEXT (ENTNEXT sedat))) ) ;_ end of IF ) ;_ end of WHILE (IF lbelev_lst (SETQ lbelev_lst (REVERSE lbelev_lst)) ) ;_ end of if (IF rbelev_lst (SETQ rbelev_lst (REVERSE rbelev_lst)) ) ;_ end of if (COND ((OR (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CPP20SPL") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CMUD20SP") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "20PPGRID*") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "20SPCLGRID") ) ;_ end of OR (SETQ grdwid 2.5) ) ((OR (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CPP30SPL") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CMUD30SP") (WCMATCH (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "30PPGRID*") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "30SPCLGRID") ) ;_ end of OR (SETQ grdwid 1.66667) ) ((OR (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CPP40SPL") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CMUD40SP") (WCMATCH (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "40PPGRID*") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "40SPCLGRID") ) ;_ end of OR (SETQ grdwid 2.5) ) ((OR (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CPP50SPL") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CMUD50SP") (WCMATCH (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "50PPGRID*") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "50SPCLGRID") ) ;_ end of OR (SETQ grdwid 2.0) ) ((OR (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CPP60SPL") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "CMUD60SP") (WCMATCH (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "60PPGRID*") (EQ (STRCASE (CDR (ASSOC 2 (ENTGET (SSNAME sedata 0))))) "60SPCLGRID") ) ;_ end of OR (SETQ grdwid 1.66667) ) (T (SETQ grdwid 2.5)) ) ;_ end of COND (SETQ csdndx 0) ; (panprv) (if stait nil (load "stait" "\nFile STAIT.LSP not found! ")) (IF (OR (= (REM (/ vpscl vrt_fact) 1) 0) (= (REM (/ vpscl vrt_fact) 1) 0.5) ) ;_ end of OR (SETQ vrt_prec 0) (IF (= (REM (/ vpscl vrt_fact) 1) 0.25) (SETQ vrt_prec 1) (SETQ vrt_prec 2) ) ;_ end of if ) ;_ end of if (IF (EQ (SETQ updatt (ukword 1 "Yes No Left Middle Right" "\nUpdate grid station & elevation labels? " (IF updatt updatt "Yes" ) ) ;_ end of ukword ) ;_ end of setq "Yes" ) ;_ end of eq (PROGN (FOREACH n sta_lst (setq this_sta (+ (* csdndx grdwid vpscl) cursta) this_sta_txt (stait this_sta 0) sta_pos 1 ) (while (not (or (wcmatch(substr this_sta_txt sta_pos 2)"#-") (wcmatch(substr this_sta_txt sta_pos 2)"#+") ) ) (setq sta_pos (1+ sta_pos)) ) (IF (OR (< this_sta (CADR(CAR align_lst)))(< this_sta 0)) (IF blank_neg_sta NIL (PROGN (IF (AND aln_name (EQ (TYPE aln_name) 'STR)) (PROGN (PRINC (STRCAT "\nCurrent alignment name is: " aln_name " ")) (PRINC) ) ) (SETQ blank_neg_sta (ukword 1 "Yes No" "Blank out negative station labels? :" "Yes")) ) ) ) (COND ((AND(OR (< this_sta (CADR(CAR align_lst)))(< this_sta 0))(EQ (STRCASE blank_neg_sta) "YES")) (setq csdatc "") (setq csdatp "") ;;; (setq blank_neg_sta nil) ) (T ;(OR(EQ (STRCASE blank_neg_sta) "NO")(NOT blank_neg_sta)) (setq csdatc (substr this_sta_txt 1 sta_pos)) (setq csdatp (substr this_sta_txt (1+ sta_pos))) ;;; (setq blank_neg_sta nil) ) ) (SETQ sta#_ent (ENTGET (CAR n)) plus_ent (ENTGET (CADR n)) ) ;_ end of setq (SETQ sta#_ent (SUBST (CONS 1 csdatc) (ASSOC 1 sta#_ent) sta#_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD sta#_ent) (SETQ plus_ent (SUBST (CONS 1 csdatp) (ASSOC 1 plus_ent) plus_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD plus_ent) (SETQ csdndx (1+ csdndx)) ) ;_ end of foreach (SETQ blank_neg_sta NIL) (IF (OR (= (REM (/ vpscl vrt_fact) 1) 0) (= (REM (/ vpscl vrt_fact) 1) 0.5) ) ;_ end of OR (SETQ vrt_prec 0) (IF (= (REM (/ vpscl vrt_fact) 1) 0.25) (SETQ vrt_prec 1) (SETQ vrt_prec 2) ) ;_ end of if ) ;_ end of if (SETQ cedndx 0) (FOREACH n lbelev_lst (SETQ cedatb (RTOS ;;; (+ cedatum (* cedndx grdwid (/ vpscl vrt_fact))) (+ cedatum (* cedndx (/ grdwid 2.0) (/ vpscl (COND ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(5 10))(* vrt_fact 2.0)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(20 30 40 60 80 200 300 400 600 800))(* vrt_fact 0.5 grdwid)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(50 100 500))vrt_fact) (T vrt_fact) ) ) ) ) 2 vrt_prec ) ;_ end of RTOS ) ;_ end of SETQ (SETQ elev_ent (ENTGET n)) (SETQ elev_ent (SUBST (CONS 1 cedatb) (ASSOC 1 elev_ent) elev_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD elev_ent) (SETQ cedndx (1+ cedndx)) ) ;_ end of foreach (SETQ cedndx 0) (FOREACH n rbelev_lst (SETQ cedatb (RTOS ;;; (+ cedatum (* cedndx grdwid (/ vpscl vrt_fact))) (+ cedatum (* cedndx (/ grdwid 2.0) (/ vpscl (COND ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(5 10))(* vrt_fact 2.0)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(20 30 40 60 80 200 300 400 600 800))(* vrt_fact 0.5 grdwid)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(50 100 500))vrt_fact) (T vrt_fact) ) ) ) ) 2 vrt_prec ) ;_ end of RTOS ) ;_ end of SETQ (SETQ elev_ent (ENTGET n)) (SETQ elev_ent (SUBST (CONS 1 cedatb) (ASSOC 1 elev_ent) elev_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD elev_ent) (SETQ cedndx (1+ cedndx)) ) ;_ end of foreach (ENTUPD insert_ent) ) ;_ end of PROGN (COND ((EQ updatt "Right") (PROGN (SETQ cedndx 0) (FOREACH n rbelev_lst (SETQ cedatb (RTOS ;;; (+ cedatum (* cedndx grdwid (/ vpscl vrt_fact))) (+ cedatum (* cedndx (/ grdwid 2.0) (/ vpscl (COND ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(5 10))(* vrt_fact 2.0)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(20 30 40 60 80 200 300 400 600 800))(* vrt_fact 0.5 grdwid)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(50 100 500))vrt_fact) (T vrt_fact) ) ) ) ) 2 vrt_prec ) ;_ end of RTOS ) ;_ end of SETQ (SETQ elev_ent (ENTGET n)) (SETQ elev_ent (SUBST (CONS 1 cedatb) (ASSOC 1 elev_ent) elev_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD elev_ent) (SETQ cedndx (1+ cedndx)) ) ;_ end of foreach (ENTUPD insert_ent) ) ;_ end of progn ) ((EQ updatt "Left") (PROGN (SETQ cedndx 0) (FOREACH n lbelev_lst (SETQ cedatb (RTOS ;;; (+ cedatum (* cedndx grdwid (/ vpscl vrt_fact))) (+ cedatum (* cedndx (/ grdwid 2.0) (/ vpscl (COND ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(5 10))(* vrt_fact 2.0)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(20 30 40 60 80 200 300 400 600 800))(* vrt_fact 0.5 grdwid)) ((MEMBER (ATOI(RTOS VPSCL 2 0)) '(50 100 500))vrt_fact) (T vrt_fact) ) ) ) ) 2 vrt_prec ) ;_ end of RTOS ) ;_ end of SETQ (SETQ elev_ent (ENTGET n)) (SETQ elev_ent (SUBST (CONS 1 cedatb) (ASSOC 1 elev_ent) elev_ent ) ;_ end of SUBST ) ;_ end of setq (ENTMOD elev_ent) (SETQ cedndx (1+ cedndx)) ) ;_ end of foreach (ENTUPD insert_ent) ) ;_ end of progn ) ) ) ;_ end of IF (IF (AND (OR (EQ updatt "Left") (EQ updatt "Right") ) (SETQ found_splitlbl (SSGET "x" '((0 . "INSERT")(2 . "##ppbrklbl")))) ) (PROGN (IF (> (SSLENGTH found_splitlbl) 1) (PROGN (COMMAND ".pspace") (PRINC "\nSelect split label to update") (SETQ found_splitlbl (SSGET '((0 . "INSERT")(2 . "##ppbrklbl")))) (COMMAND ".mspace") ) ) (SETQ insdef (entget(ssname found_splitlbl 0)) nextdef insdef attr_ls1 NIL ) (WHILE (AND nextdef (/=(CDR (ASSOC 0 nextdef)) "ENDBLK")) (IF (EQ (CDR (ASSOC 0 nextdef)) "ATTRIB") (SETQ attr_ls1 (APPEND attr_ls1 (LIST (LIST (CDR (ASSOC 2 nextdef)) nextdef)))) ) (SETQ nextename (ENTNEXT (CDR (ASSOC -1 nextdef)))) (IF nextename (SETQ nextdef (ENTGET nextename)) (SETQ nextdef NIL) ) ) (SETQ ppgrident (SSGET "X" '((-4 . "")))) (IF (AND ppgrident (EQ (SSLENGTH ppgrident) 1)) (PROGN (SETQ nextdef2 (ENTGET (SSNAME ppgrident 0)) attr_ls2 NIL ) (WHILE (AND nextdef2 (/=(CDR (ASSOC 0 nextdef2)) "ENDBLK")) (IF (EQ (CDR (ASSOC 0 nextdef2)) "ATTRIB") (SETQ attr_ls2 (APPEND attr_ls2 (LIST (LIST (CDR (ASSOC 2 nextdef2)) nextdef2)))) ) (SETQ nextename2 (ENTNEXT (CDR (ASSOC -1 nextdef2)))) (IF nextename2 (SETQ nextdef2 (ENTGET nextename2)) (SETQ nextdef2 NIL) ) ) ) ) (IF (and attr_ls1 attr_ls2) (progn (foreach n attr_ls2 (if (SETQ this_lbl (assoc (STRCAT "M"(car n)) attr_ls1)) (PROGN (SETQ new_lbl (SUBST (CONS 1 (CDR(ASSOC 1(CADR n))))(ASSOC 1(CADR this_lbl))(CADR this_lbl)) ) (ENTMOD new_lbl) ) ) ) (ENTUPD (CDR (ASSOC -1 insdef))) ) ) ) ) ) ;_ end of PROGN ) ;_ end of IF (COMMAND ".mview" "lock" "on" "all" "") (IF (EQ updatt "Middle") (PROGN (COMMAND ".pspace") (PRINC (STRCAT "\nUse NINT to update elevation labels for middle viewports. Base elevation is " (RTOS cedatum 2 0))) (PRINC) ) ) (IF old_ustaelDIMZIN (SETVAR "DIMZIN" old_ustaelDIMZIN)) (SETQ *error* orig_error) (PRINC) ) ;_ end of defun (DEFUN panprv () (PROGN (SETQ nvctrx (+ viewsta (/ cvwdth 2)) nvctry (+ (* cedatum vrt_fact) (/ cvsize 2)) pxdist (- (CAR cvcntr) nvctrx) pydist (- (CADR cvcntr) nvctry) ) ;_ end of setq (PRINC (STRCAT "dX=" (RTOS pxdist) ", dY=" (RTOS pydist))) (COMMAND "._zoom" "c" (STRCAT (RTOS nvctrx) "," (RTOS nvctry)) "" ) ;_ end of command ) ;_ end of progn ) ;_ end of defun ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 2 0 1 nil nil nil T) ***Don't add text below the comment!***|;