Copying Nested Groups

Copying Nested Groups

akaterr55
Advocate Advocate
711 Views
2 Replies
Message 1 of 3

Copying Nested Groups

akaterr55
Advocate
Advocate

Here's the scenario:

I have several groups mixed in a common area shared with "loose" geometry.  I group those groups, along with the loose geometry into a single group.  So now I have a group that contains sub-groups.

 

Say I now want to copy one of those sub-groups to another place in the drawing.  As far as I know, I have two options.

 

1 - Ungroup the conglomeration, copy my desired sub-group, then re-group the collection.

 

2 - with Pickstyle set to 1, select one item.  It selects the entire collection, but also gives a grip for the sub-group that object belongs to.  Using Ctl+Pick Grip, I can copy that sub-group out of the collection.

 

Is there a better way than either of these two methods?

0 Likes
Accepted solutions (1)
712 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

Although I do think that #2 is quite a good solution, here is another one.

It's a LISP. Look HERE  in case you don't know what to do with it. 

Run the lisp first, pick an object, select a group. It stays pre-selected for the next job.

 

(vl-load-com)
(defun c:SelectNestedGroup ( / e d s l e done)
  
  (if (and (setq e (car (entsel)))
	   (setq d (entget e))
	   (setq d (member '(102 . "{ACAD_REACTORS") d))
	   (setq d (mapcar 'cdr (vl-remove-if-not
				  '(lambda (x) (and (= (car x) 330)
						    (= (cdr (assoc 0 (entget (cdr x)))) "GROUP")))
				  d)))
	   (princ (strcat "\nObject is part of " (itoa (length d)) " group/s."))
	   (setq s (ssadd))
	   )
    (while (and (setq l (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (= (car x) 340))) (entget (car d)))))
		(> (length d) 1)
		(not done)
		)
      (foreach e l (redraw e 3))
      (initget "Yes")
      (if (getkword "\nSelect this group [Yes, please] : ")
	(setq done T)
	(setq d (cdr d)))
      (foreach e l (redraw e 4))))
  (if l (sssetfirst nil (foreach e l (ssadd e s))))
  (princ)
  )

 

Message 3 of 3

akaterr55
Advocate
Advocate

Hey Z9,

 

Thanks for posting your reply.  Your Lisp works very well!  I will be using it often.

 

Thanks again,

-Mark

0 Likes