本帖最后由 bloodtempt 于 2014-11-10 15:22 编辑
- (defun c:tt ( / ent elist blkdef path)
- (vl-load-com)
- (command "-xref" "A" (getfiled "选择要编辑的文件" (getvar "DWGPREFIX") "dwg" 0) (getpoint "指定插入点") "1" "" "0")
- (setq ent (entget (ssname (ssget "L" '((0 . "insert"))) 0)))
- (setq obj (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (cdr (assoc 2 ent)))
- )
- (setq elist (entget (tblobjname "block" (cdr (assoc 2 ent))))) ;_获取参照图块的图元表
- (setq blkdef (vlax-ename->vla-object (cdr (assoc 330 elist))))
- (setq path (vla-get-path blkdef)) ;_取得外部参照的路径
- (setq path (vl-filename-base path)) ;_去掉文件的路径和扩展名,返回文件的名称
- (vla-put-path blkdef (strcat ".\" path ".dwg")) ;_参照图块路径改为“相对路径
- (command "_xref" "r" "*")
- (princ)
- )
如何把command命令变为vlx形式?
|