Results 1 to 6 of 6

Thread: Explode in LISP Does Not Explode Selection Set

  1. #1
    I could stop if I wanted to Kevin Janik's Avatar
    Join Date
    2003-05
    Location
    Portland, OR
    Posts
    383
    Login to Give a bone
    0

    Question Explode in LISP Does Not Explode Selection Set

    I just wrote a piece of lisp to add to another program that creates a selection set of all the objects on a certain layer and then I use the Explode command to explode them all at once. In LISP the routine only explodes one of the object not all of them. If I type Explode at the command line in AutoCAD 2004 and at the "Select objects" prompt to give it the :sset selection set I created in the LISP routine using !:sset it explodes all of the objects of the selection set.

    What is the deal?

    The program is below.

    (defun C:XE ( / :SSET)
    (setq :SSET (ssget "X" '((0 . "INSERT")(8 . "EXPLODE"))))
    (command "explode" :SSET "")
    );end defun

    Kevin

  2. #2
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default Re: Explode in LISP Does Not Explode Selection Set

    Kevin,
    Take a look at this, it may help!

    Code:
    (SETQ SS1 (ssget			;GET ALL WATER LAT'S AND PIPES
     		'((0 . "LINE")
     		  (-4 . "<OR")
     		  (8 . "WTR-P-PIPE")
     		  (8 . "WTR-P-LAT")
     		  (-4 . "OR>")
     		 )
     	  )
     )
     (COMMAND "ZOOM" "E" "")
     (IF (/= SS1 NIL)
       (PROGN (SETQ LNGTH (SSLENGTH SS1))	;LENGTH OF SELECTION SET (SS1)
     	 (SETQ INDEX 0)			;SET INDEX TO ZERO
     	 (REPEAT LNGTH			;REPEAT FOR EACH WATER LINE
     	   (SETQ ENT1 (ENTGET (SSNAME SS1 INDEX))) ;GET WATER LINE
     	   (SETQ ENTTYPE (CDR (ASSOC 0 ENT1))) ;GET ENTITY TYPE
     	   (IF (= ENTTYPE "LINE")	;IF ENTITY IS A LINE
     		 (PROGN (SETQ PT1 (TRANS (CDR (ASSOC 10 ENT1)) 0 1))
     					;PROGN/GET 1ST ENDPOINT
     			(SETQ PT2 (TRANS (CDR (ASSOC 11 ENT1)) 0 1))
     					;GET 2ND ENDPOINT
     			(SETQ PNTS (LIST PT1 PT2)) ;LIST BOTH POINTS
     			(SETQ INDEX (+ INDEX 1)) ;INDEX +1
     		 )
     	   )
     	   (STM_WTR)
     	   (SAN_WTR)
     	   (SAN_LAT)
     	 )
       )
     )
    Last edited by Mike.Perry; 2004-12-07 at 05:46 PM. Reason: Code Tags added.

  3. #3
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Explode in LISP Does Not Explode Selection Set

    Hi

    Below comes via an old LISP Guild posts -

    -----Original Message-----
    From: owner-guild-lisp@augi.com [mailto:owner-guild-lisp@augi.com] On Behalf Of dyoung@mcwi.com
    Sent: 08 November 2002 00:26
    To: Cynthia Hadley; Augi-Lsip Guild (E-mail)
    Subject: Re: [LISP] Explode Selection Set

    (setq myss (ssget "x" '((0 . "POLYLINE,LWPOLYLINE")))) (setvar "qaflags" 1) (command "explaode" myss "") (setvar "qaflags 0)

    The reason Explode only explodes the one entity in the selection set is because years ago (r10 era I think) the explode command would only work on one entity at a time. This behavior is to preserve functionality of older legacy AutoLISP programs.

    You can work around it as I showed above with the help of the undocumented QAFLAGS system variable.


    -----Original Message-----
    From: owner-guild-lisp@augi.com [mailto:owner-guild-lisp@augi.com]On
    Behalf Of R. Robert Bell
    Sent: 31 July 2002 21:08
    To: Lisp Guild
    Subject: Re: [LISP] Date: Thu, 1 Aug 2002 07:56:08 +1200

    Because Autodesk programmed it that way... BwaHaHa!

    Set the undocumented setvar QAFlags to 1 before the explode, then back to 0 afterwards.

    R. Robert Bell, MCSE
    AUGI Guild Moderator
    www.AcadX.com


    -----Original Message-----
    From: owner-guild-lisp@augi.com [mailto:owner-guild-lisp@augi.com]On
    Behalf Of Peter Jamtgaard
    Sent: 31 July 2002 21:53
    To: guild-lisp@augi.com
    Subject: RE: [LISP] Date: Thu, 1 Aug 2002 07:56:08 +1200

    Kelvyn,

    It has to do with the evolution of the explode command. The default method of the explode command from within LISP is one item at a time, like it was when the explode command came out around release 9.

    If you iterate through your selection set it can explode them one at a time.

    Peter Jamtgaard

    Code:
    (if SSGRD
       (progn
        (setq CNT 0)
        (repeat (sslength SSGRD)
         (vl-cmdf "._explode" (ssname SSGRD CNT))
         (setq CNT (1+ CNT))
        )
       )
      )
    Have a good one, Mike
    Last edited by Mike.Perry; 2004-12-07 at 05:56 PM. Reason: Additional info added.

  4. #4
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Explode in LISP Does Not Explode Selection Set

    You can reset the "QAFLAGS" sysvar to 5 and it will allow the "explode" to work as expected in lisp:
    Code:
     (defun C:XE ( / :SSET)
       (setq flag (getvar "qaflags"))
       (setvar "qaflags" 5)
       (setq :SSET (ssget "X" '((0 . "INSERT")(8 . "EXPLODE"))))
       (command "explode" :SSET "")
       (setvar "qaflags" flag)
       (princ)
       );end defun

  5. #5
    I could stop if I wanted to Kevin Janik's Avatar
    Join Date
    2003-05
    Location
    Portland, OR
    Posts
    383
    Login to Give a bone
    0

    Default Re: Explode in LISP Does Not Explode Selection Set

    Thanks for the great, quick help!

    One post said to set "qaflags" to 1 and another to "5". Does the number matter? "1" worked great!

    Thanks again!

    Kevin

  6. #6
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Explode in LISP Does Not Explode Selection Set

    QAFLAGS bitcode, introduced in R11, an integer range from -32768 to +32767,
    changed to 0 - 32767 in R12.

    bit 0 (1) : ^C in menu macro cancels grips (acts like keyboard <Esc>).
    bit 1 (2) : no pause during text screen listings.
    bit 2 (4) : no "alert" dialogs (text display instead).
    bit 7 (128 ) : accepts "screen picks" (point lists) via (command) function.
    bit 9 (512) : sets Bind type to insert in R14

    I do not know why it helps You exploding things...
    but the main thing is that bit 0 (1) is set. (setvar "QAFLAGS" 1 )

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2004-12-08 at 07:02 AM. Reason: (128) : turns in to (12"smiley"

Similar Threads

  1. Explode certain blocks with Lisp
    By jgardner.79905 in forum AutoLISP
    Replies: 3
    Last Post: 2017-08-01, 06:16 PM
  2. Explode all text before aplly lisp
    By paulof in forum AutoLISP
    Replies: 4
    Last Post: 2011-07-11, 05:22 PM
  3. LISP CHALLENGE: Explode Polyline and Keep Width
    By bowlingbrad in forum AutoCAD Customization
    Replies: 14
    Last Post: 2009-08-29, 05:52 PM
  4. Replies: 6
    Last Post: 2007-03-21, 10:58 PM
  5. Stuck on a Lisp - Explode a Selection Set
    By todd.mackay in forum AutoLISP
    Replies: 16
    Last Post: 2005-09-20, 12:00 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
  •