乐筑天下

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

[编程交流] 创建绘图列表,但是

[复制链接]

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 11:32:41 | 显示全部楼层
 
他要搬进城堡,你可以在冰冷的护城河里游泳。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:36:08 | 显示全部楼层
 
请原谅我的无知,什么是SSM?
 
 
好主意,马克,我可能会这么做——我可能会成为这些公司的害虫,但如果它最终能给我一份工作,那就顺其自然吧
 
当然,你可以在我的温水游泳池里游泳
 
谢谢
 
回复

使用道具 举报

57

主题

351

帖子

294

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2022-7-6 11:37:33 | 显示全部楼层
你的电路板湿了怎么办?
回复

使用道具 举报

57

主题

351

帖子

294

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2022-7-6 11:40:07 | 显示全部楼层
图纸集管理器
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 11:42:48 | 显示全部楼层
 
 
嘿,李,
 
漂亮的游泳池。
115813aq3gv6gapoojbr8v.jpg
回复

使用道具 举报

5

主题

34

帖子

29

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 11:48:09 | 显示全部楼层
如果他们需要说服李,只要给他们指出Cadtutor的方向,你在这里的帖子就是一个很有价值的简历。
 
如果他们还不知道这个网站,那么我们为他们感到羞耻:哎呀:。
(我也可以得到游泳池的邀请吗?只是想看看那台机器!)大声笑:
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:49:00 | 显示全部楼层
 
谢谢Rob
 
希望我能很快找到一点工作——尽管这意味着我不能在这里花那么多时间。。。。
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 11:52:57 | 显示全部楼层
我在所有电路上都使用接触清洁剂。
 
水池、护城河、池塘,不管叫什么,只要水温合适,我就在里面游泳。请不要吃鳄鱼肉。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:57:11 | 显示全部楼层
 
我简直不敢相信这个帖子竟然偏离主题——肯定是一个聊天帖子。。。(对不起Strix、Tiger、Cad64和其他人~这是罪魁祸首)
 
希望Lisp程序对马可有用
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:59:58 | 显示全部楼层
我已经尝试制作这段代码的ObjectDBX版本,这样它可以在整个图形文件夹中同时运行,如果您有任何问题,请告诉我。
 
