Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 40

Thread: Convert Explode command to Burst command?

  1. #21
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by BlackBox View Post
    I'm confused.

    If you want to cull the source LISP code so that your routine is not dependent on the source being loaded prior to your code's invocation, that's your choice, but as Tom has already reiterated, it's unnecessary... All you need (once the source has been loaded for that Document) is to call SSSETFIRST prior to your Command call of BURST (as is already shown in this thread twice)... It's really not this complicated.
    You are very right. However, each version I've tried still returns an error. So I'm really just trying each suggestion offered. So far, I' haven't made any progress. I'm understanding each set of code, but not why it doesn't work. Whether I make my selection using SSSETFIRST then issue the BURST command, or hack away and modify the BURST.lsp to accept an argument, I still error out.

    Basically, I see two methods suggested to use BURST instead of EXPLODE on my selection.

    The first and simplest, using the SSSETFIRST method and calling the Burst.lsp externally:
    Code:
           (foreach obj
    		  (load "burst.lsp")
    		  (sssetfirst nil tmp)
    		  (c:burst)
                    )
    But returns:
    Code:
    Error: bad argument type: consp
    The second, converting the burst.lsp into a subroutine, nested in the main code, and called by supplying an argument:
    Code:
           (foreach obj
    		  (_burst2 (vlax-vla-object->ename tmp))
                    ) ;; end foreach
    But returns the same thing:
    Code:
    Error: bad argument type: consp
    It seems either option does essentially the same thing (I agree tthe first is easier), but I can't figure out the error.
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

  2. #22
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,538
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by stusic View Post
    ... So I'm really just trying each suggestion offered. So far, I' haven't made any progress. I'm understanding each set of code, but not why it doesn't work. Whether I make my selection using SSSETFIRST then issue the BURST command, or hack away and modify the BURST.lsp to accept an argument, I still error out.

    ...

    The first and simplest, using the SSSETFIRST method and calling the Burst.lsp externally:
    Code:
           (foreach obj
    		  (load "burst.lsp")
    		  (sssetfirst nil tmp)
    		  (c:burst)
                    )
    But returns:
    Code:
    Error: bad argument type: consp
    Backing up for a moment, we all know the code works OOTB, which might suggest that you're unintentionally supplying an invalid argument.

    For starters, you're missing a list argument in your foreach statement above, and there's no need to load "burst.lsp" for each item iterated... Further, I'm not seeing how you transition from obj to tmp, but you need only call the burst command once on an implied selection, and not for each-and-every item.

    At the risk of being redundant, please consider simply:
    Code:
    (if (not c:burst) (load "burst.lsp"))
    ;; define ss
    (sssetfirst nil ss)
    (c:burst)
    Last edited by BlackBox; 2013-06-18 at 05:52 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3630, Core i9-9900K 5.0GHz, 128GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  3. #23
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by BlackBox View Post
    Backing up for a moment, we all know the code works OOTB, which might suggest that you're unintentionally supplying an invalid argument.

    For starters, you're missing a list argument in your foreach statement above, and there's no need to load "burst.lsp" for each item iterated... Further, I'm not seeing how you transition from obj to tmp, but you need only call the burst command once on an implied selection, and not for each-and-every item.

    At the risk of being redundant, please consider simply:
    Code:
    (if (not c:burst) (load "burst.lsp"))
    ;; define ss
    (sssetfirst nil ss)
    (command "burst")
    Unless something has changed in a more recent version than 2011, burst is a lisp routine, so (command "burst") must be replaced with (c:burst).
    Civil 3D 2017 ~ Windohz 7
    Dropbox

  4. #24
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,538
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by alanjt View Post
    Unless something has changed in a more recent version than 2011, burst is a lisp routine, so (command "burst") must be replaced with (c:burst).
    Apologies for the confusion... You are correct, from 2013/2014:
    Code:
    Command: (command "burst")
    burst Unknown command "BURST". Press F1 for help.
    Command: nil
    ... Code corrected above.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3630, Core i9-9900K 5.0GHz, 128GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  5. #25
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by BlackBox View Post
    Apologies for the confusion... You are correct, from 2013/2014:
    Code:
    Command: (command "burst")
    burst Unknown command "BURST". Press F1 for help.
    Command: nil
    ... Code corrected above.
    No worries.
    TBH, I'm still a fan of ripping out what one might need from burst.lsp and writing it out as a subroutine. It's just cleaner and less prone to issues. While I have used the method myself, I'm not a fan of it, if it can be avoided.
    Civil 3D 2017 ~ Windohz 7
    Dropbox

  6. #26
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by BlackBox View Post
    For starters, you're missing a list argument in your foreach statement above, and there's no need to load "burst.lsp" for each item iterated...
    I saw the multiple loads, but I just left it in there while I'm testing.

    Not really sure about the list argument - I had used it with the original 'explode (to explode each insertion of the block "M-GROUP-CSC-XML") and it worked just fine... Am I missing something?

    Quote Originally Posted by BlackBox View Post
    Further, I'm not seeing how you transition from obj to tmp, but you need only call the burst command once on an implied selection, and not for each-and-every item.
    See, I thought I would need to, to burst each instance of the block...
    EDIT: The exploded instances of tmp become obj, right?

    Quote Originally Posted by BlackBox View Post
    At the risk of being redundant, please consider simply:
    Code:
    (if (not c:burst) (load "burst.lsp"))
    ;; define ss
    (sssetfirst nil ss)
    (command "burst")
    Using that snippet verbatim (except c:burst as noted), I at least get a different error:
    Code:
    Error: bad argument type: lselsetp #<VLA-OBJECT IAcadBlockReference2 000000009109e8b8>
    I'm going mad. Some ways I get an error for not supplying a list (consp), some ways I get an error for not supplying an entity, now an error for not supplying a selection set (lselsetp).
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

  7. #27
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,401
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by stusic View Post
    Excuse my ignorance, but we're wading out into the deep end of the pool. I'm not sure why I can't supply the tmp variable as the ename (I'm unclear of the difference). Here's my tmp variable:

    Code:
    (setq tmp 							;; VLA Block Reference object
                (vla-insertblock
                  spc 							;; Modelspace object
                  (vlax-3d-point ins) 					;; Insertion point
                  "M-GROUP-CSC-XML"   				;; Block name
                  1.0 1.0 1.0 0.0           				;; (Scale=1:1, Rotation=0.0)
                  ) ;; end vla-insertblock
                    )
    And here's my code as it stands now. I guess I need to know how to convert my selection set (of one block) to a single entity. Would I do this through somethign like this: (ssname tmp 0) ?

    Code:
          (foreach obj
    		  (_burst2 tmp)
                        )
    But get:
    Code:
    Nested error trapping used incorrectly.
    Resetting nesting index to 1.
    bad argument type: lentityp #<VLA-OBJECT IAcadBlockReference2 0000000082beed18>
    Quote Originally Posted by stusic View Post
    You are very right. However, each version I've tried still returns an error. So I'm really just trying each suggestion offered. So far, I' haven't made any progress. I'm understanding each set of code, but not why it doesn't work. Whether I make my selection using SSSETFIRST then issue the BURST command, or hack away and modify the BURST.lsp to accept an argument, I still error out.

    Basically, I see two methods suggested to use BURST instead of EXPLODE on my selection.

    The first and simplest, using the SSSETFIRST method and calling the Burst.lsp externally:
    Code:
           (foreach obj
    		  (load "burst.lsp")
    		  (sssetfirst nil tmp)
    		  (c:burst)
                    )
    But returns:
    Code:
    Error: bad argument type: consp

    It seems either option does essentially the same thing (I agree tthe first is easier), but I can't figure out the error.
    Both sssetfirst & burst are expecting a selection set. Try using:
    Code:
     (setq ss (ssadd))
    (ssadd tmp ss)
    (sssetfirst nil ss)
    (c:burst)
    Tom Beauford P.S.M. - Civil 2020 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  8. #28
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by Tom Beauford View Post
    Both sssetfirst & burst are expecting a selection set. Try using:
    Code:
     (setq ss (ssadd))
    (ssadd tmp ss)
    (sssetfirst nil ss)
    (c:burst)
    Code:
    Error: bad argument type: consp <Selection set: 5f10>
    Here's the whole shebang if it can help:

    Code:
    (foreach com (xins:massoc "compressor" lst) 			;; For the contents of every <compressor> tag in the <rack>
    		   
    
                      ;; Insert Block at insertion point 'ins'
      		
                    (setq tmp 							;; VLA Block Reference object
                        (vla-insertblock
                            spc 							;; Modelspace object
                            (vlax-3d-point ins) 					;; Insertion point Safearray Variant
                            "M-GROUP-CSC-XML"   					;; Block name (exists in drawing as tested earlier)
                            1.0 1.0 1.0 0.0     					;; (Scale=1:1, Rotation=0.0)
                        ) ;; end vla-insertblock
                    ) ;; end setq
                    
                    (cond
    
    		    ;;----------------------------------------------------------------------;;
                        
                        ;; Condition
                        (   (null (setq mod (xins:assoc "model" com))) ;; Contents of <model> tag
                            ;; Notify user of such:
                            (princ
                                (strcat
                                    "\nModel Number not found for Compressor located at "
                                    (xins:lst->str (mapcar 'rtos ins) ",") 				;; Include insertion point of Compressor for clarity
                                ) ;; end strcat
                            ) ;; end princ
                        ) ;; end condition
    
    		    ;;----------------------------------------------------------------------;;
    		    		    		    
                        ;; Condition
                        (   (and
    			     (setq csg (xins:assoc "suction_group" com))				;; Finds suction group of compressor
    			     (< (atoi (cadr (assoc csg rsg))) 0)					;; Sees if suction group is LT ot MT
    			     (or (= (setq csf (xins:assoc "suction_shell" com)) "NONE")			;; Determines suction filter per comp
    				 (= (setq csf (xins:assoc "suction_shell" com)) nil)
    				 )
    			)
    
                           ;; Set visibility state of block accordingly:
    			(vla-put-activelayer
      				(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
      				(vla-item (vla-get-layers acdoc) "M-PIPING-INS-1-0")
    				)
                            (xins:setvisibilitystate tmp "DIP TUBE")					 ;; Sets the visibility state
                        ) ;; end condition
    
                        ;;----------------------------------------------------------------------;;
    		 
                    ) ;; end cond
    
                    ;; For every exploded block component...
                    (foreach obj
    ;;;		  (vlax-invoke tmp 'explode) ;; Explode the block
    		  (setq ss (ssadd))
    		  (ssadd tmp ss)
    		  (sssetfirst nil ss)
    		  (c:burst)
                    ) ;; end foreach
                    
    	        (vla-delete tmp) ;; Delete the original block (since the explode method retains the original)
    		(setq ins (mapcar '+ ins '(12.3933 0.0 0.0))) ;; Shift the insertion point by a given vector
                )
    I really do appreciate all the help. Really.
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

  9. #29
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by stusic View Post
    Code:
    Error: bad argument type: consp <Selection set: 5f10>
    Here's the whole shebang if it can help:

    Code:
    (foreach com (xins:massoc "compressor" lst) 			;; For the contents of every <compressor> tag in the <rack>
    		   
    
                      ;; Insert Block at insertion point 'ins'
      		
                    (setq tmp 							;; VLA Block Reference object
                        (vla-insertblock
                            spc 							;; Modelspace object
                            (vlax-3d-point ins) 					;; Insertion point Safearray Variant
                            "M-GROUP-CSC-XML"   					;; Block name (exists in drawing as tested earlier)
                            1.0 1.0 1.0 0.0     					;; (Scale=1:1, Rotation=0.0)
                        ) ;; end vla-insertblock
                    ) ;; end setq
                    
                    (cond
    
    		    ;;----------------------------------------------------------------------;;
                        
                        ;; Condition
                        (   (null (setq mod (xins:assoc "model" com))) ;; Contents of <model> tag
                            ;; Notify user of such:
                            (princ
                                (strcat
                                    "\nModel Number not found for Compressor located at "
                                    (xins:lst->str (mapcar 'rtos ins) ",") 				;; Include insertion point of Compressor for clarity
                                ) ;; end strcat
                            ) ;; end princ
                        ) ;; end condition
    
    		    ;;----------------------------------------------------------------------;;
    		    		    		    
                        ;; Condition
                        (   (and
    			     (setq csg (xins:assoc "suction_group" com))				;; Finds suction group of compressor
    			     (< (atoi (cadr (assoc csg rsg))) 0)					;; Sees if suction group is LT ot MT
    			     (or (= (setq csf (xins:assoc "suction_shell" com)) "NONE")			;; Determines suction filter per comp
    				 (= (setq csf (xins:assoc "suction_shell" com)) nil)
    				 )
    			)
    
                           ;; Set visibility state of block accordingly:
    			(vla-put-activelayer
      				(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
      				(vla-item (vla-get-layers acdoc) "M-PIPING-INS-1-0")
    				)
                            (xins:setvisibilitystate tmp "DIP TUBE")					 ;; Sets the visibility state
                        ) ;; end condition
    
                        ;;----------------------------------------------------------------------;;
    		 
                    ) ;; end cond
    
                    ;; For every exploded block component...
                    (foreach obj
    ;;;		  (vlax-invoke tmp 'explode) ;; Explode the block
    		  (setq ss (ssadd))
    		  (ssadd tmp ss)
    		  (sssetfirst nil ss)
    		  (c:burst)
                    ) ;; end foreach
                    
    	        (vla-delete tmp) ;; Delete the original block (since the explode method retains the original)
    		(setq ins (mapcar '+ ins '(12.3933 0.0 0.0))) ;; Shift the insertion point by a given vector
                )
    I really do appreciate all the help. Really.
    foreach requires you to step through a list. You are not.

    eg.
    (foreach obj <list> ...

    Also, you can't ssadd a vla-object to a selectionset; have to vlax-vla-object->ename it to an ename.
    Civil 3D 2017 ~ Windohz 7
    Dropbox

  10. #30
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Convert Explode command to Burst command?

    Quote Originally Posted by alanjt View Post
    foreach requires you to step through a list. You are not.

    eg.
    (foreach obj <list> ...
    Why does it work when I just use explode?
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. 2014: BURST command Error
    By darrellwinfrey589074 in forum AutoCAD General
    Replies: 2
    Last Post: 2014-03-25, 02:56 PM
  2. Looking to get the BURST command in LT
    By elipman in forum AutoCAD LT - General
    Replies: 3
    Last Post: 2011-11-14, 01:19 PM
  3. 2011: HIGHLIGHT reverts to 0 after burst command?
    By stimmo520 in forum AutoCAD General
    Replies: 9
    Last Post: 2011-05-09, 01:07 PM
  4. Using the Burst command with LISP ?
    By stephen.coff in forum AutoLISP
    Replies: 16
    Last Post: 2011-02-08, 04:20 PM
  5. Modified Burst Command
    By thomas-p in forum AutoLISP
    Replies: 6
    Last Post: 2006-03-17, 02:51 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
  •