2樓的程序不用那麼長
;;BY 龍龍仔(LUCAS)
(defun C:TT (/ CMD OS PT1 EN EN1 ARE ENT1)
(defun AX:GETBOUNDINGBOX (ENT / LL UR)
(vla-getboundingbox (vlax-ename->vla-object ENT) 'LL 'UR)
(mapcar 'vlax-safearray->list (list LL UR))
)
(setq CMD (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.undo" "be")
(setq OS (getvar "osmode"))
(setvar "osmode" 0)
(while (setq PT1 (getpoint "\n指定內部點: "))
(setq EN (entlast))
(vl-cmdf "_.boundary" PT1 "")
(setq EN1 (entlast))
(if (not (equal EN EN1))
(progn
(setq ARE (vla-get-area (vlax-ename->vla-object EN1)))
(setq ENT1 (car (AX:GETBOUNDINGBOX EN1)))
(cond
((equal ARE (* 1200.0 1200.0) 0.001)
(vl-cmdf "_.insert" "1100x1100" ENT1 "" "" "")
)
((equal ARE (* 1200.0 600.0) 0.001)
(vl-cmdf "_.insert" "1100x500" ENT1 "" "" "")
)
((equal ARE (* 600.0 600.0) 0.001)
(vl-cmdf "_.insert" "500x500" ENT1 "" "" "")
)
)
(command "_.erase" EN1 "")
)
)
)
(setvar "osmode" OS)
(command "_.undo" "e")
(setvar "cmdecho" CMD)
(princ)
) |