这是我用来“强制”块定义的:
- ;;---------------=={ Force Block Definition }==---------------;;
- ;; ;;
- ;; Ensures, if possible, that a block definition is present ;;
- ;; in a drawing. ;;
- ;;------------------------------------------------------------;;
- ;; Author: Lee McDonnell, June 2010 ;;
- ;; ;;
- ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;;
- ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;;
- ;;------------------------------------------------------------;;
- ;; Arguments: ;;
- ;; block - block name or filename ;;
- ;;------------------------------------------------------------;;
- ;; Returns: Block name, else nil ;;
- ;;------------------------------------------------------------;;
- (defun LM:ForceBlockDefinition ( block / path ext base )
- ;; © Lee Mac 2010
- (setq path (vl-filename-directory block)
- ext (vl-filename-extension block)
- base (vl-filename-base block))
- (or ext (setq ext ".dwg"))
- (or (eq "" path) (setq path (strcat path "\")))
-
- (cond
- ( (tblsearch "BLOCK" base) base )
- ( (setq block (findfile (strcat path base ext)))
- (command "_.-insert" block) (command) base
- )
- )
- )
可以提供块名、带扩展名的块名或完整的块文件名。 |