Author Topic: Extract Attributes and handle in a massive way  (Read 927 times)

0 Members and 1 Guest are viewing this topic.

Aldo

  • Newt
  • Posts: 22
Extract Attributes and handle in a massive way
« on: December 27, 2022, 08:52:13 PM »
The ATTOUT command allows me to export the attributes and the Handle of the blocks, the issue is that I have to select them one by one to obtain this information, the question is, is there any way to extract this information in a massive way without selecting each one of them? maybe just giving the name of each block and extract this data, very grateful for the support provided.

BIGAL

  • Swamp Rat
  • Posts: 1419
  • 40 + years of using Autocad
Re: Extract Attributes and handle in a massive way
« Reply #1 on: December 27, 2022, 10:36:09 PM »
Dataextraction type it and follow the prompts.

The other way is a custom extract routine. There are just to many if and buts to answer that custom question. It depends on 1 block name or multiple names, all atts or just some, total blocks and  so on.

If you describe clearly what it is your trying to export out then someone may have a solution already.
« Last Edit: December 27, 2022, 10:39:21 PM by BIGAL »
A man who never made a mistake never made anything

mhupp

  • Bull Frog
  • Posts: 250
Re: Extract Attributes and handle in a massive way
« Reply #2 on: December 27, 2022, 11:46:32 PM »
Your not using attout correctly. You can select as many blocks as you want to display in the output file.

Aldo

  • Newt
  • Posts: 22
Re: Extract Attributes and handle in a massive way
« Reply #3 on: December 28, 2022, 12:59:21 PM »
lee mac made a Lips but it does not export the handle, I am putting the link so you can get an idea of what I need, this routine is very good, it is just what I need but the handle is missing, very grateful for the prompt responses.

http://www.lee-mac.com/macatt.html

BIGAL

  • Swamp Rat
  • Posts: 1419
  • 40 + years of using Autocad
Re: Extract Attributes and handle in a massive way
« Reply #4 on: December 28, 2022, 09:09:53 PM »
Did you send a message to Lee he has a Contact me on his web page Lee-mac.com.

The code is massive and impressive as usual but complicated to find the right point in code to add the Handle as an item.
A man who never made a mistake never made anything

Aldo

  • Newt
  • Posts: 22
Re: Extract Attributes and handle in a massive way
« Reply #5 on: January 02, 2023, 06:34:19 PM »
I found this lisp but i get this: error: no function definition: ATT:SORT, can you help me correct this error?

(defun c:attt (/ ss l ls f fn bn b)

;; put your error handle here

  (foreach x
       (reverse ((lambda (i / l)
         (while (setq b (tblnext "BLOCK" (not b)))
           (setq   ls (cons
                 (cons (setq i (1+ i))
                  (cdr (assoc 2 b))
                 )
                 ls
               )
           )
         )
            )
             -1
           )
       )
    (terpri)
    (princ x)
  )
  (textscr)
  (initget 5)
  (if
    (and (setq i (getint "\nIndex for block name? : "))
    (< i (length ls))
    (setq bn (cdr (assoc i ls)))
    (setq l (att:sort bn 1 >))  ;;; here to adjust, (1) indicates sorting Y-coordinates, (>) Z-A
    (setq fn (vl-filename-mktemp
          "att-"
          nil
          ".txt"
        )
    )
    (setq f (open fn "w"))
    )
     (progn (foreach x l
         (write-line x f)
       )
       (if   f
         (close f)
       )
       (vl-cmdf "_START" (strcat "EXCEL " fn))
     )
     (princ "\nInvalid block selections!")
  )
  (princ)
)

dexus

  • Bull Frog
  • Posts: 208
Re: Extract Attributes and handle in a massive way
« Reply #6 on: January 03, 2023, 04:10:44 AM »
I found this lisp but i get this: error: no function definition: ATT:SORT, can you help me correct this error?

[...]
I tried googling it and found the att:sort function here: https://www.cadtutor.net/forum/topic/70324-export-attribute/#comment-564680