dallen2408 发表于 2022-7-6 07:40:53

自动编号布局选项卡fro

谁能帮帮我吗;我期待着自动编号的布局选项卡从目录表。我附上了一个图纸,应该有助于澄清我的要求。谢谢
空白设计包。图纸

BIGAL 发表于 2022-7-6 08:03:01

我会走另一条路,从布局选项卡详细信息中创建目录,你可以去每个布局阅读标题栏等,并创建一个详细信息列表,放入表格或作为文本列。
 
这可能有助于你开始
 
; change the 410 to layout name
;;-------------------=={ Parse Numbers }==--------------------;;
;;                                                            ;;
;;Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;Arguments:                                                ;;
;;s - String to process                                     ;;
;;------------------------------------------------------------;;
;;Returns:List of numerical values found in string.       ;;
;;------------------------------------------------------------;;
(defun LM:ParseNumbers ( s )
(
   (lambda ( l )
   (read
       (strcat "("
         (vl-list->string
         (mapcar
             (function
               (lambda ( a b c )
               (if
                   (or
                     (< 47 b 58)
                     (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
                     (and (= 46 b) (< 47 a 58) (< 47 c 58))
                   )
                   b 32
               )
               )
             )
             (cons nil l) l (append (cdr l) (list nil))
         )
         )
         ")"
       )
   )
   )
   (vl-string->list s)
)
)
;(defun ah:sheetupdate1 (ss1 lay plotabs tabname dwgname)
(defun ah:sheetupdate1 ()
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
(setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq title "Please enter dwg number")
(ah:getval title)
(setq dwgname item)

(setq newstr4 (getstring "\nPlease enter version for all sheets <Cr> no change "))
(princ "0")
(setq len (length plotabs))
(setq x 0)
(setq bname "DA1DRTXT")
(repeat len
(setq tabname (nth x plotabs))
(if (/= tabname "Model")
   (progn
   (setvar "ctab" tabname)
   (setq ss1 (ssget "x"(list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname))))
   (setq dwgnum (Lm:parsenumbers tabname))
   (setq sheetnum (car dwgnum))
   (setq oldtag1 "SHT_NO") ;attribute tag name
   (setq newstr1 (rtos sheetnum 2 0))
   (setq oldtag2 "DRG_NO") ;attribute tag name
   (setq oldtag3 "PROJ_NO") ;attribute tag name
   (setq newstr3 dwgname)
   (setq oldtag4 "REV_NO") ;attribute tag name
; 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)))
)
   (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
       (if (= oldtag1 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr1)
       ) ; end if
       (if (= oldtag2 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr2)
       ) ; end if
       (if (= oldtag3 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr3)
       ) ; end if
       (if (and (/= version nil) (= oldtag4 (strcase (vla-get-tagstring att))) )
       (vla-put-textstring att newstr4)
       ) ; end if
      ) ; end foreach
   ) ; end progn
) ; end if
(setq x (+ x 1))
) ; end repeat
(setq ss1 nil)
) ; end defun ah

(ah:sheetupdate1)
(princ)

dallen2408 发表于 2022-7-6 08:38:12

如何设置?我知道将Lisp文件放在哪里,只需要知道是否需要以及需要做什么才能确保它按预期的方式工作。谢谢,达伦

BIGAL 发表于 2022-7-6 08:42:48

我可能比答案提前了一点。代码是一个如何从布局名称中读取信息以及更改和添加标题栏详细信息的示例。在您的情况下,您可以选择另一种方式,提取这些信息以用作dwg列表中的详细信息。
 
刚才又看了一眼你的标题栏,要做我建议的事情,你需要向标题栏添加属性,比如“Project desc1”“Project desc2”“drawing by”,并填写这些属性。
 
我们的标题栏有两个部分:线条工作栏1和细节栏2,大约有20个属性“Proj title line1”“Proj title line1”“绘图标题行1”“rev”等等。所以我只需要添加一个新的块,将标题细节作为属性。
 
你也可以做你想做的事,但那可能更像是创建一个新的布局选项卡,并在我在dwg列表中创建条目时填写所有标题信息。
 
我认为你需要做一点家庭作业,你想要哪种方法,或者两者兼而有之?
页: [1]
查看完整版本: 自动编号布局选项卡fro