Jump to content

Recommended Posts

Posted

the ungroup command only ungroup 1

even if you select multiple groups

 

is there a lisp the will ungroup multiple groups selected?

Posted (edited)

Try the following:

;; Ungroup Multiple  -  Lee Mac

(defun c:ungroupm ( / idx grp sel )
   (if (setq sel (ssget))
       (repeat (setq idx (sslength sel))
           (if (= "GROUP" (cdr (assoc 0 (entget (setq grp (cdr (assoc 330 (entget (ssname sel (setq idx (1- idx)))))))))))
               (entdel grp)
           )
       )
   )
   (princ)
)

Edited by Lee Mac
Changed vla-delete to entdel
  • Like 3
Posted

@Lee:

Why do you use vla-delete instead of entdel in your code?

Posted
@Lee:

Why do you use vla-delete instead of entdel in your code?

 

Something in the back of my mind said that vla-delete would be necessary to remove the references to the deleted group from each object, but after some testing, it would appear that entdel is indeed equally successful - thank you for the suggestion, I have updated my above code. :thumbsup:

Posted

FYI you can toggle group selection off/on with Ctrl+h. Back in r12 DOS AutoCAD it was Ctrl+a and would display or at the command line.

I have

 "$(if,$(and,1,$(getvar,pickstyle)),Group) "

as part of my MODEMACRO string to display Group on the Status bar when it's toggled on.

Posted
Try the following:
;; Ungroup Multiple  -  Lee Mac

(defun c:ungroupm ( / idx grp sel )
   (if (setq sel (ssget))
       (repeat (setq idx (sslength sel))
           (if (= "GROUP" (cdr (assoc 0 (entget (setq grp (cdr (assoc 330 (entget (ssname sel (setq idx (1- idx)))))))))))
               (entdel grp)
           )
       )
   )
   (princ)
)

 

thank you so much! this would help me

  • 2 years later...
Posted

Hi Mr. Lee Mac, C.G. 

 

I was searching the web for a way to ungroup groups in a single stroke but usually stayed away from using lisp, etc.   Your ungroupm was only the 2nd lisp (is this correct?) or application I used, the first one being AutoCAD's tutorial lisp.  That was a great help.  Thank you.  I hope you don't mind me using it without your permission.  

 

Sincerely,

Joel

Posted

You're most welcome Joel, I'm delighted that you found the program useful.

Posted

For those that like dialog boxes and clicks, there is a free GroupManager tool.  Three clicks (select all, delete, OK) to delete all groups.  Provides additional group functionality not available in built-in CAD commands. There is also a command line version for scripts.

  • 2 months later...
Posted
On 11/16/2016 at 2:04 AM, Lee Mac said:

Try the following:


;; Ungroup Multiple  -  Lee Mac

(defun c:ungroupm ( / idx grp sel )
   (if (setq sel (ssget))
       (repeat (setq idx (sslength sel))
           (if (= "GROUP" (cdr (assoc 0 (entget (setq grp (cdr (assoc 330 (entget (ssname sel (setq idx (1- idx)))))))))))
               (entdel grp)
           )
       )
   )
   (princ)
)
 
Please show me know mean of "0" & "330" behind assoc? Thank you!

 

 

  • 4 weeks later...
Posted
On 11/15/2016 at 10:04 PM, Lee Mac said:

Try the following:


;; Ungroup Multiple  -  Lee Mac

(defun c:ungroupm ( / idx grp sel )
   (if (setq sel (ssget))
       (repeat (setq idx (sslength sel))
           (if (= "GROUP" (cdr (assoc 0 (entget (setq grp (cdr (assoc 330 (entget (ssname sel (setq idx (1- idx)))))))))))
               (entdel grp)
           )
       )
   )
   (princ)
)
Lee, you, as always, bring simple solutions to difficult problems 😉

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...