Results 1 to 6 of 6

Thread: Help modifying existing LiSP (NestedBurst)

  1. #1
    Member
    Join Date
    2012-06
    Posts
    12
    Login to Give a bone
    0

    Default Help modifying existing LiSP (NestedBurst)

    Hi everyone,

    I found this great LiSP by Lee Mac, it does exactly what I am looking for but I would like to modify it to use in a larger LiSP that I am writing. I looking to have the LiSP select ALL blocks without prompting the user to select anything and then run the LiSP as it normally would. I have been playing with it and got it to work... sort of... With the modification below I can get it to select all the blocks and run but the command will produce this: "*Invalid selection* Expects a point or Last/ALL/Group" a couple of times and then ask to select object again. But it DOES burst all the blocks in the entire drawing in model and all layout tabs. I just need to get it to stop producing that error and to not ask for selection again after running.

    The full LiSP is attached for reference.

    I hope I made sense. Thank you in advance.

    Original code by Lee Mac:
    Code:
    (defun c:nburst ( / *error* idx sel )
    
    
        (defun *error* ( msg )
    
            (LM:endundo (LM:acdoc))
    
            (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
    
                (princ (strcat "\nError: " msg))
    
            )
    
            (princ)
    
        )
    
        (LM:startundo (LM:acdoc))
    
        (if
    
            (setq sel
    
                (LM:ssget "\nSelect blocks to burst: "
    
                    (list "_:L"
    
                        (append '((0 . "INSERT"))
    
                            (
    
                                (lambda ( / def lst )
    
                                    (while (setq def (tblnext "block" (null def)))
    
                                        (if (= 4 (logand 4 (cdr (assoc 70 def))))
    
                                            (setq lst (vl-list* "," (cdr (assoc 2 def)) lst))
    
                                        )
    
                                    )
    
                                    (if lst (list '(-4 . "<NOT") (cons 2 (apply 'strcat (cdr lst))) '(-4 . "NOT>")))
    
                                )
    
                            )
    
                            (if (= 1 (getvar 'cvport))
    
                                (list (cons 410 (getvar 'ctab)))
    
                               '((410 . "Model"))
    
                            )
    
                        )
    
                    )
    
                )
    
            )
    
            (repeat (setq idx (sslength sel))
    
                (LM:burstnested (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
    
            )
    
        )
    
        (LM:endundo (LM:acdoc))
    
        (princ)
    
    )
    
    
    ;; Burst Nested  -  Lee Mac
    
    ;; Bursts the supplied block & all nested blocks found within.
    
    ;; obj - [vla] VLA Block Reference Object
    
    
    (defun LM:burstnested ( obj / cmd col ent lay lin lst qaf tmp )
    
        (if
    
            (and
    
                (= "AcDbBlockReference" (vla-get-objectname obj))
    
                (vlax-write-enabled-p obj)
    
                (or (and (LM:usbl ... (Code continues...)
    
    Section I modified to select all and that sort of works:
    Code:
    
    (defun c:nburst ( / *error* idx sel )
    
    
        (defun *error* ( msg )
    
            (LM:endundo (LM:acdoc))
    
            (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
    
                (princ (strcat "\nError: " msg))
    
            )
    
            (princ)
    
        )
    
        (LM:startundo (LM:acdoc))
    
        (if
    
            (setq sel
    
                (ssget "_X" (list (cons 0 "INSERT")))
    
            )
    
            (repeat (setq idx (sslength sel))
    
                (LM:burstnested (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
    
            )
    
        )
    
        (LM:endundo (LM:acdoc))
    
        (princ)
    
    )
    
    
    ;; Burst Nested  -  Lee Mac
    
    ;; Bursts the supplied block & all nested blocks found within.
    
    ;; obj - [vla] VLA Block Reference Object
    
    
    (defun LM:burstnested ( obj / cmd col ent lay lin lst qaf tmp )
    
        (if
    
            (and
    
                (= "AcDbBlockReference" (vla-get-objectname obj))
    
                (vlax-write-enabled-p obj)
    
                (or (and (LM:usbl .... (Code continues...)
    
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help modifying existing LiSP (NestedBurst)

    Please show us the whole modified LISP and the DWG where do you apply it.

  3. #3
    Member
    Join Date
    2012-06
    Posts
    12
    Login to Give a bone
    0

    Default Re: Help modifying existing LiSP (NestedBurst)

    The complete LiSP is attached to the thread and the drawing does not matter. Any drawing with any number of blocks.

  4. #4
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help modifying existing LiSP (NestedBurst)

    Ok , if it is your will. ........

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Help modifying existing LiSP (NestedBurst)

    If you check Lee Mac's code "LM:ssget" does more that "ssget".
    In his code try replacing:
    Code:
                (LM:ssget "\nSelect blocks to burst: "
                    (list "_:L"
                        (append '((0 . "INSERT"))
                            (
                                (lambda ( / def lst )
                                    (while (setq def (tblnext "block" (null def)))
                                        (if (= 4 (logand 4 (cdr (assoc 70 def))))
                                            (setq lst (vl-list* "," (cdr (assoc 2 def)) lst))
                                        )
                                    )
                                    (if lst (list '(-4 . "<NOT") (cons 2 (apply 'strcat (cdr lst))) '(-4 . "NOT>")))
                                )
                            )
                            (if (= 1 (getvar 'cvport))
                                (list (cons 410 (getvar 'ctab)))
                               '((410 . "Model"))
                            )
                        )
                    )
                )
    with:
    Code:
                (LM:ssget "X" '((0 . "INSERT") (410 . "Model")))

  6. #6
    Member
    Join Date
    2012-06
    Posts
    12
    Login to Give a bone
    0

    Default Re: Help modifying existing LiSP (NestedBurst)

    Hey Tom,

    Thank you for your suggestion, I have tried it and it does not seem to work. All I get is:

    Command:
    :: NestedBurst.lsp | Version 1.1 | © Lee Mac 2017 www.lee-mac.com ::
    :: Type "nburst" to Invoke ::
    Command:
    Command: NBURST
    X

    Command:

    I notice if I change:
    Code:
    (LM:ssget "X" '((0 . "INSERT") (410 . "Model")))
    to the following:
    Code:
    (ssget "X" '((0 . "INSERT") (410 . "Model")))
    it works but only for model space. I need it to ultimately do model and all layouts as well.

    If I modify it to this:
    Code:
    (ssget "X" '((0 . "INSERT")))
    it will do model and all layout tabs but then once complete, it asks again to select object.

    Any suggestions would be greatly appreciated.
    Last edited by David Prontnicki; 2017-04-03 at 02:56 PM.

Similar Threads

  1. Help modifying a lisp
    By Gary.182361 in forum AutoLISP
    Replies: 9
    Last Post: 2010-01-04, 03:23 AM
  2. Replies: 1
    Last Post: 2009-12-06, 01:43 AM
  3. Extracting and modifying URL's in Lisp
    By Bill.Longhurst in forum AutoCAD Customization
    Replies: 1
    Last Post: 2008-01-15, 05:25 PM
  4. Replies: 4
    Last Post: 2007-06-29, 08:29 PM
  5. Replies: 1
    Last Post: 2006-12-15, 05:24 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
  •