乐筑天下

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

[编程交流] 使用AutoLISP进行图纸编号,

[复制链接]

14

主题

122

帖子

108

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-6 00:37:36 | 显示全部楼层
通气更新(见第10篇)
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 00:39:48 | 显示全部楼层
你在跑步吗?由于使用lisp很容易,您只需制作一个布局名称列表,长度为1(模型)=没有选项卡。使用它的唯一规则是不要垃圾布局。不过,您可以删除某些名称的布局,只需稍微复杂一点。
回复

使用道具 举报

14

主题

122

帖子

108

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-6 00:47:15 | 显示全部楼层
我正在运行2012/2013年ACAD。我不太擅长LISP或宏。我只是从这个开始。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 00:48:10 | 显示全部楼层
读一读这本应该做你想做的事。只需更改块名和标记名。
 
  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 - www.lee-mac.com       ;;
  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 len (length plotabs))
  49. (setq tabsqty (- len 1)) ; remove model from number of layouts
  50. (setq x 0)
  51. (setq bname "DA1DRTXT") ; title block name
  52. (repeat len
  53. (setq tabname (nth x plotabs))
  54. (if (/= tabname "Model")
  55.    (progn
  56.      (setvar "ctab" tabname)
  57.      (setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname))))
  58.      (setq dwgnum (Lm:parsenumbers tabname))
  59.      (setq sheetnum (car dwgnum))
  60.      (setq oldtag1 "SHT_NO") ;attribute tag name
  61.      (setq newstr1 (rtos sheetnum 2 0))
  62.      (setq oldtag3 "SHT_QTY") ;attribute tag name
  63.      (setq newstr3 tabsqty)
  64. ; if less than 10
  65. (if (< (car dwgnum) 10.0)
  66.      (setq newstr2 (strcat dwgname "-D0"  (rtos sheetnum 2 0)))
  67.      (setq newstr2 (strcat dwgname "-D"  (rtos sheetnum 2 0)))
  68. )
  69.      (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
  70.        (if (= oldtag1 (strcase (vla-get-tagstring att)))
  71.        (vla-put-textstring att newstr1) ; change attribute value
  72.        ) ; end if
  73.         (if (= oldtag3 (strcase (vla-get-tagstring att)))
  74.        (vla-put-textstring att newstr3) ; change attribute value
  75.        ) ; end if
  76.       ) ; end foreach
  77.    ) ; end progn
  78. ) ; end if
  79. (setq x (+ x 1))
  80. ) ; end repeat
  81. (setq ss1 nil)  
  82. ) ; end defun ah
  83. (ah:sheetupdate1)
  84. (princ)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 22:34 , Processed in 0.345680 second(s), 58 queries .

© 2020-2025 乐筑天下

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