;Insert a single manhole (profile, for use w/ MHP) (defun C:MHIN (/ BLDR2 BLDR1 DIMSC INVI INVO LINNO MHNO PT1R PT1L PT2 PT1 RELE RIMT RIMXY STAT STAL TLDR2 TLDR1 TPB2 TPB1 TPT2 TPT1A TPT1 TXTS THISLA YV2 cursty curang txsty ntxsty crtsht mhbas invix inviy invip drptn drptf drpbn drpbf drpct drpcb tpt0 dmhn curclr) (setq linno nil) ;Reset Line ID to nil (setq dmhn 0) ;Reset MH No. Def (will result in 1st Def=1) (setq osnaps (getvar"osmode")) (setq psiz (* 0.666667 10)) ;Set Pipe Size (This can vary later) (setvar "cmdecho" 1) ; (setq thisla (getvar"clayer")) ;Save Current Layer (setq dimsc (getvar"dimscale")) ;Get Current Dimscale (while ;Continue Function until null input (setq pt1 (upoint 0 "" "\nSTATION and INVERT OUT" nil nil)) ;Get MH STA and INV OUT (progn ;Do This if "WHILE" is true (if mhno (setq dmhn (atoi mhno)) nil) ;Use input from "MH NUMBER?" query if exists (setq dmhn (+ dmhn 1)) ;Increment Def MH No. (setq dmhs (rtos(fix dmhn)2 0)) ;Convert MH No. to String (setq cursty (getvar"textstyle")) ;Get Current Text Style (setq curang (getvar"angdir")) ;Get Current Angle dir (cw, ccw) (setvar "angdir" 0) ;Set Angle Direction for this function only (setq crtsht nil) ;Get Current Text Style Height (setq txsty (tblnext "style" T)) ;Get first Style in table (while (setq ntxsty (tblnext "style")) ;Look for Style Def matching current (if ; (not ; (eq cursty (cdr(assoc 2 txsty))) ;If its not this one.... );not ; (if ; (not ; (eq cursty (cdr(assoc 2 ntxsty))) ;If its not the next one.... );not ; nil ;Don't do anything, go around again (setq crtsht (cdr(assoc 40 ntxsty))) ;Otherwise Get the Style text height of this one );if ; );if ; );while ; (if crtsht nil (setq crtsht (cdr(assoc 40 txsty)))) ;If it is the first get Style text height (if linno nil (setq linno (ustr 1 "\nLINE ID" "X-X" T))) ;Get Line ID or Def (setq rimxy (upoint 15 "" "\nRIM ELEV" nil pt1)) ;Get Rim Elev (if ; (>(length rimxy)2) ;If Value is x,y,z coord set (progn ;Do this (setq yv2 (car (cdr rimxy))) ;Use only the Y value (setq rimt (/ yv2 10.0)) ;Make value for RIM ELEV text (setq pt2 (list (car pt1) yv2)) ;Construct x,y pair for MH rim pt );progn ; (progn ;Otherwise do this (setq yv2 (car rimxy)) ;Use Y value only (setq rimt (/ yv2 10.0)) ;Make value for RIM ELEV text (setq pt2 (list (car pt1) yv2)) ;Construct x,y pair for MH rim );progn ; );if ; (setq mhbas 5) ;Distance from INV OUT to Bottom of MH = .5ft (could vary this later) (setq pt1l (polar (polar pt1 (* pi 1.5) mhbas) pi 4)) ;Set Bottom Left MH pt (setq pt1r (polar (polar pt1 (* pi 1.5) mhbas) 0 4)) ;Set Bottom Right MH pt (setq txts (* dimsc 0.09)) ;Set text height (setvar "osmode" 0) (command ".pline" pt1l pt2 pt1r "c" ) ;Draw MH (setq mhno (ustr 0 "\nMANHOLE No" dmhs nil)) ;Set MH Number (setq inviy (+ (car (cdr pt1)) 1)) ;Set Default INV IN Y value (add 0.1 * 10) (setq invix (car pt1)) ;Set Default INV IN X value (setq invi (list invix inviy)) ;Construct Def INV IN XY pair (setq invip (upoint 1 "" "\nINVERT IN" invi nil)) ;Get new INV IN or use Def (command ".style" cursty "" "0" "" "" "" "" "") ;Change Style height to "0" for this function (if ; (> (-(car(cdr invip))(car(cdr pt1))) 25.0) ;If Drop is > 2.5ft (progn ; (setq tpt0 (polar (polar pt2 (/ pi 2) (* dimsc 0.6)) pi (* dimsc 0.345))) ;Top Drop MH text offset left (setq drptn (list (+(car pt1)8) (car(cdr invip)))) ;Set nearest Top outside drop MH pt (setq drptf (list (+(car pt1)12) (car(cdr invip)))) ;Set farthest Top outside drop MH pt (setq drpbn (list (+(car pt1)8) (+(car(cdr pt1))psiz 0.8 1))) ;Set nearest Bottom outside drop MH pt (setq drpbf (list (+(car pt1)12) (+(car(cdr pt1))1.2 1))) ;Set farthest Bottom outside drop MH pt (setq drpct (list (car pt1) (+(car(cdr pt1)) psiz 1))) ;Set Drop INV IN Top centerline pt (setq drpcb (list (car pt1) (+(car(cdr pt1))1))) ;Set Drop INV IN Bottom centerline pt (command ".line" drpct drpbn drptn "") ;Draw Drop MH (command ".line" drpcb drpbf drptf "") ;Draw Drop MH (command ".layer" "m" "text" "" "") ;Make TEXT layer (sets to layer if exists) (command ".text" tpt0 txts 90 "OUTSIDE DROP") ;OUTSIDE DROP MH text );progn ; );if ; (setq invi (rtos (/(car (cdr invip))10) 2 2)) ;Construct String for "INV IN" text (setq invo (rtos (/(car (cdr pt1))10) 2 2)) ;Construct String for "INV OUT" text (setq tpt1 (polar (polar pt2 (/ pi 2) (* dimsc 0.6)) pi (* dimsc 0.21))) ;Top 1st line text offset left (setq tpt1a (polar (polar pt2 (/ pi 2) (* dimsc 0.6)) pi (* dimsc 0.075))) ;Top 2nd line text offset left (setq tpt2 (polar (polar pt2 (/ pi 2) (* dimsc 0.6)) 0 (* dimsc 0.15))) ;Top 3rd line (under leader) offset right (setq tpb1 (polar (polar pt1 (* pi 1.5) (+(* dimsc 2.2)mhbas)) pi (* dimsc 0.06)));Bottom 1st line text offset left (setq tpb2 (polar (polar pt1 (* pi 1.5) (+(* dimsc 2.2)mhbas)) 0 (* dimsc 0.15))) ;Bottom 2nd line (under leader) offset right (setq tldr1 (polar pt2 (/ pi 2) (* dimsc 0.3))) ;Set top leader pt 1 (setq tldr2 (polar tldr1 (/ pi 2) (* dimsc 2.2))) ;Set top leader pt 2 (setq bldr1 (polar pt1 (* pi 1.5) (+(* dimsc 2.2)mhbas))) ;Set bottom leader pt 1 (setq bldr2 (polar pt1 (* pi 1.5) (+(* dimsc 0.3)mhbas))) ;Set bottom leader pt 2 (setq sta (rtos (car pt1) 2 2)) ;Set STATION no. string (setq stal (strlen sta)) ;Get length of STA string (if (eq stal 4) ; (setq stat (strcat "0+0" sta)) ; (if (eq stal 5) ; (setq stat (strcat "0+" sta)) ; (if (eq stal 6) ;Fix STA string with + and/or zeros as needed (setq stat (strcat (substr sta 1 1) "+" (substr sta 2))) ; (if (eq stal 7) ; (setq stat (strcat (substr sta 1 2) "+" (substr sta 3))) ; (if (eq stal 8) ; (setq stat (strcat (substr sta 1 3) "+" (substr sta 4))) ; (setq stat sta) ; );if ; );if ; );if ; );if ; );if ; (setq rele (rtos rimt 2 2)) ;Make value for RIM ELEV text (command ".layer" "m" "text" "" "") ;Make TEXT layer (sets to layer if exists) (command ".text" tpt1 txts 90 (strcat "MANHOLE NO. " mhno) ; ".text" tpt1a txts 90 (strcat "STATION " stat " " linno) ; ".text" tpt2 txts 90 (strcat "RIM ELEV. " rele "'") ;Place text strings ".text" tpb1 txts 90 (strcat "INVERT OUT " invo "'") ; ".text" tpb2 txts 90 (strcat "INVERT IN " invi "'")) ; (setq curclr (getvar"cecolor")) (command ".color" 4) (command ".line" tldr1 tldr2 "") ;place top leader (command ".solid" tldr1 (polar tldr1 (* pi 0.4375) txts)(polar tldr1 (* pi 0.5625) txts)"" "") ;place top arrowhead (command ".line" bldr1 bldr2 "") ;place bottom leader (command ".solid" bldr2 (polar bldr2 (* pi 1.4375) txts)(polar bldr2 (* pi 1.5625) txts)"" "") ;place bottom arrowhead (command ".color" curclr) (command ".layer" "s" thisla "") ;reset LAYER as before (command ".style" cursty "" crtsht "" "" "" "" "") ;reset STYLE as before (setvar "angdir" curang) ;reset ANGDIR as before (setq crtsht nil) ;Set to null variable for previous STYLE text height (setvar "osmode" osnaps) (command ".line" invip) (command) );progn ;Return to Beginning as long as "WHILE" is true );while ; );defun ;End Function