乐筑天下

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

[编程交流] 自动编号布局选项卡fro

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:40:53 | 显示全部楼层 |阅读模式
谁能帮帮我吗;我期待着自动编号的布局选项卡从目录表。我附上了一个图纸,应该有助于澄清我的要求。谢谢
空白设计包。图纸
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 08:03:01 | 显示全部楼层
我会走另一条路,从布局选项卡详细信息中创建目录,你可以去每个布局阅读标题栏等,并创建一个详细信息列表,放入表格或作为文本列。
 
这可能有助于你开始
 
  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. (ah:getval title)
  50. (setq dwgname item)
  51. (setq newstr4 (getstring "\nPlease enter version for all sheets <Cr> no change "))
  52. (princ "0")
  53. (setq len (length plotabs))
  54. (setq x 0)
  55. (setq bname "DA1DRTXT")
  56. (repeat len
  57. (setq tabname (nth x plotabs))
  58. (if (/= tabname "Model")
  59.    (progn
  60.      (setvar "ctab" tabname)
  61.      (setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname))))
  62.      (setq dwgnum (Lm:parsenumbers tabname))
  63.      (setq sheetnum (car dwgnum))
  64.      (setq oldtag1 "SHT_NO") ;attribute tag name
  65.      (setq newstr1 (rtos sheetnum 2 0))
  66.      (setq oldtag2 "DRG_NO") ;attribute tag name
  67.      (setq oldtag3 "PROJ_NO") ;attribute tag name
  68.      (setq newstr3 dwgname)
  69.      (setq oldtag4 "REV_NO") ;attribute tag name
  70. ; if less than 10
  71. (if (< (car dwgnum) 10.0)
  72.      (setq newstr2 (strcat dwgname "-D0"  (rtos sheetnum 2 0)))
  73.      (setq newstr2 (strcat dwgname "-D"  (rtos sheetnum 2 0)))
  74. )
  75.      (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
  76.        (if (= oldtag1 (strcase (vla-get-tagstring att)))
  77.        (vla-put-textstring att newstr1)
  78.        ) ; end if
  79.        (if (= oldtag2 (strcase (vla-get-tagstring att)))
  80.        (vla-put-textstring att newstr2)
  81.        ) ; end if
  82.        (if (= oldtag3 (strcase (vla-get-tagstring att)))
  83.        (vla-put-textstring att newstr3)
  84.        ) ; end if
  85.        (if (and (/= version nil) (= oldtag4 (strcase (vla-get-tagstring att))) )
  86.        (vla-put-textstring att newstr4)
  87.        ) ; end if
  88.       ) ; end foreach
  89.    ) ; end progn
  90. ) ; end if
  91. (setq x (+ x 1))
  92. ) ; end repeat
  93. (setq ss1 nil)  
  94. ) ; end defun ah
  95. (ah:sheetupdate1)
  96. (princ)
回复

使用道具 举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:38:12 | 显示全部楼层
如何设置?我知道将Lisp文件放在哪里,只需要知道是否需要以及需要做什么才能确保它按预期的方式工作。谢谢,达伦
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 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列表中创建条目时填写所有标题信息。
 
我认为你需要做一点家庭作业,你想要哪种方法,或者两者兼而有之?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 05:11 , Processed in 0.414187 second(s), 60 queries .

© 2020-2025 乐筑天下

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