乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: badogblue

[编程交流] 更改图纸编号和标题v

[复制链接]

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 00:33:28 | 显示全部楼层
下面是一个lisp示例
 
  1. ; changes to issued for construction
  2. : thanks to lee mac for original code
  3. (vl-load-com)
  4. ; 1.  Get current date in mm/dd/yy format.
  5. (defun ddmmyy (/ x today)
  6.     (setvar "cmdecho" 0)
  7.     (setq x (getvar "CDATE"))                 ; get current date
  8.     (setq today ( rtos x 2 4))                    ; convert to a string
  9.     (setq date (strcat (substr today 7 2) "."    (substr today 5 2) "." (substr today 3 2) ))
  10. )
  11. (setq oldtag1 "DRAWING_STATUS") ;attribute tag name
  12. (setq newstr1 "ISSUED FOR CONSTRUCTION")
  13. (setq oldtag2 "REV_NO")  ;attribute tag name
  14. (setq newstr2 "0")
  15. (setq ss1 (ssget "x"  '((0 . "INSERT") (2 . "DA1DRTXT"))))
  16. (setq inc (sslength ss1))
  17. (repeat inc      
  18. (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) 'getattributes)
  19. (if (= oldtag1 (strcase (vla-get-tagstring att)))
  20. (vla-put-textstring att newstr1)
  21. ) ; end if
  22. (if (= oldtag2 (strcase (vla-get-tagstring att)))
  23. (vla-put-textstring att newstr2)
  24. ) ; end if
  25. ) ; end for
  26. ) ;end repeat
  27. (setq oldtag1 "REV-NO")
  28. (setq newstr1 "0")
  29. (ddmmyy)
  30. (setq oldtag2 "DATE")
  31. (setq newstr2 date)
  32. (setq oldtag3 "AMENDMENT")
  33. (setq newstr3 "ISSUED FOR CONSTRUCTION")
  34. (setq ss2 (ssget "x"  '((0 . "INSERT") (2 . "REVTABLE"))))
  35. (setq inc (sslength ss2))
  36. (repeat inc
  37. (foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq inc (1- inc)))) 'getattributes)
  38. (if (= oldtag1 (strcase (vla-get-tagstring att)))
  39. (vla-put-textstring att newstr1)
  40. )
  41. (if (= oldtag2 (strcase (vla-get-tagstring att)))
  42. (vla-put-textstring att newstr2)
  43. )
  44. (if (= oldtag3 (strcase (vla-get-tagstring att)))
  45. (vla-put-textstring att newstr3)
  46. )
  47. )
  48. )
  49. (setq ss1 nil)
  50. ; (setq ss2 nil)
  51. (princ)
回复

使用道具 举报

3

主题

10

帖子

7

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 00:37:01 | 显示全部楼层
我们使用了一个很好的小脚本“bfind”
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:39:56 | 显示全部楼层
 
这似乎不适用于图纸编号所需的增量编号。我从lee mac下载了批属性编辑器,它看起来很完美,但似乎不起作用。
 
我选择了要更改的图形和属性,但单击“运行”后,什么都没有发生!它在命令行上显示:“您想放弃所有更改吗?”。选择yes(是)或no(否)将打开file open(文件打开)窗口。我认为这是因为我的cad安装了cadtools,它阻止了属性编辑器连接到标题栏。它还附带了OA分析,这可能也是一个问题。
 
有什么建议吗?
回复

使用道具 举报

1

主题

80

帖子

79

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:43:08 | 显示全部楼层
如果你发布一个样例绘图,我很乐意为你编写一个LISP例程。
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:46:53 | 显示全部楼层
 
谢谢你的提议,不幸的是,我没有失去在网上张贴一张画的自由。如果您可以发布一个用于增量更改页码的通用lisp,我可以稍后添加标题栏名称和属性名称。如果不是太麻烦的话。
我真的很感谢你的帮助,谢谢!
回复

使用道具 举报

7

主题

110

帖子

104

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-6 00:51:00 | 显示全部楼层
 
只需要标题栏
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 00:54:37 | 显示全部楼层
该方法在我发布的代码中都有,但您需要一个变体,它在布局中迭代,并更改正确的变量,即页码。
 
