ktbjx Posted November 15, 2016 Posted November 15, 2016 the ungroup command only ungroup 1 even if you select multiple groups is there a lisp the will ungroup multiple groups selected? Quote
Lee Mac Posted November 15, 2016 Posted November 15, 2016 (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 November 15, 2016 by Lee Mac Changed vla-delete to entdel 3 Quote
Roy_043 Posted November 15, 2016 Posted November 15, 2016 @Lee: Why do you use vla-delete instead of entdel in your code? Quote
Lee Mac Posted November 15, 2016 Posted November 15, 2016 @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. Quote
tombu Posted November 16, 2016 Posted November 16, 2016 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. Quote
halam Posted November 16, 2016 Posted November 16, 2016 Great work! Useful code. coincidentally Today, i bumbed into sheetpiling the manufactutor used groups in groups i an dwg part http://ds.arcelormittal.com/projects/foundationsolutions/20072/20082/20394/20245/20281/language/EN I personally hardly ever use it.. Quote
ktbjx Posted November 17, 2016 Author Posted November 17, 2016 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 Quote
Lee Mac Posted November 17, 2016 Posted November 17, 2016 thank you so much! this would help me You're most welcome! Quote
J:D Posted August 6, 2019 Posted August 6, 2019 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 Quote
Lee Mac Posted August 7, 2019 Posted August 7, 2019 You're most welcome Joel, I'm delighted that you found the program useful. Quote
TerryDotson Posted August 7, 2019 Posted August 7, 2019 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. Quote
mockhu001 Posted October 25, 2019 Posted October 25, 2019 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! Quote
BIGAL Posted October 25, 2019 Posted October 25, 2019 (edited) Google DXF codes varies a little bit based on object, should be able to find a full reference. It may be in Help. Basically 0 is object ID eg "Group" 8 layer 10 a point If you have a spare 1/2 hour http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf Edited October 25, 2019 by BIGAL Quote
rvv Posted November 21, 2019 Posted November 21, 2019 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 Quote
Recommended Posts
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.