How to burst block attributes to text?

 How can I do this in Bricscad? In AutoCAD there is Express tools command BURST doing this work.

Comments

  • http://www.lee-mac.com/lisp/BurstUpgraded.lsp
    would do the job, but sadly doesn't run on linux yet (crashes BricsCAD with several function calls).
    I did receive information that many of the missing vla(x) functions have meanwhile been integrated into the code, but god knows when Bricsys will decide it's finally time for a bugfix release.
    Doing the job in plain old lisp wouldn't be hard, but I never saw a necessity to do so. I'm sure others did, but it might not be easy to find old stuff like this via google nowadays...
  •  Thank you for your answer. I already filled a bugreport about missing vla- functions necessary for another script (exporter to Blender) and I have positive feedback from Bricsys, missing functions should be in next Linux release. It may also cover this script as well. If not, they will add missiong functions upon a bugreport.
  • Hi Vaclav,

    here is an autolisp routine i wrote that works without  vla- functions (activeX).
    It should do the job under Linux...

    [code]
    ******************** att2text  ********************************

    (defun c:att2text   ( / ssbl cnt en eL )

     ; select all Blocks and set a loop counter
     (setq ssbl (ssget  (list (cons 0 "INSERT")(cons 66 1)))
           cnt 0
           )
     
     ;loop through all selected blocks...
     (repeat (sslength ssbl)

      ; get Block entity list
      (setq en (ssname ssbl cnt)
              en (entnext en) ; get first attribute
              el (entget  en)
            )
     
      ; loop through all attributes of this Block Reference...
      (while (not (equal (cdr (assoc 0 el)) "SEQEND"))
       
       (entmake (list '(0 . "TEXT")
              '(100 . "AcDbEntity")
              '(100 . "AcDbText")
               (cons 1  (cdr (assoc 1  el)) ) ; txt-string
               (cons 7  (cdr (assoc 7  el)) ) ; style
               (cons 10 (cdr (assoc 10 el)))
                       ;(cons 11 pt2) optional meaningful ONLY if 72 or 73 NON ZERO !
               (cons 40 (cdr (assoc 40 el)) ) ; txt-height
               (cons 72 (cdr (assoc 73 el)))  ; h-just
               (cons 73 (cdr (assoc 74 el)))  ; v-just
                      )
          ); entmake

       ; find next attribute entity list for this Block Reference...
          (setq en (entnext en)
                el (entget  en)
             )
         ); loop attributes...
     
      ; go to next block reference...      
      (setq cnt (1+ cnt))
      );repeat blocks...
     
     ); defun
    [/code]

    Regards
    Konstantin
  •  Thank you, Konstantin, but I'am getting following error when I try to use it:

    [code]
    : att2text
    Select entities: 
    Entities in set: 1
    Select entities: 

    ; ----- LISP : Call Stack -----
    ; [0]...C:ATT2TEXT <<--</div>
    ;
    ; ----- Error around expression -----
    (VLE-CDRASSOC 74 EL)
    ;
    ; error : bad argument type <(72)> ; expected at [DXF/XED DATA]
    :
    [/code]
  • Hi Vaclav,
    try to uncomment the first line of the routine (it's my fault) by inserting a semocolon ";" or delete it.
    from 
    ******************** att2text  ********************************to
    ; ******************** att2text  ********************************
    and try again.
    If the problem persists then could you please attach the DWG with some of the blocks
    that generate the problem
    We'll then examine it further !
  •  I'am getting the same result:

    [code]
    : _appload
    Loading /home/disnel/Bricsys/MySupport/att2text.lsp
    : (LOAD "/home/disnel/Bricsys/MySupport/att2text.lsp")C:ATT2TEXT
    : att2text
    Select entities: 
    Entities in set: 1
    Select entities: 

    ; ----- LISP : Call Stack -----
    ; [0]...C:ATT2TEXT <<-- </div>
    ;
    ; ----- Error around expression -----
    (VLE-CDRASSOC 74 EL)
    ;
    ; error : bad argument type <(72)> ; expected at [DXF/XED DATA]
    [/code]

    I'am trying it with this small dwg.

    att2text.dwg

  •  And I have a question about forums, I'am trying to insert something between [code] tags, but, as you can see, it is placed outside of them. At first post it may be my mistake, but second time I was careful about it a the result is same??
  • please uncomment the following lines and try again ...
    .....
     ; (cons 72 (cdr (assoc 73 el)))  ; h-just  
    ; (cons  73 (cdr (assoc 74 el)))   ; v-just
  • Now it works. But It does not "explode" the block, it only add attributes content as text and when I explode the block later I'll get two overlaying texts.

    But if it cannot be done better, I can live with it, I need it only for exporting to Blender.

    att2text.lsp

  • add these 2 lines in bold at the end of the routine just before the last line...
    ...........
    );repeat blocks...  (command "_explode" ssbl )
      (command "_erase"  (ssget "X" (list (cons 0 "ATTDEF")))  "" )  
     ); defun

    now the blocks are exploded like you want ...

     
  •  Great, now it works like charm ;-). Thank you. Perhaps I should learn LISP ;-)
  • @ Konstantin:
    Great! Will probably come in handy sooner or later, may thanks.
    @ Vaclav:
    Instead of exploding and deleting, optionally resetting the attribute to an empty value might be more elegant.
    You could also add the width factor to more closely match the attributes visually:
    [code]
    (defun c:att2text   ( / ssbl cnt en eL repl)
     ; select all Blocks and set a loop counter
     (setq ssbl (ssget  (list (cons 0 "INSERT")(cons 66 1)))
           cnt 0
           )
      (initget "R A")
      (if ssbl
       (if (= (getkword "\nReplace attributes with text / Add text (Replace): ") "A")
        (setq repl NIL)
        (setq repl T)
       )
       (exit)
      )

     ;loop through all selected blocks...
     (repeat (sslength ssbl)
      ; get Block entity list
      (setq en (ssname ssbl cnt)
              en (entnext en) ; get first attribute
              el (entget  en)
            )

      ; loop through all attributes of this Block Reference...
      (while (not (equal (cdr (assoc 0 el)) "SEQEND"))
       (entmake (list '(0 . "TEXT")
              '(100 . "AcDbEntity")
              '(100 . "AcDbText")
               (cons 1  (cdr (assoc 1  el)) ) ; txt-string
               (cons 7  (cdr (assoc 7  el)) ) ; style
               (cons 10 (cdr (assoc 10 el)))
                       ;(cons 11 pt2) optional meaningful ONLY if 72 or 73 NON ZERO !
               (cons 40 (cdr (assoc 40 el)) ) ; txt-height
               (cons 41 (cdr (assoc 41 el)) ) ; txt-width
               ;(cons 72 (cdr (assoc 73 el)))  ; h-just
               ;(cons 73 (cdr (assoc 74 el)))  ; v-just
                      )
       ); entmake
       (if repl
        (progn
         (setq el (subst (cons 1 "") (assoc 1 el) el)) ; empty the attribute value
         (entmod el)
        )
       )
       ; find next attribute entity list for this Block Reference...
          (setq en (entnext en)
                el (entget  en)
             )
         ); loop attributes...

      ; go to next block reference...
      (setq cnt (1+ cnt))
      );repeat blocks...

     ); defun[/code]
  • @Knut: This works visually better, but when I explode the block later (and I will before export to Blender), I'll get XXXX from block attributes. I want it to work like explode command but retain attribute values.

    However idea with width is good, I added it to the script from Konstantin.
  • Ah, I see - the default dxf importer in 2.67 still doesn't handle blocks... I guess the one by Migius will work flawlessly (as in 2.49), but I didn't buy it yet, since I found the conditions somewhat strange.
     
    Looks as if my small alteration uncovered another bug: if you save the file as dxf after running the routine, the written file has the result, but if you then select the blocks in the original file, the attribute values are back again... or maybe I forgot something (added an entupd, but to no avail), anyway I'm too lazy to file a SR for this.
  • I am glad that everything works as wished !
    Knut thanks for the alternative and for adding the code 41 for text width...
  • @ Knut> On Blenderartist is a thread about LISP script for exporting to Blender: http://blenderartists.org/forum/showthread.php?267990-Direct-Autocad-Intellicad-to-Blender-exporter-LISP-to-Download. This script I mentioned in my second post here.

    As for SR, if I should inspect and report every crash or flaw I meet in Bricscad, I'll have no time for work ...
  • @ Vaclav:
    Yes I know - both about the script and about the flaws.
    As to the .obj exporter script, I filed a SR in January to point Bricsys to this, but didn't follow for a while, since  - as you mentioned - it does not yet run on linux. Just had a look at the thread again, and I'm really happy to see that Torsten Moses jumped in and offered the author developer status. These are the things that keep my faith in this product...
    As to the flaws, I try to repeat wherever I can that the next Linux release should be 13.1.20, not 13.2.X, let alone 14.X.X; and that the only real solution would be to split development into a stable and a WIP branch.
  •  I filled SR about this script as well and I have reply from Bricsys, that necessary LISP functions will be in next release.

    By my opinion, you are right with stable and development branch, but with one exception: I really want to be able work with up to date DWG version, this is R2013 now and 13.1. branch of BC does not work with this version.
This discussion has been closed.