这不考虑任何层次的东西。它只使用当前层并假设WCS插入。此外,它只查找线条。没有普林斯-大卫
- (defun c:lend2ins (/ bn ss i en ed p10 p11)
- ;;;FORCE BLOCK TABLE
- (defun SetBlkTF (n)
- (cond ((not (snvalid n))
- (princ "\nInvalid Block Name - " n)
- (setq n nil))
- ((tblsearch "BLOCK" n))
- ((findfile (strcat n ".DWG"))
- (command "_.INSERT" n)
- (command))
- (T
- (entmake (list (cons 0 "BLOCK")(cons 2 n)(cons 10 (list 0 0 0))(cons 70 0)))
- (entmake (list (cons 0 "TEXT")
- (cons 1 (strcat "BLOCK PLACECARD - " n))
- (cons 7 (cdr (assoc 2 (tblnext "STYLE" T))))
- (cons 8 "0")
- (cons 10 (list 0 0 0))
- (cons 11 (list 0 0 0))
- (cons 40 (max 1 (getvar "TEXTSIZE")))
- (cons 72 4)))
- (entmake (list (cons 0 "ENDBLK")(cons 8 "0")))))
- n)
- (while (or (not bn)
- (not (SetBlkTF bn)))
- (setq bn (getstring "\nBLOCK To INSERT: ")))
- (while (not ss)
- (princ "\nSelect Lines To INSERT BLOCK To: ")
- (setq ss (ssget (list (cons 0 "LINE")
- (if (getvar "CTAB")
- (cons 410 (getvar "CTAB"))
- (cons 67 (- 1 (getvar "TILEMODE"))))))))
- (setq i (sslength ss))
- (while (not (minusp (setq i (1- i))))
- (setq en (ssname ss i)
- ed (entget en )
- p10 (cdr (assoc 10 ed))
- p11 (cdr (assoc 11 ed)))
- (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 p10)
- '(39 . 0)'(6 . "BYLAYER")'(62 . 256)))
- (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 p11)
- '(39 . 0)'(6 . "BYLAYER")'(62 . 256))))
- (prin1))
|