Results 1 to 9 of 9

Thread: batch bursting blocks in multiple layouts

  1. #1
    Member
    Join Date
    2010-01
    Posts
    4

    Default batch bursting blocks in multiple layouts

    Hello,

    I am trying to make a simple script to use with scriptpro to batch burst drawings and then to purge them. The problem that arises is that using the burst command in autocad, is that it only bursts the blocks in the current space. Is there a way to burst all the blocks that are located in the model space and multiple layouts (entire drawing)? I have been using autocad for a long time but never worked with lisps so i would appreciate it if anyone knows of a simple way of doing it?

    Just to clarify the problem i can get the script to batch burst the model space and one layout with the tilemode command but have no luck with drawings with multiple layouts.

    A simple LISP would help that i could incorporate in the script.

    Thanks for the eventual help and comments

  2. #2
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: batch bursting blocks in multiple layouts

    Welcome to AUGI & congrats on your 1st post.

    You'll need to use a few lisp functions inside your SCR file. Mainly it would be the layoutlist, foreach, command and setvar functions. I'll try to show you what happens by commenting on each line (the comments start with a semi-colon). Please remove the comments if you place the code directly inside the SCR file, otherwise it won't work. Or save it in a LSP file and then simply have the SCR with a line of the following:
    Code:
    (load "C:\\Path\\FileName.LSP")
    Where FileName.LSP is the file where you save the code. And Path it where it's located (please note you need double backslashes in lisp). Or save the LSP file in one of the support folders and simply have (load "FileName.LSP").

    The code should be something like this:
    Code:
    ;;Ensure Model space is shown
    (setvar "TILEMODE" 1)
    ;;Issue the Burst command and pass the argument to select all, 
    ;;then an enter.
    (command "BURST" "All" "")
    ;;Step through all layouts. The lay is a variable (could be 
    ;;called anything), which is assigned each of the values in 
    ;;the (layoutlist) list in turn.
    ;;Then the following lines are executed for each value
    (foreach lay (layoutlist)
      ;;Change to the layout named in the lay variable by changing CTAB
      (setvar "CTAB" lay)
      ;;Again issue the Burst command for each layout
      (command "BURST" "All" "")
    ) ;End of the foreach loop
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  3. #3
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: batch bursting blocks in multiple layouts

    Oh damm ... just tested. The Burst command is a command formed through Lisp, so you can't call it using the lisp's command call - it simply gives an error of [BURST Unknown command "BURST". Press F1 for help.]

    You'll need to use ActiveX to send the keystrokes to AutoCAD unfortunately. So the LSP code should rather look like this (additions / modifications marked in red):
    Code:
    ;;Ensure the VLisp extensions are loaded to use the vl functions
    (vl-load-com)
    ;;Get the ActiveX object of the current DWG
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
    ;;Ensure Model space is shown
    (setvar "TILEMODE" 1)
    ;;Issue the Burst command and pass the argument to select all, 
    ;;then an enter.
    (vla-SendCommand doc "BURST\nAll\n\n")
    ;;Step through all layouts. The lay is a variable (could be 
    ;;called anything), which is assigned each of the values in 
    ;;the (layoutlist) list in turn.
    ;;Then the following lines are executed for each value
    (foreach lay (layoutlist)
      ;;Change to the layout named in the lay variable by changing CTAB
      (setvar "CTAB" lay)
      ;;Again issue the Burst command for each layout 
      (vla-SendCommand doc "BURST\nAll\n\n")
    ) ;End of the foreach loop
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  4. #4
    Member
    Join Date
    2010-01
    Posts
    4

    Default Re: batch bursting blocks in multiple layouts

    Hello,

    Thanks for helping, but i am running into some problems. I copied the code into notepad and saved it as a .lsp and when i run it, it seems to only burst the last layout without bursting the model space or the previous layouts. I am testing the .lsp in a drawing i made with 2 layouts and only the blocks located in the last tab burst.

    More help would be greatly appreciated. Thanks!

  5. #5
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: batch bursting blocks in multiple layouts

    Aaaggghhh ... sorry ... I forgot that vla-SendCommand is asynchronous. That means the command is sent to ACad, but the rest of the Lisp runs without waiting for the command to finish.
    ...Back to square one ...

    Another way would be to modify the Burst command to be callable from lisp without sending the command BURST. Unfortunately I can't copy that file to AUGI as there's copyright on it. I could explain how you can edit it though:

    1. Open the Burst.LSP file under the Express folder under your AutoCAD program folder. E.g. mine's at C:\Program Files\AutoCAD 2008\Express. You can open it with Notepad, or preferably ACad's VLIDE command.

    2. Very important ... first save as to a new file, e.g. Burst1.LSP

    3. Change the line starting with (defun C:BURST (it should be the 27th line) to the following (changes marked in red);
    Code:
    (Defun BURST (SS1 / item bitset bump att-text lastent burst-one burst
                      BCNT BLAYER BCOLOR ELAST BLTYPE ETYPE PSFLAG ENAME EDATA)
    4. Scroll down to near the end, there should be a portion starting with
    Code:
       ;-----------------------------------------------------
       ; BURST MAIN ROUTINE
       ;-----------------------------------------------------
    5. Comment out the (Defun BURST (/ SS1) by placing a semi-colon (; ) just before it. Also comment out its closing parenthesis, the one just before:
    Code:
       ;-----------------------------------------------------
       ; BURST COMMAND
       ;-----------------------------------------------------
    6. Comment out the (Setq SS1 (SsGet ...... line as well. It should be 5 lines below the line you first commented out in 5 above.

    7. Add the following just before the (BURST-ONE ENAME) line. It should be 9 lines below the comment out in 6 above.
    Code:
                  (setq EDATA (entget ENAME))
                  (if (and (= (cdr (assoc 0 EDATA)) "INSERT")
                           (= (cdr (assoc 67 EDATA)) PSFLAG)
                           )
    8. Place a closing parenthesis ) just after the (BURST-ONE ENAME) line mentioned in 7 above.

    9. Save the file

    10. Now open the LSP you made already and change it to the following:
    Code:
    ;;Load the modified burst lisp
    (load "Burst1.LSP")
    ;;Ensure Model space is shown
    (setvar "TILEMODE" 1)
    ;; Get a selection set of all objects in the Model space
    (setq ss (ssget "X" '((410 . "Model"))))
    ;;Call the Burst function and pass the selection set
    (BURST ss)
    ;;Step through all layouts. The lay is a variable (could be 
    ;;called anything), which is assigned each of the values in 
    ;;the (layoutlist) list in turn.
    ;;Then the following lines are executed for each value
    (foreach lay (layoutlist)
      ;; Clear the selection set
      (setq ss nil)
      ;; Free ram resources
      (gc)
      ;;Change to the layout named in the lay variable by changing CTAB
      (setvar "CTAB" lay)
      ;;Get a selection set of entities on the current tab
      (setq ss (ssget "X" (list (cons 410 (getvar "CTAB")))))
      ;;Again call the Burst function and pass the selection set
      (BURST ss)
    ) ;End of the foreach loop
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  6. #6
    Member
    Join Date
    2010-01
    Posts
    4

    Default Re: batch bursting blocks in multiple layouts

    I would really like to thank u for helping me out.

    But once again and I hope i am not annoying you with this lsp but after trying the new code i get:

    /
    no function definition: BURST

    I double checked everything actually tried it three times and i get the same thing every time.

    If you still got the will more help would be greatly appreciated

    Thanks!

  7. #7
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: batch bursting blocks in multiple layouts

    OK sorry, I forgot one place to comment out. In the BURST1.LSP file, right at the end just after:
    Code:
       ;-----------------------------------------------------
       ; BURST COMMAND
       ;-----------------------------------------------------
    There should be a line containing only (BURST). Comment it out to look like this:
    Code:
    ;(BURST)
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  8. #8
    Member
    Join Date
    2010-01
    Posts
    4

    Thumbs up Re: batch bursting blocks in multiple layouts

    Thanks for your time and effort it works great!

    THANKS!

  9. #9
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: batch bursting blocks in multiple layouts

    It's a pleasure, at last I could give you something which works
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

Similar Threads

  1. Multiple layouts in R14?
    By jaberwok in forum CAD Management - General
    Replies: 11
    Last Post: 2010-05-27, 07:30 PM
  2. Multiple layouts vs Multiple drawing files
    By mmilko.83044 in forum CAD Standards
    Replies: 26
    Last Post: 2009-06-12, 05:15 PM
  3. Multiple Layouts or Just One
    By noah in forum AutoCAD Sheet Set Manager
    Replies: 8
    Last Post: 2007-09-05, 06:08 PM
  4. Batch Plotting DWG files containing multiple Layouts
    By sudhirkizhakoote in forum AutoCAD Plotting
    Replies: 2
    Last Post: 2007-03-15, 07:40 AM
  5. AutoCAD 2007 LT - Using Publish command to batch plot Layouts
    By voineavlad in forum AutoCAD LT - General
    Replies: 7
    Last Post: 2006-08-09, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •