How to maintain groups with copy/paste between DWG files

How to maintain groups with copy/paste between DWG files

saudybaezestevezJMA4J
Explorer Explorer
3,519 Views
6 Replies
Message 1 of 7

How to maintain groups with copy/paste between DWG files

saudybaezestevezJMA4J
Explorer
Explorer

I would like that when copying a file from one document to another the created group is not ungrouped.

 

 

[ The subject line of this post has been edited for clarity by @pendean Original: groups]

0 Likes
Accepted solutions (1)
3,520 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

If what you copy out of one drawing is a complete group and nothing but the group, I can imagine a couple of approaches:

 

PASTEBLOCK to bring it in as a Block;

EXPLODE to separate the pieces;

GROUP and select Previous [the result of the Exploding] for the group content.

A routine could be written that would automate that.

 

Requiring a routine:

Set a marker variable of the last-drawn object;

PASTECLIP the stuff in;

Use (entnext) to step through and find everything newer than the marked object, and put them in a selection set;

GROUP using that selection set.

 

If it's a named group, putting its name into a variable first and using (vl-propagate) or (vl-bb-set) would make the name available in the target drawing to assign to the new group there.  But if you're copying multiple groups, or a group and some additional objects, I can't think of a way to re-establish the grouping(s) in the target drawing.

Kent Cooper, AIA
Message 3 of 7

saudybaezestevezJMA4J
Explorer
Explorer

thanks for the answer, i will try the second thing you were telling me. so far i have learned that groups can be named.

0 Likes
Message 4 of 7

saudybaezestevezJMA4J
Explorer
Explorer
actually I try to copy several groups from one document to another but they always get ungrouped
0 Likes
Message 5 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

Can you put the things into Blocks instead of Groups?  Then it's a breeze -- the Blocks keep their integrity and their names [assuming there isn't already a Block of the same name in the target drawing], you can Copy/Paste as many as you want, etc.

Kent Cooper, AIA
0 Likes
Message 6 of 7

saudybaezestevezJMA4J
Explorer
Explorer
I am not really interested in having it in a group but it is what I will do, the objective is to join all the sections but it is a good solution, I always use blocks although right now it is not the case. I understand that the groups are more for not so important things.
0 Likes
Message 7 of 7

komondormrex
Mentor
Mentor

you mean entities copied to clipboard.

check this compiled lisp. it has two commands: copy_group - to copy entities to clipboard in source document, groups included and paste_group - to paste copied entities from clipboard in target document. groups copied are retained when pasting into target document. for autoloading both commands in all opened (to be opened) documents use autolisp expression (vl-load-all "copy_paste_group") for loading lisp code.