说明打印在标题上。
 
  1. ; ** ============[ DwgLst.lsp ]============== ** ;
  2. ; **                                          ** ;
  3. ; **  FUNCTION:                               ** ;
  4. ; **  Will Automatically Create a Drawing     ** ;
  5. ; **  List based on TitleBlock Attribute      ** ;
  6. ; **  Values.                                 ** ;
  7. ; **                                          ** ;
  8. ; ** ======================================== ** ;
  9. ; **                                          ** ;
  10. ; **  SYNTAX: DWGLST                          ** ;
  11. ; **                                          ** ;
  12. ; **  AUTHOR:                                 ** ;
  13. ; **  Copyright © 2009, Lee McDonnell         ** ;
  14. ; **  Contact Lee Mac:   CADTutor.net         ** ;
  15. ; **                     TheSwamp.org         ** ;
  16. ; **                                          ** ;
  17. ; ** ======================================== ** ;
  18. ; **                                          ** ;
  19. ; **  RESTRICTIONS:                           ** ;
  20. ; **  Machine must be able to run             ** ;
  21. ; **  Microsoft Excel.                        ** ;
  22. ; **                                          ** ;
  23. ; ** ======================================== ** ;
  24. ; **                                          ** ;
  25. ; **  USAGE:                                  ** ;
  26. ; **  Attributes from every instance of a     ** ;
  27. ; **  Specified Block are Extracted to        ** ;
  28. ; **  Excel.                                  ** ;
  29. ; **                                          ** ;
  30. ; **  An Excel file may be selected or        ** ;
  31. ; **  upon the user hitting Cancel at         ** ;
  32. ; **  the prompt, a new Excel file is         ** ;
  33. ; **  created.                                ** ;
  34. ; **                                          ** ;
  35. ; **  Block Name and Attribute Tag List may   ** ;
  36. ; **  be Changed in the Settings Panel below. ** ;
  37. ; **  Attribute Values will be written to     ** ;
  38. ; **  Excel in the order they appear in the   ** ;
  39. ; **  list.                                   ** ;
  40. ; **                                          ** ;
  41. ; ** ======================================== ** ;
  42. ; **                                          ** ;
  43. ; **  VERSION:                                ** ;
  44. ; **  1.0  ~  01.07.2009                      ** ;
  45. ; **  2.0  ~  02.07.2009                      ** ;
  46. ; **                                          ** ;
  47. ; ** ======================================== ** ;
  48. ; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;
  49. (defun c:DwgLst  (/  BlkName ValLst *acad
  50.                     Shell fDir Dir dwLst acVer
  51.                     cAtt attLst oLst file xlApp
  52.                     xlShe Ucells xlCells Col Row
  53.                     *error*
  54.                  )
  55. (vl-load-com)
  56. (setq
  57. ;; =-=-=-=-=[ Settings ]=-=-=-=-=- ;;
  58.    BlkName  "titleblock"             ;; { Block Name }
  59.    ValLst '("NUMBER" "DATE" "NAME")  ;; { Attribute Tag List }
  60. ;; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;;
  61. )
  62. ;; =-=-=-=[ Error Handler ]=-=-=-=- ;;
  63. (defun *error* (msg)
  64.    (mapcar 'ObjRel
  65.      (list xlApp xlShe UCells xlCells dbx *acad))
  66.    (if
  67.      (not
  68.        (wcmatch
  69.          (strcase msg)
  70.            "*BREAK,*CANCEL*,*EXIT*"))
  71.      (princ
  72.        (strcat
  73.          "\n<< Error: " msg " >>"))
  74.      (princ "\n*Cancel*"))
  75.    (princ))
  76. ;; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;;
  77. (cond ((not (eq 'STR (type BlkName)))
  78.         (princ "\n<< Block Name not a String >>"))
  79.        ((not (vl-consp ValLst))
  80.         (princ "\n<< Attribute Tag List Invalid >>"))
  81.        ((not
  82.           (vl-every
  83.             (function
  84.               (lambda (x)
  85.                 (eq 'STR (type x)))) ValLst))
  86.         (princ "\n<< Attribute Tag List Must only Contain Strings >>"))
  87.        (t
  88.          (setq *acad (vlax-get-acad-object)
  89.                Shell (vla-getInterfaceObject *acad "Shell.Application")
  90.                 fDir (vlax-invoke-method Shell 'BrowseForFolder
  91.                        (vla-get-HWND *acad) "Select Directory: " 80))
  92.         (ObjRel Shell)
  93.         (if fDir
  94.           (progn
  95.             (setq Dir
  96.               (vlax-get-property
  97.                 (vlax-get-property fDir 'Self)
  98.                 'Path))
  99.             (if (not (eq "\" (substr Dir (strlen Dir))))
  100.               (setq Dir (strcat Dir "\")))
  101.             (princ "\nProcessing...")
  102.             (foreach dwg (setq dwLst
  103.                            (mapcar
  104.                              (function
  105.                                (lambda (x)
  106.                                  (strcat Dir x)))
  107.                              (vl-directory-files Dir "*.dwg" 1)))
  108.               (vlax-for doc (vla-get-Documents *acad)
  109.                 (and (eq (strcase (vla-get-fullname doc)) (strcase dwg))
  110.                      (setq dbx doc)))      
  111.               (and (not dbx)
  112.                    (setq dbx
  113.                      (vlax-create-object
  114.                        (if (< (setq acVer (atoi (getvar "ACADVER"))) 16)
  115.                          "ObjectDBX.AxDbDocument"
  116.                          (strcat "ObjectDBX.AxDbDocument." (itoa acVer))))))         
  117.               (if (not (vl-catch-all-error-p
  118.                           (vl-catch-all-apply
  119.                             'vla-open (list dbx dwg))))
  120.                 (progn
  121.                   (vlax-for lay (vla-get-Layouts dbx)
  122.                     (vlax-for Obj (vla-get-Block lay)
  123.                       (if
  124.                         (and
  125.                           (eq
  126.                             (vla-get-ObjectName Obj) "AcDbBlockReference")
  127.                           (eq
  128.                             (strcase
  129.                               (vla-get-Name Obj)) (strcase BlkName)))
  130.                         (progn
  131.                           (foreach Att
  132.                             (append
  133.                               (vlax-safearray->list
  134.                                 (vlax-variant-value
  135.                                   (vla-GetAttributes Obj)))
  136.                               (if
  137.                                 (not
  138.                                   (vl-catch-all-error-p
  139.                                     (setq cAtt
  140.                                       (vl-catch-all-apply
  141.                                         'vlax-safearray->list
  142.                                           (list
  143.                                             (vlax-variant-value
  144.                                               (vla-getConstantAttributes Obj)))))))
  145.                                 cAtt))
  146.                             (if (vl-position
  147.                                   (strcase
  148.                                     (vla-get-TagString Att)) ValLst)
  149.                               (setq attlst
  150.                                 (cons
  151.                                   (cons
  152.                                     (vla-get-TagString Att)
  153.                                       (vla-get-TextString Att)) attlst))))
  154.                             (setq olst
  155.                               (cons
  156.                                 (mapcar
  157.                                   (function
  158.                                     (lambda (x)
  159.                                       (assoc x attlst))) ValLst) olst) attlst nil))))))
  160.                 (princ (strcat "\n<< Error Opening Dwg: " dwg " >>")))
  161.               (princ (chr 46))
  162.               (ObjRel dbx) (setq dbx nil))
  163.             ;; -=-=-=-=-=-=-[ Write to Excel ]-=-=-=-=-=-=- ;;
  164.             (if oLst
  165.               (progn
  166.                 (if (setq file (getfiled "Select Excel File" "" "xls" )
  167.                   (progn
  168.                     (setq xlApp (vlax-get-or-create-object "Excel.Application")
  169.                           xlshe (vlax-get-property
  170.                                   (vlax-get
  171.                                     (vla-open
  172.                                       (vlax-get xlApp "Workbooks")
  173.                                       file)
  174.                                     "Sheets")
  175.                                   "Item" 1)
  176.                           Ucells  (vlax-get xlshe "Usedrange")
  177.                           xlCells (vlax-get xlshe "Cells"))
  178.                     (setq Col (- (vlax-get
  179.                                    (vlax-get ucells "Columns")
  180.                                    "Count")
  181.                                  2)
  182.                           row     (1+
  183.                                     (vlax-get
  184.                                       (vlax-get ucells "Rows")
  185.                                       "Count"))))
  186.                   (progn
  187.                     (setq xlApp (vlax-get-or-create-object "Excel.Application")
  188.                           xlshe (vlax-get-property
  189.                                   (vlax-get
  190.                                     (vlax-invoke-method
  191.                                       (vlax-get xlApp "Workbooks")
  192.                                       "Add")
  193.                                     "Sheets")
  194.                                   "Item" 1)
  195.                           xlCells (vlax-get xlshe "Cells") Col 1 row 1)
  196.                     (foreach Tag ValLst
  197.                       (vlax-put-property xlCells "Item" row Col Tag)
  198.                       (setq Col (1+ Col)))
  199.                     (setq Col 1 row 2)))
  200.                 (vla-put-visible xlApp :vlax-true)
  201.                 (foreach Sht (reverse oLst)
  202.                   (if (< 65536 row)
  203.                     (setq Col (1+ (length ValLst)))
  204.                     (setq Col 1))
  205.                   (foreach Tag Sht
  206.                     (vlax-put-property xlCells "Item" row Col (cdr Tag))
  207.                     (setq Col (1+ Col)))
  208.                   (setq row (1+ row)))
  209.                 (gc) (gc)
  210.                 (alert "Close Excel File Manually")
  211.                 (princ
  212.                   (strcat "\n<< " (rtos (length dwLst) 2 0) " Drawings Processed >>")))
  213.               (princ "\n<< No TitleBlocks Found in Drawing >>")))
  214.           (princ "\n*Cancel*"))
  215.         (mapcar 'ObjRel
  216.           (list xlApp xlShe UCells xlCells dbx *acad))))
  217. (princ))
  218. ;; =-=-=-=-=[ Object Release ]=-=-=-=-= ;;
  219. (defun ObjRel (Obj)
  220. (and Obj
  221.    (eq 'VLA-OBJECT (type Obj))
  222.      (not (vlax-object-released-p Obj))
  223.        (vl-catch-all-apply
  224.          'vlax-release-object
  225.            (list Obj))))
  226. (vl-load-com)
  227. (princ
  228. (vl-list->string
  229.    '(10 42 42 32 68 119 103 76 115 116 46 108 115 112 32 98
  230.      121 32 76 101 101 32 77 99 68 111 110 110 101 108 108
  231.      44 32 67 111 112 121 114 105 103 104 116 32 169 32 74
  232.      117 108 121 32 50 48 48 57 32 42 42 10 32 32 32 32 32
  233.      32 32 32 32 32 32 32 45 32 84 121 112 101 32 34 68 87
  234.      71 76 83 84 34 32 116 111 32 73 110 118 111 107 101 32 45)))
  235. (princ)
  236. ;|
  237. ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;
  238.                          End of Program Code                          
  239. ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;
  240. |;
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 12:00 , Processed in 0.331257 second(s), 72 queries .

© 2020-2025 乐筑天下

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