乐筑天下

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

[编程交流] 从Auto中提取属性

[复制链接]

7

主题

20

帖子

13

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 15:17:38 | 显示全部楼层 |阅读模式
我有多个图纸,我们从每个图纸中复制图纸编号、说明和,从每个图纸的BOM表中复制标准零件及其说明。然后粘贴到预格式化的excel电子表格中。
图号第一,说明。
2、每张图纸BOM中的标准件及其说明。
我正在寻找一种方法来提取属性图形文件编号和标题,并能够从AutoCAD图形文件中的BOM表中提取标准零件或选定零件和描述,从可变图形到预格式化的Excel电子表格?
我正在使用AutoCAD mechanical 2018。
有没有办法做这个程序或Lisp程序?
 
http://www.cadtutor.net/forum/images/icons/icon6.gif
1715-143.xls公司
161744wmewnnkwvfhienmm.jpg
161747gb9es2unq17eseuw.jpg
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 15:25:56 | 显示全部楼层
嗨Cadmando-2
 
很抱歉,我花了一段时间才回复你-我看到你在这里和AUGI都发了帖子,但我们出色的IT部门在工作时将这两个网站定义为社交媒体,当我发布代码并阻止发布时。
 
在dlanorh的宝贵帮助下,我几乎完成了编写一个与您类似的程序,该程序将属性从Autocad 2016导出到Revit 15(请参阅我今天早些时候的文章)。
 
我在下面添加了一些代码,希望能给你一个如何操作的指针-我将发布我完成的程序,你应该能够根据自己的应用程序进行调整,但基本上程序是这样的-
 
1、创建属性提取文件
2.使用lisp程序中的属性提取功能将属性信息(图纸编号、图纸标题等)导出到逗号分隔的文本文件(.csv)
3.使用Read line函数读取文本文件的每一行,并使用逗号将该行“剪切”为lisp文件中的变量。
4.将变量推入excel文件中正确工作表上的正确单元格中。。。。
 
  1. (defun c:excelcontrol ()
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This sets up the autocad  environment to run  Excel;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;;;load all the VL commands, then the set the library to Excel
  4. (vl-load-com)
  5. (setq tlbfile (findfile "C:\\Program Files\\Microsoft Office 15\\root\\Office15\\Excel.exe"))
  6. (vlax-import-type-library :tlb-filename tlbfile :methods-prefix "msxl-" :properties-prefix "msxl-" :constants-prefix "msxl-")
  7. ;;;Open the excel spreadsheet and find the current worksheet
  8. (setq xfile "c:\\1715-143.xls")
  9. (cond
  10.    ((setq fn (findfile xfile))
  11.      (cond
  12.        ((setq appsession (vlax-get-or-create-object "Excel.Application"))
  13.          (vlax-invoke-method (vlax-get-property appsession 'workbooks) 'open fn)
  14.          (vla-put-visible appsession 0)
  15.        )
  16.      )
  17.    )
  18.    (t (alert (strcat "nCannot locate source file: " xfile)))
  19. )
  20. (setq xlapp appsession)
  21. (setq rng (msxl-get-activesheet xlapp))
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This is how you set the cell  number;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. ;;;Setq the cell reference to put the drawing number into (cell A10)
  24. (setq Data1_row 10)
  25. (setq Data1_column 1)
  26. (setq cell_detail_1 (vlax-variant-value (msxl-get-item (msxl-get-cells  rng) (vlax-make-variant Data1_row) (vlax-make-variant Data1_column))))
  27. ;;;Setq the cell reference to put the drawing title into into (cell H10)
  28. (setq Data2_row 10)
  29. (setq Data2_column
  30. (setq cell_detail_2 (vlax-variant-value (msxl-get-item (msxl-get-cells  rng) (vlax-make-variant Data2_row) (vlax-make-variant Data2_column))))
  31. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This is how you put the information in the  spreadsheet;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  32. ;;;Get the drawing number and upload it into the excel spreadsheet
  33. (msxl-put-value2 cell_detail_1 drawing_number)
  34. ;;;Get the drawing  and upload it into the excel spreadsheet
  35. (msxl-put-value2 cell_detail_2 drawing_title)
  36. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This saves and closes the  spreadsheet;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  37. ;;;Save the modified workbook
  38. (setq workbook (vlax-get-property xlapp "ActiveWorkbook"))
  39. (vlax-invoke-method workbook "Save")
  40. ;;;Close excel, clear the memory and exit quietly
  41. (vlax-invoke-method xlapp "Quit")
  42. (vlax-release-object xlapp)
  43. (gc)
  44. (princ)
  45. )
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 15:27:36 | 显示全部楼层
“笑脸”应该是8,后跟a)
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-5 15:32:17 | 显示全部楼层
 
请阅读代码发布指南,并将您的代码包含在代码标签中。[NOPARSE]
  1. Your Code Here[/NOPARSE]
=
  1. Your Code Here
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 15:37:18 | 显示全部楼层
谢谢SLW210
 
我找不到如何做粘贴数据代码-我会在将来做。。。
 
顺致敬意,
 
太空猪62
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-5 15:40:48 | 显示全部楼层
cadmando-2
这是可能的。但这在很大程度上取决于标题栏。
你能附上标题栏的例子吗。图纸?
回复

使用道具 举报

7

主题

20

帖子

13

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 15:48:22 | 显示全部楼层
这是BOM表的标题,由插入引出序号并添加BOM表的引出序号命令生成。然后,您必须编辑每个BOM表行并输入每行的值。不是很有成效,但这是我们所拥有的。我甚至上传了BOM。插入引出序号和BOM表的dwg和lisp例程
D-标题。图纸
物料清单。图纸
dball。lsp
DBOM。图纸
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-5 15:53:17 | 显示全部楼层
我们需要一个带有几个标题栏的真实文件进行验证。
你的例子是空的。
回复

使用道具 举报

7

主题

20

帖子

13

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 15:55:59 | 显示全部楼层
谢谢
当我有时间的时候,我试着解决它。我刚刚完成了一个大项目,没有时间做这个。
当我有时间做一些定制的CAD工作时,我总是不得不把它放在一边。
保持忙碌是很好的,但如果这个过程可以连续进行的话,这些人会尝试不必要的工作。
我只知道足够的lisp来应付,但写了30年的CAD后,我自己的代码。我还没到那里。任何关于书籍或网站的建议。我可以编写脚本和修改一些lisp文件。
我刚刚购买了Rod Rawls/Mark Hagen的“AutoLiSP编程原理和技术”,Trevor Bousfield的“AutoCAD AutoLiSP”,Reinaldo N.Togores的AutoCAD专家Visual LISP。
回复

使用道具 举报

7

主题

20

帖子

13

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 16:01:20 | 显示全部楼层
D-标题栏
1715-0143-00-R2。图纸
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-14 13:04 , Processed in 0.862158 second(s), 75 queries .

© 2020-2025 乐筑天下

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