快速而肮脏:
- (defun MeGetEntsInVport ( / ExLoop LolPnt OffSet SelSet UprPnt VptCen VptEnl VptEnt)
- (while (not ExLoop)
- (initget " ")
- (setq VptEnt (entsel "\nSelect viewport: "))
- (cond
- ((= VptEnt "") (setq ExLoop T))
- (VptEnt
- (setq VptEnl (entget (car VptEnt)))
- (if (= (cdr (assoc 0 VptEnl)) "VIEWPORT")
- (progn
- (setq VptCen (reverse (cdr (reverse (cdr (assoc 10 VptEnl)))))
- OffSet (mapcar
- '(lambda (l) (/ (cdr (assoc l VptEnl)) 2.0)) '(40 41)
- )
- LolPnt (trans (mapcar '(lambda (c o) (- c o)) VptCen OffSet) 3 2)
- UprPnt (trans (mapcar '(lambda (c o) (+ c o)) VptCen OffSet) 3 2)
- ExLoop T
- )
- (setvar "TILEMODE" 1)
- (setq SelSet (ssget "_C" LolPnt UprPnt))
- (setvar "TILEMODE" 0)
- )
- (prompt " selected entity is not a viewport.")
- )
- )
- (T (prompt " 1 selected, 0 found."))
- )
- )
- SelSet
- )
...编辑:糟糕,语言错误 |