;;;Old MHP version modified to draw Storm Drains. ;;; (defun C:DIP (/ 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 invis piptl piptr slpta hllen ltpt1 pstxt ; hplen pslp llbl llbl2 lpsiz pt1s) (setq dmhn 0) ;Reset MH No. Def (will result in 1st Def=1) (setq osnaps (getvar"osmode")) (if psiz ; (setq lpsiz (/ psiz 0.8333333)) ;Set Pipe Size def to last used (setq lpsiz 12) ; );if ; (setq clupr (getvar "luprec")) ; (setvar "luprec" 0) ; (setq psiz (*(ureal 1 "" "\nPIPE SIZE (in inches)" lpsiz)0.8333333)) ;Get new pipe size or def (setq pstxt (rtos(* 1.2 psiz)2 0)) ;Make Pipe Size text string (setvar "cmdecho" 0) ;Don't echo commands (setq thisla (getvar"clayer")) ;Save Current Layer (setq dimsc (getvar"dimscale")) ;Get Current Dimscale (if btxts ; (setq leroy (/ btxts 0.0009)) ; (setq leroy 120) ; );if ; (setq btxts (*(ureal 1 "" "\nTEXT TEMPLATE SIZE " leroy)0.0009)) ; (setvar "luprec" clupr) ; (setq txts (* dimsc btxts)) ;Set text height (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 (command ".style" cursty "" "0" "" "" "" "" "") ;Change Style height to "0" for this function (if linno nil (setq linno "X-X")) ; (setq linno (ustr 1 "\nLINE ID" linno 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 (value is x,y coord set) (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 pt2l (polar pt2 pi 4)) ; (setq pt2r (polar pt2 0 4)) ; (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 mhno (ustr 0 "\nDROP INLET 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 (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) (* txts 6.66667)) pi (* txts 2.33333))) ;Top 1st line text offset left (setq tpt1a (polar (polar pt2 (/ pi 2) (* txts 6.66667)) pi (* txts 0.83333))) ;Top 2nd line text offset left (setq tpt2 (polar (polar pt2 (/ pi 2) (* txts 6.66667)) 0 (* txts 1.66667))) ;Top 3rd line (under leader) offset right (setq tpb1 (polar (polar pt1 (* pi 1.5) (+(* txts 24.44444)mhbas)) pi (* txts 0.6))) ;Bottom 1st line text offset left (setq tpb2 (polar (polar pt1 (* pi 1.5) (+(* txts 24.44444)mhbas)) 0 (* txts 1.66667))) ;Bottom 2nd line (under leader) offset right (setq tldr1 (polar pt2 (/ pi 2) (* txts 3.33333))) ;Set top leader pt 1 (setq tldr2 (polar tldr1 (/ pi 2) (* txts 24.44444))) ;Set top leader pt 2 (setq bldr1 (polar pt1 (* pi 1.5) (+(* txts 24.44444)mhbas))) ;Set bottom leader pt 1 (setq bldr2 (polar pt1 (* pi 1.5) (+(* txts 3.33333)mhbas))) ;Set bottom leader pt 2 (setvar "osmode" 0) (command ".layer" "m" "hatch" "" "") (command ".solid" pt1l pt1r pt2l pt2r "" "") (setvar "clayer" thisla) (command ".pline" pt1l pt2L pt2r pt1r "c" ) ;Draw MH (if invis ;If previous INV IN exists, (progn ;Do The following (setq pang (angle invis pt1)) ;get actual angle of pipe (setq pango (angle pt1 invis)) ; (setq pipbl (polar invis pang (/ 4 (cos pang)))) ; (setq pipbr (polar pt1 pango (/ 4 (cos pang)))) ; (setq piptl (polar (polar invis (/ pi 2) psiz) pang (/ 4 (cos pang)))) ; (setq piptr (polar (polar pt1 (/ pi 2) psiz) pango (/ 4 (cos pang)))) ; (setq slpta (* pang 57.29577951)) ;convert angle to degrees for text input (setq hplen (rtos(- (car pt1)(car invis))2 2)) ;get horizontal length of pipe (setq pslp (rtos(*(/(-(car(cdr pt1))(car(cdr invis)))(-(car pt1)(car invis)))10)2 2)) ;construct % slope text for pipe (setq hllen (/(/ (-(car pt1)(car invis))(cos pang))2)) ;get midpoint of pipe flowline (used next) (setq ltpt1 (polar(polar invis pang hllen)(* pi 1.5)(/ (* 1.5 txts)(cos pang)))) ;construct actual text placement point MC justified (command ".layer" "m" "hatch" "" "") ; (command ".solid" piptl piptr pipbl pipbr "" "") ; (setvar "clayer" thisla) (command ".line" piptl piptr "") ;Draw Pipe top (setq invis nil) ;reset previous INV IN to nil );progn ; nil ;Otherwise do nothing );if ; (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 "DROP INLET 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 "'")) ; (if ltpt1 ; (progn ; (setq llbl (strcat hplen " LF " pstxt "\" STORM SEW. @ " pslp "%")) ;Make 1st (and only) line of text for pipe label (if ; (> (*(strlen llbl)1 txts) (atof hplen)) ;if string length < pipe length, then: (progn ; (if ;do next if (> (*(strlen llbl)0.65 txts)(atof hplen)) ;if .65x string length < pipe length, then: (progn ; (setq llbl (strcat hplen " LF ")) ;Make 1st line of text for pipe label (setq llbl2 (strcat pstxt "\" STORM SEW.")) ;Make 2nd line of text for pipe label (setq llbl3 (strcat "@ " PSLP "%")) ;Make 3rd line of text for pipe label );progn ; (progn ;Otherwise (setq llbl (strcat hplen " LF " pstxt "\"")) ;Make 1st line of text for pipe label (setq llbl2 (strcat "STORM SEW. @ " PSLP "%")) ;Make 2nd line of text for pipe label );progn ; );if ; );progn ; );if ; (command ".text" "J" "MC" ltpt1 txts slpta llbl) ;place 1st (or only) text line (if (and llbl2 llbl3) ;if 2nd and 3rd text line exists, then: (progn ; (command ".text" "" llbl2) ;place 2nd text line (command ".text" "" llbl3) ;place 3rd text line );progn ; (if llbl2 ;otherwise if 2nd text line exists, then: (command ".text" "" llbl2) ;place 2nd text line nil ; );if ; );if ; (setq ltpt1 nil) ;set to nil 1st text line placement point (setq llbl nil) ;set to nil 1st text line (setq llbl2 nil) ;set to nil 2nd text line (setq llbl3 nil) ;set to nil 3rd text line );progn ; );if ; (setq curclr (getvar"cecolor")) ;get current color setting (command ".color" 4) ;set color to 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 (setq invis (list (car pt1) (car (cdr invip)))) ; (setq pt1s pt1) ;Save last pt1 value (setq pt2s pt2) ; (setvar "osmode" osnaps) (command ".line" invis) ; (command) ; );progn ;Return to Beginning as long as "WHILE" is true );while ; (command ".style" cursty "" crtsht "" "" "" "" "") ;reset STYLE as before (setq crtsht nil) ;Set to null variable for previous STYLE text height (command ".color" curclr) ; (command ".layer" "s" thisla "") ;reset LAYER as before (setvar "angdir" curang) ;reset ANGDIR as before (princ) );defun ;End Function