这里有一个不同的lisp,它可以做到这一点,再加上一些其他的东西,它使用布局名称,布局名称的末尾有一个与图纸编号匹配的数字。
 
  1. ; change the 410 to layout name
  2. ;;-------------------=={ Parse Numbers }==--------------------;;
  3. ;;                                                            ;;
  4. ;;  Parses a list of numerical values from a supplied string. ;;
  5. ;;------------------------------------------------------------;;
  6. ;;  Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url]       ;;
  7. ;;------------------------------------------------------------;;
  8. ;;  Arguments:                                                ;;
  9. ;;  s - String to process                                     ;;
  10. ;;------------------------------------------------------------;;
  11. ;;  Returns:  List of numerical values found in string.       ;;
  12. ;;------------------------------------------------------------;;
  13. (defun LM:ParseNumbers ( s )
  14. (
  15.    (lambda ( l )
  16.      (read
  17.        (strcat "("
  18.          (vl-list->string
  19.            (mapcar
  20.              (function
  21.                (lambda ( a b c )
  22.                  (if
  23.                    (or
  24.                      (< 47 b 58)
  25.                      (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
  26.                      (and (= 46 b) (< 47 a 58) (< 47 c 58))
  27.                    )
  28.                    b 32
  29.                  )
  30.                )
  31.              )
  32.              (cons nil l) l (append (cdr l) (list nil))
  33.            )
  34.          )
  35.          ")"
  36.        )
  37.      )
  38.    )
  39.    (vl-string->list s)
  40. )
  41. )
  42. ;(defun ah:sheetupdate1 (ss1 lay plotabs tabname dwgname)
  43. (defun ah:sheetupdate1 ()
  44. (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  45. (vlax-for lay (vla-get-Layouts doc)
  46. (setq plotabs (cons (vla-get-name lay) plotabs))
  47. )
  48. (setq title "Please enter dwg number")
  49. (setq width "   edit_width = 12;")
  50. (setq limit "     edit_limit = 9;")
  51. (ah:getval title width limit)
  52. (setq dwgname item)
  53. (setq title "Please enter version for all sheets <Cr> no change")
  54. (setq width "   edit_width = 8;")
  55. (setq limit "     edit_limit = 5;")
  56. (ah:getval title width limit)  
  57. (setq newstr4 item)
  58. (princ "0")
  59. (setq len (length plotabs))
  60. (setq x 0)
  61. (setq bname "DA1DRTXT")
  62. (repeat len
  63. (setq tabname (nth x plotabs))
  64. (if (/= tabname "Model")
  65.    (progn
  66.      (setvar "ctab" tabname)
  67.      (setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname))))
  68.      (setq dwgnum (Lm:parsenumbers tabname))
  69.      (setq sheetnum (car dwgnum))
  70.      (setq oldtag1 "SHT_NO") ;attribute tag name
  71.      (setq newstr1 (rtos sheetnum 2 0))
  72.      (setq oldtag2 "DRG_NO") ;attribute tag name
  73.      (setq oldtag3 "PROJ_NO") ;attribute tag name
  74.      (setq newstr3 dwgname)
  75.      (setq oldtag4 "REV_NO") ;attribute tag name
  76. ; if less than 10
  77. (if (< (car dwgnum) 10.0)
  78.      (setq newstr2 (strcat dwgname "-D0"  (rtos sheetnum 2 0)))
  79.      (setq newstr2 (strcat dwgname "-D"  (rtos sheetnum 2 0)))
  80. )
  81.      (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
  82.        (if (= oldtag1 (strcase (vla-get-tagstring att)))
  83.        (vla-put-textstring att newstr1)
  84.        ) ; end if
  85.        (if (= oldtag2 (strcase (vla-get-tagstring att)))
  86.        (vla-put-textstring att newstr2)
  87.        ) ; end if
  88.        (if (= oldtag3 (strcase (vla-get-tagstring att)))
  89.        (vla-put-textstring att newstr3)
  90.        ) ; end if
  91.        (if (and (/= newstr4 nil) (= oldtag4 (strcase (vla-get-tagstring att))) )
  92.        (vla-put-textstring att newstr4)
  93.        ) ; end if
  94.       ) ; end foreach
  95.    ) ; end progn
  96. ) ; end if
  97. (setq x (+ x 1))
  98. ) ; end repeat
  99. (setq ss1 nil)  
  100. ) ; end defun ah
  101. (ah:sheetupdate1)
  102. (princ)
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:57:49 | 显示全部楼层
抱歉回复太慢,一直很忙。
 
感谢Bigal的Lisp程序,不幸的是,它无法工作。已经给了几百张图纸重新编号,所以我迫切需要一个脚本/lisp来自动执行。
 
总而言之:我需要更改整个图纸系列的页码和图纸编号,以便按升序排列。
 
例如:对于页码:“第1页,共200页”,“第2页,共200页”等。
图纸编号:“xxxx\u xxxx\u 100\u 001”、“xxxx\u xxxx\u 100\u 002”等。
 
以下是用于更改标题栏中的值的示例脚本:
 
 
这是标题栏的图片,包括所有属性标记。
 
010117hlxs73jovjxlvljl.jpg
 
提前感谢!
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 01:01:01 | 显示全部楼层
现成的并不存在,因为每个块都有不同的名称和不同的属性标记名称。
 
因此,首先您必须更改上面代码中的块名,它是DA1DRTXT
 
属性标签需要更改为“DRG_NO”);属性标签名,到你的BDR\U DWGTITLE1等等,然后你的好的方式。
 
再次张贴你的标题栏,这是一个5分钟的工作
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 01:01:36 | 显示全部楼层
这里是一个快速剪切粘贴更改yourblockname
 
  1. ; changes to issued for construction
  2. (vl-load-com)
  3. (setq oldtag1 "BDR_JOBTITLE1") ;attribute tag name
  4. (setq newstr1 "Job title 1")
  5. (setq oldtag2 "BDR_JOBTITLE1")  ;attribute tag name
  6. (setq newstr2 "Job title 2")
  7. (setq x 1) ; sheet 1
  8. (setq ss1 (ssget "x"  '((0 . "INSERT") (2 . "Yourblockname"))))
  9. (setq inc (sslength ss1)) ; this is the total number of sheets +1
  10. (repeat inc      
  11. (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) 'getattributes)
  12. (if (= oldtag1 (strcase (vla-get-tagstring att)))
  13. (vla-put-textstring att newstr1)
  14. ) ; end if
  15. (if (= oldtag2 (strcase (vla-get-tagstring att)))
  16. (vla-put-textstring att newstr2)
  17. ) ; end if
  18. (if (= oldtag3 (strcase (vla-get-tagstring att)))
  19. (vla-put-textstring att x)
  20. ) ; end if
  21. ) ; end for
  22. (setq x (+ x 1))
  23. ) ;end repeat
  24. (setq ss1 nil)
  25. ; (setq ss2 nil)
  26. (princ)
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 21:04 , Processed in 0.916641 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表