看看LISP,你是否提供了必要的参数?
- (defun c:x2o () (xreftooverlay nil))
- (defun xreftooverlay ([b]namelst[/b] / uncommonblock uncommonblockclip a curlaystate cpath delme fdelme) ; xref to overlay
- (if (= (type namelst) 'STR) (setq namelst (list namelst)))
- (if (not namelst) (setq namelst ([b]getxreflst[/b])))
- (setq count 0)
- (while (or (findfile (strcat "ub" (itoa count) ".dwg")) (tblsearch "BLOCK" "ub" (itoa count))) (setq count (1+ count)))
- (setq uncommonblock (strcat "ub" (itoa count) ".dwg"))
- (command "point" "0,0" "wblock" (setq fdelme (strcat (getvar "dwgprefix") uncommonblock)) "" "0,0" (entlast) "")
- (setq uncommonblockclip (substr uncommonblock 1 (- (strlen uncommonblock) 4)))
- (command "undo" "begin")
- (command "._-layer" "a" "save" "BEI" "" "" "")
- (COMMAND ".-LAYER" "UNLOCK" "*" "")
- (foreach a namelst
- (setq cpath (xrefpath a))
- (command "xref" "overlay" (findfile uncommonblock) "0,0" "" "" "")
- (setq delme (ssget "x" (list (cons 2 uncommonblockclip))))
- (command "xref" "path" uncommonblockclip cpath)
- (redefxrefs a uncommonblockclip)
- (command "xref" "detach" a)
- (command "rename" "block" uncommonblockclip a)
- (if delme (command "erase" delme ""))
- ) ; foreach
- (command "._-layer" "a" "restore" "BEI" "" "" "")
- (command "._-layer" "a" "delete" "BEI" "" "" "")
- (command "._-xref" "d" "ub*")
- (command "undo" "e")
- (vl-file-delete (strcat fdelme))
- (princ)
- ) ; xreftooverlay
您需要确保子例程“getxreflst”也在运行。 |