home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p065 / 4.img / PAO.LSP < prev    next >
Encoding:
Text File  |  1992-02-18  |  37.9 KB  |  906 lines

  1. (vmon)
  2.  
  3. (defun drl (/ a n td two b yn fd temp temp1)
  4.          (setq a 0 temp xy temp1 nil)
  5.          (setq n (length temp)) 
  6.          (while (< a n)
  7.           (if (/= (setq b (nth a temp)) 'nil)
  8.             (setq temp1 (cons b temp1) temp (subst 'nil b temp))
  9.           )
  10.           (setq a (1+ a))
  11.          )
  12.           (setq temp1 (reverse temp1) n (length temp1) a 0 b nil temp nil) 
  13.           (while (< a n)
  14.             (setq td nil two (+ cengao (cadr jd)) b (nth a temp1) fd nil)
  15.             (if (= ymin b) (progn
  16.               (setq td (cons two td) td (cons (car jd) td))
  17.              (command "PLINE" td "W" width width jd "")
  18.             (setq se (entlast))
  19.              (ssadd se ss)))
  20.             (if (= ymax b) (progn
  21.                      (setq yn (abs (- ymax ymin))) 
  22.                      (setq td (cons two td) td (cons (+ yn (car jd)) td))
  23.             (setq fd (cons (cadr jd) fd) fd (cons (+ yn (car jd)) fd))
  24.             (command "PLINE" fd "W" width width td "")
  25.             (setq se (entlast))
  26.             (ssadd se ss)))
  27.          (if (and (/= ymin b) (/= ymax b)) (progn
  28.    (setq td (cons (- two bho) td) td (cons (+ (abs (- b ymin)) (car jd)) td))
  29.      (setq fd (cons (cadr jd) fd) fd (cons (+ (abs (- b ymin))  (car jd)) fd))
  30.            (command "PLINE" fd "W" width width td "")
  31.            (setq se (entlast))
  32.            (ssadd se ss )
  33.             ))
  34.            (setq a (1+ a))
  35.         )
  36. )
  37.  
  38. (defun kx (/ a n ak nk bk1 b jdy fy fx td1 td2 kbg)  
  39.         (setq a 0 n (length lxy)  fy (cadr jd))
  40.           (while (< a n)
  41.             (setq td1 nil td2 nil kbg 1 jdy (+ cengao (cadr jd)))
  42.            (if (eq fg "Col")
  43.               (setq b (cadr (nth a lxy)))
  44.               (setq b (car (nth a lxy)))
  45.            )
  46.            (if (or (eq px "L") (eq px "U")) (progn 
  47.              (if (> b ymin)
  48.                 (setq fx (+ (car jd) (- b ymin)))
  49.                 (setq fx (abs (- (car jd) (- ymin b))))
  50.              )
  51.              (if (and (> b ymin) (< b ymax)) (setq jdy (- jdy bho))
  52.              ))
  53.            )
  54.            (if (or (eq px "R") (eq px "D")) (progn 
  55.                (if (< b ymin)
  56.                  (setq fx (+ (car jd) (abs (- b ymin))))
  57.                  (setq fx (abs (- (car jd) (- b ymin))))
  58.                )
  59.                (if (and (< b ymin) (> b ymax)) (setq jdy (- jdy bho))
  60.                ))
  61.           )
  62.           (if (= (type mlxy) 'LIST) (progn
  63.              (setq ak 0 nk (length mlxy) bk (car (nth ak mlxy)))
  64.             (while (< ak nk)
  65.               (setq bk1 (car (nth ak mlxy)) bk2 (car (nth (1+ ak) mlxy)))
  66.               (if (or (equal bk1 fx width)
  67.                       (equal bk2 fx width)
  68.                        (and (>= bk1 fx) (<= bk2 fx))
  69.                        (and (<= bk1 fx) (>= bk2 fx)))
  70.                  (setq kbg 0 ak nk))
  71.               (setq ak (+ ak 2))
  72.             )
  73.           ))             
  74.     (if (= kbg 1) (progn
  75.           (command "LAYER" "M" "SWALL" "C" "7" "" "")
  76. (setq td1 (cons fy td1) td1 (cons fx td1) td2 (cons jdy td2) td2 (cons fx td2))
  77.           (command "LINE" td1 td2 "")
  78.           (setq se (entlast))
  79.           (ssadd se ss)
  80.     ))
  81.             (setq a (1+ a))
  82.   )
  83. )  
  84.  
  85. (defun ban (/ fd1 fd2 td1 td2 jg pt1 pt2 jxs jxl temp)
  86.          (setq temp nil)
  87.          (setq temp xy)
  88.          (command "LAYER" "M" "SBAN1" "C" "7" "" "")
  89.          (setq x1 (apply 'max temp))
  90.          (setq xl (apply 'min temp))
  91.         (setq temp (subst 0.0 x1 temp))
  92.          (setq x2 (apply 'max temp))
  93.          (setq ws (abs (- x1 x2)) temp xy)
  94.          (setq temp (subst 999999.0 xl temp))
  95.          (setq xl2 (apply 'min temp))
  96.          (setq wl(abs (- xl2 xl)))
  97.        (setq fd1 nil td1 nil fd2 nil td2 nil jg (abs (- ymax ymin)))
  98.        (setq jxs (+ (car jd) ws) jxl (+ (car jd) (abs (- jg wl))))
  99.        (setq pt1 (+ cengao (cadr jd)) pt2 (- pt1 width2))
  100.        (setq fd1 nil fd2 nil td1 nil td2 nil) 
  101.        (setq fd1 (cons pt2 fd1) fd1 (cons jxs fd1) td1 (cons pt2 td1) td1 (cons jxl td1))
  102.        (command "pline" fd1 td1 "")
  103.        (setq se (entlast))
  104.        (ssadd se ss)
  105.        (command "LAYER" "M" "SBAN2" "C" "7" "" "")
  106.        (setq fd2 (cons (- pt2 bho) fd2) fd2 (cons jxs fd2) td2 (cons (- pt2 bho) td2) td2 (cons jxl td2))
  107.        (command "pline" fd2 td2 "")
  108.        (setq se (entlast))
  109.        (ssadd se ss)
  110.        (setq fd1 nil fd2 nil td1 nil td2 nil)
  111.        (setq fd1 (cons pt1 fd1) fd1 (cons jxs fd1) td1 (cons pt1 td1) td1 (cons (- jxs qw) td1)) 
  112.        (setq fd2 (cons (- pt1 qh) fd2) fd2 (cons jxs fd2) td2 (cons (- pt1 qh) td2) td2 (cons (- jxs qw) td2))
  113.        (command "solid" fd1 td1 fd2 td2 "")
  114.        (setq se (entlast))
  115.        (ssadd se ss)
  116.        (setq fd1 nil fd2 nil td1 nil td2 nil)
  117.        (setq fd1 (cons pt1 fd1) fd1 (cons jxl fd1) td1 (cons pt1 td1) td1 (cons (+ jxl qw) td1))
  118.        (setq fd2 (cons (- pt1 qh) fd2) fd2 (cons jxl fd2) td2 (cons (- pt1 qh) td2) td2 (cons (+ jxl qw) td2))
  119.        (command "solid" fd1 td1 fd2 td2 "")
  120.        (setq se (entlast))
  121.        (ssadd se ss)  
  122. )
  123.  
  124. (defun st (/ n a pt1 pt2 t1 t2 fd1 fd2 td1 td2 pmin pmax x1 x2 xy1 xy2 xy22 t1 t11 y)
  125.      (command "layer" "M" "SOTHER" "C" "7" "" "")
  126.      (setq n (length pj) a 0)
  127.      (while (< a (1- n))
  128.       (setq pt1 nil pt2 nil fd1 nil fd2 nil td1 nil td2 nil)   
  129.       (setq pt1 (nth a pj) pt2 (nth (1+ a) pj) pmax ( max pt1 pt2) pmin (min pt1 pt2))
  130.       (setq y (- (cadr jd) (* 1.5 (getvar "userr1"))))
  131.       (if (or (eq px "L") (eq px "U"))
  132.        (if (< pmax ymax)
  133. (setq x1 (abs (- ymin pmin)) x2 (abs (- ymin pmax)) t1 (car jd) xy1 (abs (- (car jd) x1)) xy2 (abs (- (car jd) x2)) xy22 (- xy2 50.0) t11 (- t1 width2) t2 (+ t1 150.0))
  134. (setq x1 (abs (- ymax pmax)) x2 (abs (- ymax pmin)) t1 (+ (car jd) (abs (- ymax ymin))) xy1 (+ t1 x1) xy2 (+ t1 x2) xy22 (+ xy2 50.0) t11 (+ t1 width2) t2 (- t1 150.0))))
  135.       (if (or (eq px "R") (eq px "D"))
  136.        (if (< pmax ymax)
  137. (setq x1 (abs (- ymax pmin)) x2 (abs (- ymax pmax)) t1 (+ (car jd) (abs (- ymax ymin))) xy1 (+ t1 x1) xy2 (+ t1 x2) xy22 (+ xy2 50.0) t11 (+ t1 width2) t2 (- t1 150.0))
  138. (setq x1 (abs (- ymin pmax)) x2 (abs (- ymin pmin)) t1 (car jd) xy1 (abs (- (car jd) x1)) xy2 (abs (- (car jd) x2)) xy22 (- xy2 50.0) t11 (- t1 width2) t2 (+ t1 150.0))))
  139.       (setq fd1 (cons y fd1) fd1 (cons xy1 fd1))
  140.       (setq td1 (cons y td1) td1 (cons t2 td1))
  141.       (setq fd2 (cons (+ y 100.0) fd2) fd2 (cons xy2 fd2))
  142.       (setq td2 (cons (+ y 100.0) td2) td2 (cons t2 td2))
  143.       (command "solid" fd1 td1 fd2 td2 "")
  144.       (setq se (entlast))
  145.       (ssadd se ss)
  146.       (setq fd1 nil fd2 nil td1 nil td2 nil)
  147.       (setq fd1 (cons (+ y 100.0) fd1) fd1 (cons t1 fd1) td1 (cons (+ y 100.0) td1) td1 (cons t2 td1))
  148.       (setq fd2 (cons (+ y 180.0) fd2) fd2 (cons t1 fd2) td2 (cons (+ y 180.0) td2) td2 (cons t2 td2))
  149.       (command "solid" fd1 td1 fd2 td2 "")
  150.       (setq se (entlast))
  151.       (ssadd se ss)  
  152.       (setq fd1 nil fd2 nil td1 nil td2 nil)
  153.       (setq fd1 (cons (+ y 300.0) fd1) fd1 (cons xy1 fd1) fd2 (cons (+ y 300.0) fd2) fd2 (cons xy2 fd2))
  154.       (setq td1 (cons y td1) td1 (cons xy1 td1) td2 (cons y td2) td2 (cons xy2 td2))
  155.       (command "SOLID" fd1 td1 fd2 td2 "")
  156.       (setq se (entlast))
  157.       (ssadd se ss)  
  158.       (setq fd1 nil fd2 nil td1 nil td2 nil)
  159.       (setq fd1 (cons (+ y terraceh) fd1) fd1 (cons xy1 fd1))
  160.       (setq fd2 (cons (+ y terraceh) fd2) fd2 (cons xy22 fd2))
  161.       (setq td1 (cons (+ y 300.0) td1) td1 (cons xy1 td1))
  162.       (setq td2 (cons (+ y 300.0) td2) td2 (cons xy22 td2))
  163.       (command "line" fd1 td1 "")
  164.       (setq se (entlast))
  165.       (ssadd se ss)
  166.       (command "line" fd2 td2 "")
  167.       (setq se (entlast))
  168.       (ssadd se ss)
  169.       (setq td1 nil td2 nil)
  170.       (setq td1 (cons (+ y terraceh) td1) td1 (cons t11 td1))
  171.       (command "line" fd1 td1 "")
  172.       (setq se (entlast))
  173.       (ssadd se ss)
  174.       (setq a (+ a 2)))
  175. )
  176.  
  177. (defun jmw (/ x y fd1 td1 fd2 td2 d1 x jx1 jx2 jyd jyu y F1 F2 F12 F22)
  178.        (command "layer" "M" "swindow" "c" "7" "" "")
  179.        (setq x (car jd) y (cadr jd) fd1 nil td1 nil fd2 nil td2 nil ind nil)
  180.        (setq jx1 (+ (abs (- j1 ymin)) x) jx2 (+ (abs (- j2 ymin)) x) jyd (+ y wh) jyu (+ jyd h))
  181.        (if (eq fg "Col") (setq d1 (cadr in)) (setq d1 (car in)))
  182.        (setq inx (+ (abs (- d1 ymin)) x) iny (+ jyd (/ h 2)))
  183.        (setq ind (cons iny ind) ind (cons inx ind))
  184.        (setq fd1 (cons jyu fd1) fd1 (cons jx1 fd1) td1 (cons jyu td1) td1 (cons jx2 td1)) 
  185.        (setq fd2 ( cons (+ jyu (/ l 10)) fd2) fd2 (cons jx1 fd2) td2 (cons (+ jyu (/ l 10)) td2) td2 (cons jx2 td2)) 
  186.        (command "solid" fd1 td1 fd2 td2 "")
  187.        (setq se (entlast))
  188.        (ssadd se ss)
  189.        (setq fd1 nil fd2 nil td1 nil td2 nil f1 nil f2 nil f12 nil f22 nil)
  190.        (if (or (eq px "L") (eq px "U"))
  191.        (setq x1 (+ jx1 width2) x2 (- jx2 width2))
  192.        (setq x1 (- jx1 width2) x2 (+ jx2 width2)))
  193.        (if (> wh 0)
  194.        (setq y1 jyu y2 (+ jyd width2))
  195.        (setq y1 jyu y2 jyd))
  196. (setq fd1 (cons y1 fd1) fd1 (cons x1 fd1) td1 (cons y2 td1) td1 (cons x1 td1))
  197. (setq fd2 (cons y1 fd2) fd2 (cons x2 fd2) td2 (cons y2 td2) td2 (cons x2 td2))
  198.        (setq f1 (cons jyd f1) f1 (cons jx1 f1) f2 (cons jyd f2) f2 (cons jx2  f2))
  199.        (setq f12 (cons jyd f12) f12 (cons (+ jx1 width2) f12) f22 (cons jyd f22) f22 (cons (+ jx2 width2) f22))
  200.        (setq mlxy (cons f1 mlxy) mlxy (cons f2 mlxy))
  201.   (setq oldsn (entlast))
  202.   (command "break" "c" f1 f12 fd1 td1)
  203.    (while (/= (setq oldsn (entnext oldsn)) nil) (ssadd oldsn ss))
  204.    (setq oldsn (entlast))
  205.    (command "break" "c" f2 f22 fd2 td2)
  206.    (while (/= (setq oldsn (entnext oldsn)) nil) (ssadd oldsn ss))
  207.    (if (> wh 0) (progn
  208.     (setq fd1 nil td1 nil att "CC")
  209.     (setq fd1 (cons jyd fd1) fd1 (cons x1 fd1) td1 (cons jyd td1) td1 (cons x2 td1))
  210.      (command "PLINE" fd1 "W" width width td1 "")
  211.        (setq se (entlast))
  212.        (ssadd se ss))
  213.        (setq att "DOOR")
  214.    )
  215.        (setq ww (/ (+ w width) 10) ll (/ h 100))
  216.        (setq atf (strcat (itoa h) " " (itoa wh)))
  217.        (command "INSERT" att ind ll ww 90 atf)
  218.        (setq se (entlast))
  219.        (ssadd se ss)
  220.  
  221. (defun mmw (/ mx pt1 pt2 pt3 pt4 my)
  222.    (command "layer" "M" "spwindow" "c" "7" "" "")
  223.    (if (= fg "Col")
  224.       (setq pt1 (cadr in))
  225.       (setq pt1 (car in))
  226.    )
  227.    (if (or (eq px "L") (eq px "U"))
  228.      (if (> pt1 ymin)
  229.      (setq mx (+ (car jd) (- pt1 ymin)))
  230.      (setq mx (abs (- (car jd) (abs (- ymin pt1)))))
  231.     )
  232.    )
  233.   (if (or (eq px "R") (eq px "D"))
  234.     (if (< pt1 ymin)
  235.        (setq mx (+ (car jd) (abs (- pt1 ymin))))
  236.        (setq mx (abs (- (car jd) (abs (- pt1 ymin)))))
  237.     )
  238.   )
  239.    (setq pt1 nil pt2 nil pt3 nil pt4 nil my (+ (cadr jd) h wh))
  240.    (setq pt1 (cons my pt1) pt1 (cons (- mx (/ l 2)) pt1) pt2 (cons my pt2) pt2 (cons (+ mx (/ l 2)) pt2))
  241.    (setq mlxy (cons pt1 mlxy) mlxy (cons pt2 mlxy))
  242.    (setq pt3 (cons (- my h) pt3) pt3 (cons (- mx (/ l 2)) pt3) pt4 (cons (- my h) pt4) pt4 (cons (+ mx (/ l 2)) pt4))
  243.    (command "pline" pt3 "W" 1.0 1.0 pt4  pt2 pt1 "C")
  244.    (setq se (entlast))
  245.    (ssadd se ss)
  246. )
  247.  
  248. (defun pinput (/ WID)
  249.     (initget (+ 2 4))
  250.     (setq censu (getint "\n╩Σ╚δ▓π╩²<2>:"))
  251.         (if (= censu nil) (setq censu 2))
  252.     (initget (+ 2 4))
  253.     (setq cengao (getint "\n╩Σ╚δ▓π╕▀<3500>:"))
  254.         (if (= cengao nil) (setq cengao 3500))
  255.     (initget (+ 2 4))
  256.     (setq bho (getint "\n╩Σ╚δ┬Ñ░σ║±╢╚<120>:"))
  257.         (if (= bho nil) (setq bho 120))
  258.         (if (>= bho cengao) (paoerr "┬Ñ░σ║±╢╚┤≤╙┌▓π╕▀!"))
  259.         (initget (+ 2 4))
  260.         (setq qh (getint "\n╩Σ╚δ╚ª┴║╕▀╢╚<240>:"))
  261.         (if (= qh nil) (setq qh 240))
  262.         (if (>= qh cengao) (paoerr "╚ª┴║╕▀╢╚┤≤╙┌▓π╕▀!"))  
  263.         (initget (+ 2 4))
  264.         (setq qw (getint "\n╩Σ╚δ╚ª┴║┐φ╢╚<240>:"))
  265.         (if (= qw nil) (setq qw 240))  
  266.         (initget (+ 2 4))
  267.       (setq wid (getreal "\n╩Σ╚δ╞╩╧▀╗µ═╝┐φ╢╚(mm)<0.5>:"))
  268.         (if (= wid nil) (setq wid 0.5))
  269.       (setq bl (getvar "USERR1") width (* wid bl) width2 (/ width 2.0))
  270.    (graphscr)
  271.    (initget 1 "File")
  272.    (setq jd (getpoint "\n╞╩├µ═╝┤µ┼╠F/<▓σ╚δ╗∙╡π>:"))
  273.    (if (= jd "File") (progn
  274.    (setq flag "File")
  275.    (setq pas t)
  276.    (while pas
  277.    (setq file (getstring "\n╞╩├µ═╝╬─╝■├√:"))
  278.    (if (findfile (strcat file ".DWG")) (progn
  279.        (initget "Yes No")
  280.        (setq kword (getkword "\n╕├╬─╝■╥╤╛¡┤µ╘┌,╓╪╨┤┬≡(Y/N)"))
  281.        (if (= kword "Yes") (setq pas nil))
  282.    ) (setq pas nil))
  283.    )
  284.    (setq jd (getpoint "\n▓σ╚δ╗∙╡π:")) ))
  285.     (initget (+ 2 4) "Col Row")
  286.     (setq fg (getkword "\n╤í╘±╞╩╟╨╧▀╨╬╩╜:/║ß╞╩Col/╫▌╞╩Row <Col>:"))
  287.         (if (= fg nil) (setq fg "Col"))
  288.         (if (eq fg "Col")   (progn
  289.           (initget (+ 2 4) "L R") 
  290.           (setq px (getkword "\n╤í╘±: ╧≥╫≤┐┤L/╧≥╙╥┐┤R <L>:"))
  291.             (if (= px nil) (setq px "L"))
  292.                              )
  293.                              (progn
  294.           (initget (+ 2 4) "U D")
  295.           (setq px (getkword "\n╤í╘±: ╧≥╔╧┐┤U/╧≥╧┬┐┤D <U>:"))
  296.              (if (= px nil) (setq px "U"))
  297.                              )
  298.         ) 
  299.         (setvar "ORTHOMODE" 1)
  300.     (initget 1)
  301.     (setq p1 (getpoint "\n╩Σ╚δ╞╩╟╨╧▀╡┌╥╗╡π:"))
  302.     (initget 1)
  303.     (setq p2 (getpoint p1 "\n╩Σ╚δ╞╩╟╨╧▀╡┌╢■╡π:"))
  304.     (setq p3 (getpoint p2 "\n╩Σ╚δ╞╩╟╨╧▀╡┌╚²╡π:"))
  305.         (if (/= p3 nil) (progn
  306.           (initget 1)
  307.       (setq p4 (getpoint p3 "\n╩Σ╚δ╞╩╟╨╧▀╓╒╡π:"))
  308.         )) 
  309.         (while (= sj nil)
  310.     (princ "\n╤í╘±╞╩╟╨╩╡╠σ:")
  311.     (setq sj (ssget))
  312.         )
  313.     (setq sL (sslength sj))
  314.         (princ "\n╒²╘┌╝∞╦≈...╟δ╔╘║≥!")
  315. )
  316.  
  317. (defun lij ( / b b2)
  318.      (if (and (= (TYPE jxy) 'LIST) (= jbg 0)) (progn
  319.       (setq b 0 jbg 1)
  320.       (if (eq fg "Col") (setq b2 (cadr b1)) (setq b2 (car b1))) 
  321.       (while (< b njxy)
  322.         (if (<= (abs (- (nth b jxy) b2)) width)
  323.          (setq b njxy a2 n bg 0)
  324.          (setq b (+ b 1))
  325.         )
  326.       )
  327.                                )
  328.      )
  329. )
  330.  
  331. (defun lilr (/ b bg a1 a2 jbg v v1 v2 v3 e e1)
  332.    (setq b 0 bg 0 a1 0 a2 2 jbg 0 e nil e1 nil)
  333.    (setq e1 (mapcar 'car lxy2))
  334.    (if (eq px "L") (setq e (apply 'min e1)) (setq e (apply 'max e1)))
  335.    (while (< a1 n)
  336.     (setq b1 (nth a1 lxy2))
  337.     (while (< a2 (- n 1))
  338.      (setq c1 (nth a2 lxy2) c2 (nth (+ a2 1) lxy2))
  339.     (if (eq px "L") (setq v (car c1) v1 (car c2) v2 (car b1) v3 v2)
  340.                     (setq v (car b1) v1 v v2 (car c1) v3 (car c2))
  341.     )
  342.  
  343. (if (and (or (/= (car c1) (car b1)) (/= (cadr c1) (cadr b1))) 
  344.          (or (/= (car c2) (car b1)) (/= (cadr c2) (cadr b1))))
  345.    (if (or (> v v2) (> v1 v3))
  346.      (if (or (and (> (cadr c1) (cadr b1)) (> (cadr c2) (cadr b1)))
  347.              (and (< (cadr c1) (cadr b1)) (< (cadr c2) (cadr b1))))
  348.      (progn
  349.      (setq bg 1)
  350.      (lij)
  351.     )
  352.       (setq bg 0 a2 n)
  353.    )
  354.      (progn (setq bg 1) (lij))
  355.   )
  356. )
  357.      (setq a2 (+ a2 2)))
  358.      (if (and (= bg 1) (> (abs (- (car b1) e)) 370.0))
  359.        (setq lxy (cons b1 lxy)))
  360.      (setq a2 0 bg 0 jbg 0)
  361.      (setq a1 (+ a1 1)))
  362. )
  363.  
  364. (defun lidu (/ b bg a1 a2 jbg v v1 v2 v3 e e1)
  365.    (setq b 0 bg 0 a1 0 a2 2 jbg 0 e nil e1 nil)
  366.    (setq e1 (mapcar 'cadr lxy2))
  367.    (if (eq px "U") (setq e (apply 'max e1)) (setq e (apply 'min e1)))
  368.    (while (< a1 n)
  369.     (setq b1 (nth a1 lxy2))
  370.     (while (< a2 (- n 1))
  371.      (setq c1 (nth a2 lxy2) c2 (nth (+ a2 1) lxy2))
  372.      (if (eq px "D") (setq v (cadr c1) v1 (cadr c2) v2 (cadr b1) v3 v2)
  373.                      (setq v (cadr b1) v1 v v2 (cadr c1) v3 (cadr c2))
  374.      )
  375. (if (and (or (/= (car c1) (car b1)) (/= (cadr c1) (cadr b1))) 
  376.          (or (/= (car c2) (car b1)) (/= (cadr c2) (cadr b1))))
  377.    (if (or (> v v2) (> v1 v3))
  378.        (if (or (and (> (car c1) (car b1)) (> (car c2) (car b1)))
  379.                (and (< (car c1) (car b1)) (< (car c2) (car b1))))
  380.     (progn
  381.      (setq bg 1)
  382.      (lij)
  383.      )
  384.      (setq bg 0 a2 n)
  385.    )
  386.     (progn (setq bg 1) (lij))
  387.  )
  388. )
  389.      (setq a2 (+ a2 2)))
  390.    (if (and (= bg 1) (> (abs (- (cadr b1) e)) 370.0))
  391.        (setq lxy (cons b1 lxy)))
  392.      (setq a2 0 bg 0 jbg 0)
  393.      (setq a1 (+ a1 1)))
  394. )
  395. (defun range (tab / w c d mn mx)
  396.   (setq c (mapcar 'car tab) mn (apply 'min c) mn (1- mn))
  397.   (while (< mn (setq mx (apply 'max c)))
  398.    (setq c (subst mn mx c))
  399.    (while (setq d (assoc mx tab))
  400.      (setq tab (subst '(nil) d tab) w (cons d w))
  401.    )
  402.  )
  403. )
  404.  
  405.  
  406. (defun sli (/ a lay li t1 pl pg)
  407.     (setq a 0 lxy2 nil)
  408.         (if (= p3 nil) (setq pl p1 pg p1) (progn
  409.                (if (and (eq px "L") (<= (car p1) (car p3)))
  410.                  (setq pl p1 pg p3)
  411.                )
  412.                (if (and (eq px "R") (>= (car p1) (car p3)))
  413.                  (setq pl p3 pg p1)
  414.                )
  415.                (if (and (eq px "U") (<= (cadr p1) (cadr p3)))
  416.                  (setq pl p1 pg p3)
  417.                )
  418.                (if (and (eq px "D") (>= (cadr p1) (cadr p3)))
  419.                  (setq pl p3 pg p1)
  420.                )
  421.         )) 
  422.     (while (<= a (1- sL))
  423.              (SETQ PT1 NIL PT2 Nil jo nil t1 0)
  424.              (setq sn (ssname sj a))
  425.         (setq s1 (entget sn))
  426.         (setq li (cdr (assoc 0 s1)) lay (cdr (assoc 8 s1)))
  427.         (if (and (eq li "LINE") (eq (substr lay 1 5) "PWALL")) (progn
  428.                 (setq pt (cdr (assoc 10 s1)))
  429.                 (if (= (type pt) 'LIST)  (progn
  430.                      (setq pt1 (cons (cadr pt) pt1) pt1 (cons (car pt) pt1))
  431.                   (setq pt (cdr (assoc 11 s1)))
  432.                     (setq pt2 (cons (cadr pt) pt2) pt2 (cons (car pt) pt2))
  433.                        (if (and (eq px "L") (< (car pt1) (car pl)) 
  434.                                    (< (car pt2) (car pl)))
  435.                              (setq t1 1)
  436.                        )
  437.                        (if (and (eq px "R")
  438.                                 (> (car pt1) (car pg)) 
  439.                                 (> (car pt2) (car pg)))
  440.                            (setq t1 1)
  441.                        )
  442.                        (if (and (eq px "U") 
  443.                                 (> (cadr pt1) (cadr pg))
  444.                                 (> (cadr pt2) (cadr pg)))
  445.                            (setq t1 1)
  446.                        )
  447.                        (if (and (eq px "D") 
  448.                                 (< (cadr pt1) (cadr pl))
  449.                                 (< (cadr pt2) (cadr pl)))
  450.                            (setq t1 1)
  451.                        )
  452.          (if (/= t1 1) (progn
  453.                     (setq jo (inters p1 p2 pt1 pt2))
  454.                     (if (and (/= p3 nil) (/= (type jo) 'LIST))
  455.                        (setq jo (inters p3 p4 pt1 pt2))
  456.                     )
  457.                  ))    
  458.                  (if (and (/= (type jo) 'LIST) (= t1 1))
  459.                    (if (or (and (eq fg "Col") (/= (cadr pt1) (cadr pt2)))
  460.                            (and (eq fg "Row") (/= (car pt1) (car pt2))))
  461.                        (setq lxy2 (cons pt2 lxy2) lxy2 (cons pt1 lxy2))))
  462.                                                   )
  463.                         )
  464.                 (IF (= (TYPE JO) 'LIST) (PROGN
  465.                   (if (eq fg "Col")  
  466.                            (setq jxy (cons (cadr jo) jxy))
  467.                              (SETQ jxy (cons (CAR JO) jxy))
  468.                           )
  469.                                         )
  470.                         )
  471.                                    )
  472.                 )
  473.              (setq a (1+ a))) 
  474.        (if (/= (TYPE LXY2) 'LIST) (paoerr "╞╩╟╨╩╡╠σ╓╨├╗╙╨╟╜!")) 
  475.        (setq n (length lxy2) njxy (length jxy))
  476.  (if (eq fg "Col") (lilr) (lidu))
  477.   (if (= (type lxy) 'LIST)
  478.     (setq lxy (range lxy))
  479.   ) 
  480. )
  481.  
  482. (defun instr(st s0 s00 / l n loop x n0 l0)
  483.    (setq l (+ (- (strlen s0) st) 1) l0 0 n0 st n 1 loop t)
  484.    (while (and (<= n l) loop)
  485.       (setq x (substr s0 n0 1))
  486.       (if (eq x s00) (setq loop nil l0 n0) (setq n0 (1+ n0) n (1+ n)))
  487.    )
  488.    (eval l0)
  489. )
  490.  
  491. (defun asctof(rn1 / loop ll x)   
  492.        (setq loop t)
  493.        (while loop
  494.           (setq ll (instr 1 rn1 " "))
  495.           (if (= ll 0) (setq wl (cons rn1 wl) loop nil)
  496.              (progn ;else
  497.              (setq x (substr rn1 1 (1- ll)))
  498.              (setq wl (cons x wl))
  499.              (setq rn1 (substr rn1 (1+ ll) (- (strlen rn1) ll)))
  500.              (setq loop t)
  501.              )
  502.           )
  503.        )
  504. )
  505.  
  506. (defun smw ( / a s1 s2 s3 rn ne px1 py1 pt1 pt2 blkn x ll li lay ti lw wl)
  507.     (setq a 0)
  508.     (while (<= a (1- sL))
  509.              (SETQ PT1 NIL PT2 NIL ti 0)
  510.              (setq sn (ssname sj a))
  511.         (setq s1 (entget sn))
  512.         (setq li (cdr (assoc 0 s1)) lay (cdr (assoc 8 s1)))
  513.                 (if (and (eq li "INSERT") (eq lay "PWINDOW")) (progn
  514.                   (setq blkn (cdr (Assoc 2 s1)))
  515.                   (setq in (cdr (assoc 10 s1)))
  516.                  (if (or (= (substr blkn 1 3) "CCA") (= (substr blkn 1 3) "CCZ"))
  517.                    (progn
  518.                     (setq ne (entnext sn) s2 (entget ne))
  519.                     (setq rn (cdr (assoc 1 s2)) wl nil)
  520.                     (asctof rn)
  521. (setq l (atoi (nth 3 wl)) h (atoi (nth 2 wl)) wh (atoi (nth 1 wl)) w (atoi (nth 0 wl)))
  522.                     (setq ne (entnext ne) s3 (entget ne))
  523.                     (setq rn (cdr (assoc 1 s3)) wl nil)
  524.                     (asctof rn)
  525.                     (setq ag (atof (nth 0 wl)))
  526.                    )
  527.                    (progn
  528.                     (setq ag (cdr (assoc 50 s1)))
  529.                      (setq ne (entnext sn))
  530.                      (setq s2 (entget ne))
  531.                     (setq rn (cdr (assoc 1 s2)) wl nil)
  532.                     (asctof rn)
  533. (setq l (atoi (nth 3 wl)) h (atoi (nth 2 wl)) w (atoi (nth 0 wl)) wh (atoi (nth 1 wl)))
  534.                    )
  535.                   )
  536.        (if (eq fg "Col")
  537.         (if (or (equal ag (/ pi 2) 0.001) (equal ag (* pi 1.5) 0.001) (equal ag (* pi 2.5) 0.001)) (setq lw w) (setq lw l))
  538.         (if (or (equal ag 0.0 0.001) (equal ag pi 0.001) (equal ag (* 2 pi) 0.001)) (setq lw w) (setq lw l))
  539.        )       
  540.        (if (and (eq px "L") (= p3 nil) (>= (car p1) (- (car in) (/ lw 2))))
  541.            (setq ti 1)
  542.        )
  543.        (if (and (eq px "L") (/= p3 nil))
  544.          (if (< (cadr p1) (cadr p4))
  545.            (if (< (cadr in) (cadr p2))
  546.              (if (>= (car p2) (- (car in) (/ lw 2))) (setq ti 1))
  547.              (if (>= (car p3) (- (car in) (/ lw 2))) (setq ti 1))
  548.            )
  549.            (if (< (cadr in) (cadr p2))
  550.              (if (>= (car p3) (- (car in) (/ lw 2))) (setq ti 1))
  551.              (if (>= (car p2) (- (car in) (/ lw 2))) (setq ti 1))
  552.            )
  553.          )
  554.        )
  555.        (if (and (eq px "R") (= p3 nil) (<= (car p1) (+ (car in) (/ lw 2))))
  556.            (setq ti 1)
  557.        ) 
  558.        (if (and (eq px "R") (/= p3 nil))
  559.          (if (< (cadr p1) (cadr p4))
  560.            (if (< (cadr in) (cadr p2))
  561.              (if (<= (car p2) (+ (car in) (/ lw 2))) (setq ti 1))
  562.              (if (<= (car p3) (+ (car in) (/ lw 2))) (setq ti 1))
  563.            )
  564.            (if (< (cadr in) (cadr p2))
  565.              (if (<= (car p3) (+ (car in) (/ lw 2))) (setq ti 1))
  566.              (if (<= (car p2) (+ (car in) (/ lw 2))) (setq ti 1))
  567.            )
  568.          )
  569.        ) 
  570.        (if (and (eq px "U") (= p3 nil) (<= (cadr p1) (+ (cadr in) (/ lw 2))))
  571.            (setq ti 1)
  572.        )
  573.        (if (and (eq px "U") (/= p3 nil))
  574.          (if (< (car p1) (car p4))
  575.            (if (< (car in) (car p2)) 
  576.              (if (<= (cadr p2) (+ (cadr in) (/ lw 2))) (setq ti 1)) 
  577.              (if (<= (cadr p3) (+ (cadr in) (/ lw 2))) (setq ti 1))
  578.            )
  579.            (if (< (car in) (car p2)) 
  580.              (if (<= (cadr p3) (+ (cadr in) (/ lw 2))) (setq ti 1)) 
  581.              (if (<= (cadr p2) (+ (cadr in) (/ lw 2))) (setq ti 1))
  582.            )
  583.          )
  584.        )
  585.        (if (and (eq px "D") (= p3 nil) (>= (cadr p1) (- (cadr in) (/ lw 2))))
  586.            (setq ti 1)
  587.        )
  588.        (if (and (eq px "D") (/= p3 nil))
  589.          (if (< (car p1) (car p4))
  590.            (if (< (car in) (car p2))
  591.              (if (>= (cadr p2) (- (cadr in) (/ lw 2))) (setq ti 1))
  592.              (if (>= (cadr p3) (- (cadr in) (/ lw 2))) (setq ti 1))
  593.            )
  594.            (if (< (car in) (car p2))
  595.              (if (>= (cadr p3) (- (cadr in) (/ lw 2))) (setq ti 1))
  596.              (if (>= (cadr p2) (- (cadr in) (/ lw 2))) (setq ti 1))
  597.            )
  598.          ) 
  599.        )
  600.     (if (= ti 1) (progn
  601.       (setq wm (cons wh wm) wm (cons w wm) wm (cons h wm) wm (cons l wm) wm (cons in wm) wm (cons ag wm))
  602.       (if (and (eq fg "Col") (not (equal AG (/ PI 2) 0.001)) (not (equal AG (* PI 1.5) 0.001)) (not (equal ag (* 2.5 pi) 0.001)))
  603.                        (progn     
  604.                      (setq pt1 nil pt2 nil)
  605.                      (setq px1 (- (car in) (/ L 2)) py1 (- (cadr in) (/ W 2)))
  606.                         (setq pt1 (cons py1 pt1) pt1 (cons px1 pt1))
  607.                         (setq px1 (+ (car in) (/ L 2))) 
  608.                         (setq pt2 (cons py1 pt2) pt2 (cons px1 pt2))
  609.                         (setq ji (inters p1 p2 pt1 pt2))
  610.                        (if (and (/= p3 nil) (/= (type ji) 'LIST))
  611.                          (setq ji (inters p3 p4 pt1 pt2))
  612.                        )   
  613.                       (if (= (type ji) 'LIST) (progn
  614.                        (setq mxy (cons (cadr ji) mxy) wm (cons (cadr ji) wm))
  615.                       ))
  616.                      (setq px1 (- (car in) (/ L 2)) py1 (+ (cadr in) (/ W 2))) 
  617.                         (SETQ PT1 NIL PT2 NIL)
  618.                         (setq pt1 (cons py1 pt1) pt1 (cons px1 pt1))
  619.                         (setq px1 (+ (car in) (/ L 2)))
  620.                         (setq pt2 (cons py1 pt2) pt2 (cons px1 pt2))
  621.                         (setq ji (inters p1 p2 pt1 pt2))
  622.                        (if (and (/= p3 nil) (/= (type ji) 'LIST))
  623.                          (setq ji (inters p3 p4 pt1 pt2))
  624.                        )   
  625.                         (if (= (type ji) 'LIST) (progn
  626.   (setq mxy (cons (cadr ji) mxy) wm (cons (cadr ji) wm) wm (cons "J" wm))
  627.                         ))
  628.                                                   )
  629.       )
  630.       (IF (AND (EQ FG "Row") (not (equal AG 0.0 0.001)) (not (equal AG PI 0.001)) (not (equal ag (* 2 pi) 0.001)))
  631.                          (progn
  632.                         (SETQ PT1 NIL PT2 NIL)
  633.                      (setq py1 (- (cadr in) (/ L 2)) PX1 (- (CAR IN) (/ W 2)))
  634.                         (setq pt1 (cons py1 pt1) pt1 (cons px1 pt1))
  635.                         (SETQ py1 (+ (cadr in) (/ L 2)))
  636.                         (setq pt2 (cons py1 pt2) pt2 (cons px1 pt2))
  637.                         (setq ji (inters p1 p2 pt1 pt2))
  638.                        (if (and (/= p3 nil) (/= (type ji) 'LIST))
  639.                          (setq ji (inters p3 p4 pt1 pt2))
  640.                        )   
  641.                         (IF (= (TYPE JI) 'LIST) (progn
  642.                      (setq mxy (cons (car ji) mxy) wm (cons (car ji) wm))
  643.                         ))
  644.                      (setq py1 (- (cadr in) (/ L 2)) px1 (+ (car in) (/ W 2)))
  645.                         (SETQ PT1 NIL PT2 NIL)
  646.                         (setq pt1 (cons py1 pt1) pt1 (cons px1 pt1))
  647.                         (setq py1 (+ (CADR IN) (/ L 2)))
  648.                         (SETQ PT2 (CONS PY1 PT2) PT2 (CONS PX1 PT2))
  649.                         (setq ji (inters p1 p2 pt1 pt2))
  650.                        (if (and (/= p3 nil) (/= (type ji) 'LIST))
  651.                          (setq ji (inters p3 p4 pt1 pt2))
  652.                        )   
  653.                         (IF (= (TYPE JI) 'LIST) (progn  
  654.         (setq mxy (cons (car ji) mxy) wm (cons (car ji) wm) wm (cons "J" wm))
  655.                         ))
  656.                                     )
  657.        )
  658.                                            )
  659.                      )
  660.                                            )
  661.                    )
  662.              (setq a (1+ a)))
  663. )
  664.  
  665. (defun spl (/ li lay a)
  666.     (setq a 0 pxy0 nil)
  667.     (while (<= a (1- sL))
  668.              (SETQ PT1 NIL PT2 NIL)
  669.              (setq sn (ssname sj a))
  670.         (setq s1 (entget sn))
  671.         (setq li (cdr (assoc 0 s1)) lay (cdr (assoc 8 s1)))
  672.        (if (and (eq li "POLYLINE") (eq lay "TERRACE")) (progn
  673.         (setq ne (entnext sn) terraceh (cdr (assoc 39 s1)))
  674.         (setq s2 (entget ne)) 
  675.         (while (/= (cdr (assoc 0 s2)) "SEQEND")
  676.          (setq pd (cdr (assoc 10 s2)) pxy0 (cons pd pxy0))
  677.          (setq ne (entnext ne) s2 (entget ne))
  678.         )
  679.          (setq n (length pxy0) pa 0)
  680.          (while (< pa (1- n))
  681.           (setq pt1 (nth pa pxy0) pt2 (nth (1+ pa) pxy0))
  682.          (setq jo (inters (list (car p1) (cadr p1)) (list (car p2) (cadr p2))
  683.                     (list (car pt1) (cadr pt1)) (list (car pt2) (cadr pt2))))
  684.          (if (and (/= p3 nil) (/= (type jo) 'LIST))
  685.            (setq jo (inters (p3 p4 (list (car pt1) (cadr pt1)) (list (car pt2)
  686.                             (cadr pt2)))))
  687.          )
  688.           (if (= (type jo) 'LIST) (progn
  689.            (if (eq fg "Col") (setq pj (cons (cadr jo) pj)) (setq pj (cons (car jo) pj)))
  690.                                   )
  691.                                   (progn
  692.            (setq  pxy (cons pt2 pxy))))
  693.           (setq pa (+ pa 1)))
  694.          (setq pxy0 nil)))
  695.    (setq a (1+ a)))
  696. )
  697.  
  698. (defun aj (/ y1 y1n y2 y2n)
  699.     (if (or (eq px "U")  (eq px "L")) (progn 
  700.       (if (= (type jxy) 'LIST)  (setq y1 (apply 'min jxy) y1n (apply 'max jxy))
  701.          (setq y1 999999.0 y1n 0.0))
  702.      (if (= (type mxy) 'LIST) (setq y2 (apply 'min mxy) y2n (apply 'max mxy))
  703.          (setq y2 999999.0 y2n 0.0))
  704.      (if (<= y1 y2) (setq ymin y1) (setq ymin y2))
  705.      (if (<= y1n y2n) (setq ymax y2n) (setq ymax y1n))
  706.    )) 
  707.   (if (or (eq px "D") (eq px "R")) (progn
  708.       (if (= (type jxy) 'LIST) (setq y1 (apply 'max jxy) y1n (apply 'min jxy))
  709.              (setq y1 0.0 y1n 999999.0))
  710.       (if (= (type mxy) 'LIST) (setq y2 (apply 'max mxy) y2n (apply 'min mxy))
  711.              (setq y2 0.0 y2n 999999.0))
  712.       (if (<= y1 y2) (setq ymin y2) (setq ymin y1))
  713.       (if (<= y1n y2n) (setq ymax y1n) (setq ymax y2n))
  714.   ))
  715.     (if (= (type mxy) 'LIST) (setq xy (append mxy xy)))
  716.     (if (= (type jxy) 'LIST) (setq xy (append jxy xy)))
  717. )
  718.  
  719. (defun ph (/ fd td x1 x2 y1 y2 ag1 ag2)
  720.        (setq fd nil td nil)
  721.        (command "LAYER" "M" "PBH" "C" "7" "" "")
  722.        (if (eq fg "Col")
  723.          (if (/= p4 nil) (setq x1 (car p1) x2 (car p4))
  724.                          (setq x1 (car p1) x2 x1)
  725.        ))
  726.        (if (eq fg "Row")
  727.          (if (/= p4 nil) (setq y1 (cadr p1) y2 (cadr p4))
  728.                          (setq y1 (cadr p1) y2 y1)
  729.        ))  
  730.        (if (eq px "L")
  731.          (setq y1 (- ymin (* 10 bl)) y2 (+ ymax (* 10 bl)) ag1 180 ag2 0))
  732.        (if (eq px "R")  
  733.          (setq y1 (+ ymin (* 10 bl)) y2 (- ymax (* 10 bl)) ag1 0 ag2 180))
  734.        (if (eq px "U") 
  735.          (setq x1 (- ymin (* 10 bl)) x2 (+ ymax (* 10 bl)) ag1 90 ag2 270))
  736.        (if (eq px "D") 
  737.          (setq x2 (- ymax (* 10 bl)) x1 (+ ymin (* 10 bl)) ag1 270 ag2 90))
  738.          (setq fd (cons y1 fd) fd (cons x1 fd) td (cons y2 td) td (cons x2 td))
  739.          (command "INSERT" "PB2" fd 1 1 ag2)
  740.          (command "INSERT" "PB1" td 1 1 ag1)
  741.        (if (and (eq fg "Col") (/= p3 nil)) (progn
  742.          (if (< (cadr p1) (cadr p4)) (progn
  743.            (if (< (car p2) (car p3)) (progn
  744.             (command "INSERT" "PB3" p2 1 1 270)
  745.             (command "INSERT" "pb3" p3 1 1 90))
  746.                                     (progn
  747.             (command "INSERT" "PB3" p2 1 1 180)
  748.             (command "INSERT" "PB3" p3 1 1 0))
  749.           )) (progn
  750.           (if (< (car p2) (car p3)) (progn
  751.             (command "INSERT" "PB3" p2 1 1 0)
  752.             (command "INSERT" "pb3" p3 1 1 180))
  753.                                     (progn
  754.             (command "INSERT" "PB3" p2 1 1 90)
  755.             (command "INSERT" "PB3" p3 1 1 270))
  756.          )))
  757.       ))
  758.        (if (and (eq fg "Row") (/= p3 nil)) (progn 
  759.          (if (< (car p1) (car p4)) (progn
  760.            (if (< (cadr p2) (cadr p3)) (progn
  761.             (command "INSERT" "PB3" p2 1 1 90)
  762.             (command "INSERT" "pb3" p3 1 1 270))
  763.                                     (progn
  764.             (command "INSERT" "PB3" p2 1 1 180)
  765.             (command "INSERT" "PB3" p3 1 1 0))
  766.          )) (progn
  767.           (if (< (cadr p2) (cadr p3)) (progn
  768.             (command "INSERT" "PB3" p2 1 1 0)
  769.             (command "INSERT" "pb3" p3 1 1 180))
  770.                                     (progn
  771.             (command "INSERT" "PB3" p2 1 1 270)
  772.             (command "INSERT" "PB3" p3 1 1 90))
  773.         )))
  774.       ))
  775. )
  776.  
  777.  
  778. (defun mw1 ( / f s a b a2 a3 n n2 nlxy jbg bg ay1 ay2 ax1 ax2 axmax aymin aymax axmin)
  779.         (if (= (type wm) 'LIST) (progn
  780.         (setq nlxy (length lxy2))
  781.         (setq n (length wm) a 0 temp wm)
  782.         (while (< a n)
  783.           (setq b (nth a wm) a2 0 a3 0 jbg 0 bg 0)
  784.           (if (= b "J") (progn
  785.            (setq j1 (nth (+ a 1) wm) j2 (nth (+ a 2) wm) ag (nth (+ a 3) wm) in (nth (+ a 4) wm))
  786.            (setq l (nth (+ a 5) wm) h (nth (+ a 6) wm) w (nth (+ a 7) wm) wh (nth (+ a 8) wm) a (+ a 8))
  787.            (setq jbg 1)
  788.            (jmw)))
  789.         (if (and (eq fg "Col") (/= b "J") (not (equal b 0.0 0.001)) (not (equal b pi 0.001)) (not (equal  b (* pi 2) 0.001))) 
  790.                (progn 
  791.            (setq in (nth (+ a 1) wm) l (nth (+ a 2) wm) h (nth (+ a 3) wm) w (nth (+ a 4) wm) wh (nth (+ a 5) wm) a (+ a 5))
  792.            (setq iny (cadr in) inx (car in))
  793.           (while (< a2 nlxy)
  794.           (setq f (nth a2 lxy2) ay1 (cadr f) ax1 (car f) s (nth (1+ a2) lxy2) ay2 (cadr s) ax2 (car s))
  795.           (setq aymax (max ay1 ay2) aymin (min ay1 ay2) axmax (max ax1 ax2) axmin (min ax1 ax2))
  796.           (if (eq px "L")  (progn
  797.            (if (and (> axmin inx) (> aymax (+ iny (/ l 2))) (< aymin (- iny (/ l 2))))
  798.             (setq a2 nlxy bg 0)
  799.             (setq bg 1 a2 (+ a2 2)))
  800.                             )
  801.                             (progn
  802.              (if (and (< axmin inx) (> aymax (+ iny (/ l 2))) (< aymin (- iny (/ l 2))))
  803.               (setq a2 nlxy bg 0)
  804.               (setq bg 1 a2 (+ a2 2)))
  805.                           )
  806.       ))))
  807.        (if (and (eq fg "Row") (/= b "J") (not (equal b (* pi 0.5) 0.001)) (not (equal  b (* pi 1.5) 0.001)) (not (equal b (* 2.5 pi) 0.001)))
  808.                  (progn 
  809.           (setq in (nth (+ a 1) wm) l (nth (+ a 2) wm) h (nth (+ a 3) wm) w (nth (+ a 4) wm) wh (nth (+ a 5) wm) a (+ a 5))
  810.           (setq inx (car in) iny (cadr in))
  811.           (while (< a2 nlxy)
  812.           (setq f (nth a2 lxy2) ax1 (car f) ay1 (cadr f) s (nth (1+ a2) lxy2) ax2 (car s) ay2 (cadr s))
  813.           (setq axmax (max ax1 ax2) axmin (min ax1 ax2) aymax (max ay1 ay2) aymin (min ay1 ay2))
  814.           (if (eq px "U") (progn
  815.             (if (and (< aymax iny) (> axmax (+ inx (/ l 2))) (< axmin (- inx (/ l 2))))
  816.                (setq a2 nlxy bg 0)
  817.             (setq bg 1 a2 (+ a2 2)))
  818.                           )
  819.                           (progn
  820.           (if (and (> aymin iny) (> axmax (+ inx (/ l 2))) (< axmin (- inx (/ l 2))))
  821.              (setq a2 nlxy bg 0)
  822.            (setq bg 1 a2 (+ a2 2)))
  823.                           )
  824.       ))))
  825.           (if (and (= bg 1) (/= b "J")) (progn
  826.            (setq n2 (length temp))
  827.            (while (< A3 N2)
  828.             (setq b2 (nth a3 temp))
  829.             (if (= b2 "J") (setq a3 (+ a3 3)))
  830.             (if (and (eq fg "Col") (/= b2 "J") (not (equal b2 0.0 0.001)) (not (equal b2 pi 0.001)) (not (equal b2 (* 2 pi) 0.001)))
  831.                    (progn
  832.             (setq in2 (nth (1+ a3) temp) l2 (nth (+ a3 2) temp))
  833.              (setq iny2 (cadr in2) inx2 (car in2))
  834.              (setq ii (abs (- iny2 (cadr in))) ll (+ (/ l 2) (/ l2 2)))
  835.              (if (and (eq px "L") (> inx2 (car in)) (< ii ll)) 
  836.               (setq bg 0))
  837.              (if (and (eq px "R") (< inx2 (car in)) (< ii ll))
  838.               (setq bg 0))))
  839.             (if (and (eq fg "Row") (/= b2 "J") (not (equal b2 (/ pi 2) 0.001)) (not (equal b2 (* pi 1.5) 0.001)) (not (equal b2 (* pi 2.5) 0.001)))
  840.                    (progn
  841.             (setq in2 (nth (1+ a3) temp) l2 (nth (+ a3 2) temp))
  842.              (setq iny2 (cadr in2) inx2 (car in2))
  843.              (setq ii (abs (- inx2 (car in))) ll (+ (/ l 2) (/ l2 2)))
  844.              (if (and (eq px "U") (< iny2 (cadr in)) (< ii ll))
  845.               (setq bg 0))
  846.              (if (and (eq px "D") (> iny2 (cadr in)) (< ii ll))
  847.               (setq bg 0))))
  848.             (setq a3 (+ a3 6))
  849.           )))
  850.           (if (= bg 1) (progn
  851.            (if (equal (abs (cos b)) 0.0 0.001) (setq l l) (setq l (* l (abs (cos b)))))
  852.                   (mmw))
  853.           )  
  854.          (if (or (= jbg 1) (= bg 1) (= a2 nlxy)) (setq a (1+ a)))
  855.           (if (and (= jbg 0) (= bg 0) (/= a2 nlxy)) (setq a (+ a 6)))
  856.        ))) 
  857. )
  858.  
  859.  
  860. (defun paoerr(s)
  861.    (if (/= s "Function cancelled")
  862.        (princ (strcat "\nError:" s))
  863.    )
  864.    (command "layer" "s" "0" "")
  865.    (setvar "cmdecho" 1)
  866.    (setq *error* oer)
  867.    (princ)
  868. )
  869.  
  870. (defun C:PAO (/ oer a n n1 n2 sj sn ne pt1 pt2 px1 px2 py1 pd pa x1 xl ws x2 a2 a3
  871.  ax1 iny ay1 temp ag bg ii ll nlxy jbg pxy0 sl p1 p2 p3 p4 jd px fg qw qh bho cengao
  872.  censu width width2 ymin ymax jxy lxy wm mxy xy pxy pj lxy2 s1 li lay jo y1 y1n
  873.  y2 y2n b v v1 b1 njxy pxy0 s2 se ss rn yn xl2 wl t1 t2 x y fd1 td1 fd2
  874.  td2 jx1 j1 jx2 j2 jyd jyu wh h xmax xmin c f1 f2 cm l l2 w in j ji in in2 inx iny2
  875.  axmin axmax aymin aymax ax1 ay1 ax2 ay2 mn mx d file kword flag mlxy)
  876.  (setvar "cmdecho" 0);(setq oer *error* *error* paoerr)
  877.  (if (/= (+ fh78 fh65 fh72 fh85 fh70) 370) (tst))
  878.  (setq sj nil sl nil p1 nil p2 nil p3 nil p4 nil jd nil px nil fg nil qh nil qw nil bho nil cengao nil censu nil)
  879.  (setq width nil width2 nil ymax nil ymin nil jxy nil lxy nil mlxy nil wm nil mxy nil xy nil pxy nil pj nil)
  880.         (pinput)
  881.         (sli)
  882.         (smw)
  883.         (spl)
  884.         (aj)
  885.         (ph)
  886.     (command "layer" "M" "SWALL" "C" "7" "" "")
  887.         (setq ss (ssadd))
  888.         (setq se nil)
  889.          (drl)
  890.          (ban)
  891.          (load "lisp\\sst") (sst)
  892.          (mw1)
  893.          (if (= (type lxy) 'LIST) (kx))
  894.          (if (= (type pj) 'LIST) (st))
  895.      (setq jxy nil lxy nil lxy2 nil wm nil mxy nil xy nil pxy nil pj nil )
  896.      (setq entl (entlast))
  897.      (if (> censu 1) (command "array" ss "" "R" censu 1 cengao))
  898.      (command)
  899.      (if (eq flag "File") (progn
  900.      (while (/= (setq entl (entnext entl)) nil) (ssadd entl ss))
  901.      (if (eq kword "Yes") (command "wblock" file "Y" "" jd ss "") (command "wblock" file "" jd ss ""))))
  902.      (command "layer" "s" "0" "")
  903.      (setvar "cmdecho" 1) (setq *error* oer) (princ)
  904. )
  905.