您需要更多的代码来检查布局名称,您可能需要下载lee mac parse number,这样您就可以读取布局编号Layout1=1,现在为“DWG1”
您可以进行初始化并设置一些预定义的答案,如简单示例1 dwg 2 Drawing 3 Layout 4 DXX,然后使用COND查看您选择了什么描述,这会阻止打字等
- ;;-------------------=={ Parse Numbers }==--------------------;;
- ;; ;;
- ;; Parses a list of numerical values from a supplied string. ;;
- ;;------------------------------------------------------------;;
- ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
- ; this is bits of a big routine
- ; it is not working code just an example of how to do it.
- (defun ah:sheetupdate1 ( / ss1 lay plotabs tabname dwgname)
- (setq doc (vla-get-activedocument (vlax-get-acad-object)))
- (vlax-for lay (vla-get-Layouts doc)
- (setq plotabs (cons (vla-get-name lay) plotabs)) ; a list of all the layout tabs
- )
- (setq plotabs (vl-sort plotabs '<))
- (setq len (length plotabs))
- ; now go through plotabs and rename the example here is hard coded for DXX
- (repeat len
- ; if less than 10
- (if (< (car dwgnum) 10.0)
- (setq newstr2 (strcat dwgname "-D0" (rtos sheetnum 2 0)))
- (setq newstr2 (strcat dwgname "-D" (rtos sheetnum 2 0)))
- )
- (command "layout" "r" (nth x plotab ) newstr2)
- (setq x (+ x 1))
- )
|