andy_lee 发表于 2022-7-5 19:49:56

Extract the attributes, and wr

Extract the attributes, and written table(or output excel), this is aBOM ?

 
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 bottomorder 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

andy_lee 发表于 2022-7-5 19:55:56

I think I find a way ,
 
USE "ATTEXT" AND "EATTEXT " AND"ATTOUT "
 
See post #6 and #7

andy_lee 发表于 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 understandwrite lisp , someone can help?

hanhphuc 发表于 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

andy_lee 发表于 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 .

hanhphuc 发表于 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
https://dl.dropboxusercontent.com/u/25241751/Shared%20SM/GIF%20Demo/andy%20att.PNG

andy_lee 发表于 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 commandEATTEXT
 
And I find a lisp , Can use ? I don't understand.

;;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))

hanhphuc 发表于 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)?

andy_lee 发表于 2022-7-5 20:17:15

 
I think " EATTEXT " is best ! you can try it ! can chooseattribute, can output *.xls ,can insert table.
and no need ET tools

hanhphuc 发表于 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
页: [1] 2
查看完整版本: Extract the attributes, and wr