Code Red > AutoLISP (Vanilla / Visual)

Create a legend from block in the DWG?

<< < (2/3) > >>

RbtDanforth:
I wrote this little ditty many years ago for v11, I think, but it would read a space delimited text file and fill out the Bom.

--- Code: ---(defun ABOM_err (st)                    ; If an error (such as CTRL-C) occurs
                                      ; while this command is active
    (if (/= st "Function cancelled")
    (princ (strcat "\nError: " st))
  )
  (if (= (type FLN) 'FILE)
    (close FLN)
  )
  (setq FLN nil)
  (setq *error* olderr)               ; Restore old *error* handler
  (princ)
)


(defun C:ABOM (/ FLN B B1 B2 B3 TB SC olderr);
    (Setvar "CMDECHO" 0)
       (setq olderr *error*
        *error* BINS_err)
     (SETQ FLN (open (getstring "Bom list [inc ext] ?  ")"r")
           B (READ-LINE FLN)
           TB (ENTGET(SSNAME (SSGET "X"(LIST(CONS 2 "SHEET*")))0))
           SC (CDR (ASSOC 41 TB))
           ST (GETPOINT "\nSTARTPOINT\t")
           NUM(GETINT "\nSTART INT\t")
                   )
            (WHILE B (PROGN (SETQ B1 (SUBSTR B 4 2)
                                  B2 (SUBSTR B 8 42)
                                  B3 (SUBSTR B 51 10)
                                  )
                   (command ".insert" "BOM" "R" 0 "S" SC ST NUM  B1 B2 B3 )
                   (SETQ B (READ-LINE FLN)
                         NUM (1+ NUM)
                         ST (POLAR ST (/ PI 2)(* 0.209 SC))
                   )
                       ) ); WH
          (CLOSE FLN)  (Setvar "CMDECHO" 1)
(setq *error* olderr)
    'dUN
)



--- End code ---

I used an errror trap here because otherwise it would leave the file open, if it died mid stream. You will note some distances etc that were specific to the block and attributes used.

I had it tied to another routine that would write script files and add the bom to each sheetin a semi auto fashion but it has been too long to remember all the details.

If I find the routine that made the lists from the Boms I will post it.

Kerry:
hornet 103 ,
can you be a little more specific regarding your requirements.

Do you actually want the attributes ?
Do you want to extract one block's attributes, ar several. ?
is any additional processing of the data required or use the raw data. ?
Which Acad Version ie; do you have the 'Table' graphical object available ?
If so, have you played with fields ?


Serge J. Gianolla:

--- Quote from: Kerry Brown on March 31, 2006, 08:45:16 PM ---
--- Quote from: Serge J. Gianolla on March 31, 2006, 08:07:32 PM ---
If you can put your hands on a book titled MAXIMISING AutoCAD: Inside AutoLISP, by J. Smith and R. Gesner published circa 1990.  ...............
--- End quote ---

I had my copy returned to me this week ... after 6 years separation .. < along with 5 others > great learning book Serge !

--- End quote ---

Somehow I knew you would. I did notice some of it in partial codes :-)
I can't remember what was the story behind but I have 2 copies. You should have asked me one, you ain't too far! :wink:

Kerry:
... or were you after this sort of thing ??

Kerry:

--- Quote from: Serge J. Gianolla on March 31, 2006, 09:02:21 PM ---.....  I did notice some of it in partial codes :-)
 .....
--- End quote ---
Yep, Rusty Gesner , Tony Tanzillo and Reni Urban have a lot to answer for  :lol:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version