- »ç°¢ÇüÀÌ È¸ÀüµÇ¾îÀִ°ÍÀº ¾ÈµË´Ï´Ù.
- Á߽ɼ±ÀÌ µ¹Ãâ¾ç Á¶Á¤ÇϽǷÁ¸é.....   (setq plus (/ di 10))  
 ¿©±â¼­ plus °¡ µ¹Ãâ¾çÀÔ´Ï´Ù. di´Â ¿øÀ̶óÄ¡¸é ¹ÝÁö¸§À̵Ǵ°ª
 

(defun c:boxc(/ os ss k en ed VtxList plist cenx ceny dix diy plus po1 po2 po3 po4 plusx plusy)
;->*error* start
 (defun *error* (msg)(princ "error: ")(princ msg)
 (setvar "osmode" os)
 (princ))
;-<*error* end
  (setvar "cmdecho" 0)
  (setq os (getvar "osmode"))
  (setq ss (ssget (list (cons 0 "LWPOLYLINE"))))
  (setq k 0)
  (command "undo" "be")
  (setvar "osmode" 0)
  (repeat (sslength ss)
    (setq en (ssname ss k))
    (setq ed (entget en))
    (setq VtxList (GetPolyVtx ed)
          plist (getxy VtxList)
          cenx (/ (+ xmin xmax) 2)
          ceny (/ (+ ymin ymax) 2)
          dix (/ (- xmax xmin) 2)
          diy (/ (- ymax ymin) 2)
          cen (list cenx ceny))
    (setq plusx (/ dix 10)
          plusy (/ diy 10))
    (setq po1 (polar cen pi (+ dix plusx))
          po2 (polar cen 0 (+ dix plusx))
          po3 (polar cen (+ (/ pi 2) pi) (+ diy plusy))
          po4 (polar cen (/ pi 2) (+ diy plusy)))   
    (command "line" po1 po2 "")
    (command "line" po3 po4 "")
    (setq k (1+ k))
   );repeat
(setvar "osmode" os)
(command "undo" "e")
(princ)
);dedfun    

 
(defun getxy(vtxlist) ; ÇǶóÀÎÀÇ°¢ Æ÷ÀÎÆ®¸¦ ÁÂÇ¥ÃßÃâ
   (setq p1 (car vtxlist)
         p2 (cadr vtxlist)
         p3 (caddr vtxlist)
            p4 (cadddr vtxlist))
   (setq 1x (car p1) 1y (cadr p1)
         2x (car p2) 2y (cadr p2)
         3x (car p3) 3y (cadr p3)
         4x (car p4) 4y (cadr p4))
   (setq xmax (max 1x 2x 3x 4x)
         xmin (min 1x 2x 3x 4x))
   (setq ymax (max 1y 2y 3y 4y)
         ymin (min 1y 2y 3y 4y))
   (setq pa (list xmin ymin) ; ¿ÞÂÊ ÇÏ´ÜÁ¡
         pb (list xmax ymin) ; ¿À¸¥ÂÊ ÇÏ´ÜÁ¡
         pc (list xmin ymax) ; ¿ÞÂÊ »ó´Ü
         pd (list xmax ymax)) ; ¿ÞÂÊ »ó´Ü
)

 

(defun GetPolyVtx(EntList)
  (setq VtxList '())
  (foreach x EntList
   (if (= (car x) 10)
    (setq VtxList (append VtxList (list (cdr x))))
   )
  )
VtxList
)