Jump to content

Need list to export "Block" atribute value to txt file


plecs

Recommended Posts

can someone help me and me to change lisp routines below with something else to count same blocks and write text file on a line all the attributes of blocks

thank you in advance

 

 

 

 

(defun c:Test (/ f w ss i e en)
 ;;--- Tharwat 09. May. 2013 ---;;
 (if (and (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
          (setq f (getfiled "Specify name of txt file :" "" "txt" 1))
          (setq w (open f "w"))
     )
   (progn
     (repeat (setq i (sslength ss))
       (setq e (ssname ss (setq i (1- i))))
       (while
         (/= (cdr (assoc 0 (setq en (entget (setq e (entnext e))))))
             "SEQEND"
         )
          (if (eq (cdr (assoc 0 en)) "ATTRIB")
            (write-line (cdr (assoc 1 en)) w)
          )
       )
     )
     (close w)
   )
   (cond ((not ss)
          (alert
            "Couldn't find any Attributed Block in the drawing <!>"
          )
         )
         ((not f) (princ "\n File failed to be created <!>"))
         (t (princ "\n Can not open the specified file <!>"))
   )
 )
 (princ "\n Written by Tharwat Al Shoufi")
 (princ)
)

Link to comment
Share on other sites

Are you after giving the option to users to select the attributed blocks they want to export only ? if so , just remove "_X" from the routine .

Otherwise more explanations is needed .

Link to comment
Share on other sites

values that exports to txt file are vertical if the block has multiple attibute write them horizontally, and if the block were identical to remuve duplicates and have quantity

650
510
0
FUND_1
1
0
1
1
101PE Alb Perlat 
18
744
510
0
LAT_1
1
0
0
0
101PE Alb Perlat 
18
744
510
0
LAT_1
1
0
0
0
101PE Alb Perlat 
18
614
100
0
TRAV_1
1
0
0
0
101PE Alb Perlat 
18
614
100
0
TRAV_1
1
0
0
0
101PE Alb Perlat 
18
645
757
0
SP_PFL_1
0
0
0
0
101PE Alb Perlat 
3

 

I wish if I can help with lisp routine changed

to export txt just like this

 

1	650	510	0	FUND_1	1	0	1	1	101PE Alb Perlat 	18
2	744	510	0	LAT_1	1	0	0	0	101PE Alb Perlat 	18
2	614	100	0	TRAV_1	1	0	0	0	101PE Alb Perlat 	18

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...