乐筑天下

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

[编程交流] Extract the attributes, and wr

[复制链接]

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 19:49:56 | 显示全部楼层 |阅读模式
Extract the attributes, and written table(or output excel), this is a  BOM ?
205002xln9i5889ymnoy7e.png
 
Maybe one dwg have 300~500 drawings........
 
I think like this :
 
1step. run command
2step. choose all drawing in mode space. (crossing )
3step. Enter the text height (Text style is SIMPLEX, is style ,not font )
4step. Select (a) pick a baskpoint insert table (b)or output excel
 
 
Essential
1.Use Drawing number from top to bottom  order arrange
   Sort by the last three digits of drawing No.
eg.
1-SS706A-001
3-SS706A-002
2-SS706A-003
1-SS706A-004
1-SS706A-005
 
2.Check the PARTNAME , if have Duplicate PARTNAME ,SO Pop-up tips.
3.Check the DRAWING NO , if have Duplicate DRAWING NO ,SO Pop-up tips.
 
4.If insert table, Must: Layer is DIM , Text style is SIMPLEX, (is style ,not font )   DIM layer and SIMPLEX style is exist.
 
But I can't try it by myself. I 'm sorry! I don't understand write lisp .lisp is so magical,  when I have time, I will learn. Now I need help.
Many thanks for help me!
 
See Attachments. for test.
TEST1.dwg
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 19:55:56 | 显示全部楼层
I think I find a way ,
 
USE "ATTEXT" AND "EATTEXT " AND  "ATTOUT "
 
See post #6 and #7
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 19:59:24 | 显示全部楼层
May something like this ,http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extract-attributes-from-a-specific-block-and-write-to-table/td-p/5399759
 
I 'm sorry! I don't understand  write lisp , someone can help?
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:01:10 | 显示全部楼层
hi Andy,
please understand all members are volunteers ,
i think there're similar thread can be found here or other forum.
 
1.did you try? blockcounter?
 
2.Tips: to modify multiple
(if you have express tool installed)
command: ATTOUT
 
after modify in excel
command: ATTIN
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 20:03:59 | 显示全部楼层
 
Thanks han.
I know all members are volunteers . Very wonderful forum and members !
There're similar thread not suitable for me . need modify !
Maybe one dwg have 300~500 drawing ... if manual statistics , It's a very difficult task .
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:07:32 | 显示全部楼层
creating table from excel is not problem if your are using higher version of acad.
also many blocks / attribute collection function around.
my method is almost same, but not all can suit every need.
 
as start point you should try how to manually manipulate data?
try command: ATTOUT , edit in excel is better way. you can rearrange the column ,sorting, filter ,list table etc..
example has almost data in your post#1

                               
登录/注册后可看大图
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 20:11:26 | 显示全部楼层
 
Thank you so much! han .
Use " ATTOUT" can output all attribute in a txt file ......, need to manually organize.
 
And I find another way , use command  EATTEXT
 
And I find a lisp , Can use ? I don't understand.
  1. ;;http://bbs.mjtd.com/thread-84241-3-1.html(defun c:tt(/ qxpath qxname files data ff )   (setq ff (open "c:\\tempfiles\\bom.txt" "w"))   (princ "" ff)   (close ff)   (setvar "filedia" 0)(setvar "sdi" 1)(setvar "lispinit" 0)   (setq qxpath "C:\\tempfiles\")   (setq qxname "*.dwg")   (setq files (vl-directory-files qxpath qxname 1))   ;(setq files (FileNameSort files))   (setq data (car files))   (while data               (command "open" )               (command (strcat "c:\\tempfiles\" data))               (getatti)               (command "qsave")               (setq files (cdr files))               (setq data (car files))   )       (setvar "sdi" 0)       (setvar "lispinit" 1)       (command "close"))(defun getatti(/ ss i ent elist tymc tydh js loop ename ff)   (setq ss (ssget "all" (list '(0 . "INSERT") (cons 2 "A4,A4横,A3,A2,A1,A0"))))   (if ss       (progn           (setq i (sslength ss))           (setq ent (ssname ss (setq i (1- i)))               ename (entnext ent)               loop t           )           (while (and ename loop)               (setq elist (entget ename))               (if (= (cdr (assoc 0 elist)) "ATTRIB")                   (progn                       (if (= (cdr (assoc 2 elist)) "图样名称")                           (progn                               (setq tymc (cdr (assoc 1 elist)))                           )                       )                       (if (= (cdr (assoc 2 elist)) "图样代号")                           (progn                               (setq tydh (cdr (assoc 1 elist)))                           )                       )                       (if (= (cdr (assoc 2 elist)) "件数")                           (progn                               (setq js (cdr (assoc 1 elist)))                           )                       )                   )                   (setq loop nil)               )               (setq ename (entnext ename))           )       )   )   (setq ff (open "c:\\tempfiles\\bom.txt" "a"))   (princ (strcat tymc "\t\t" tydh "\t" js "\n") ff)   (close ff)   (princ))
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:12:29 | 显示全部楼层
with ATTOUT you are close to the result because very easy manipulate in excel.
i'm not sure Drawing Number to be renumbered (override)?
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 20:17:15 | 显示全部楼层
 
I think " EATTEXT " is best ! you can try it ! can choose  attribute, can output *.xls ,can insert table.
and no need ET tools
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:18:59 | 显示全部楼层
 
by EATTEXT , that's mean you are not going to reorganize column, edit or renumber attributes? however, i'm happy if it solved your issue  
if you want to edit multiple renumber or modify attribute: ATTOUT
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 13:37 , Processed in 0.561316 second(s), 75 queries .

© 2020-2025 乐筑天下

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