What is the proper way to make two groups interact?


#1

Let’s say I have a model. And model.entities contains a face; call it f. Now, I wish to add a second face

Now, I create:

face_group = model.entities.add_group
second_face = face_group.entities.add_face pts

Where pts is some planar object.

Now, if I do a pushpull on that second_face, it won’t interact with f. However, if I instead do:

second_face = model.entities.add_face pts

then second_face does interact with f.

Is there a way to make all of face_group interact with f? I can of course add my new face to model.entities, but that is messier.


#2

Make f inside face_group, or move f into face_group.

Or create a envelope group and then create both f and face_group inside it, do the push-pull, then explode face_group to cause the interaction.

The whole point of entities collections (ie, “editing contexts”,) is to prevent interaction. (This is how SketchUp separates groups of model objects, where as other traditional CAD applications use layers for this.)


#3

Hi Dan,

Thanks for your reply. Is there a clean way to move f from one group to another group? This is something I can’t see how to do.


#4

Yep @TIG answered this quite well here:
Is there some kind of “set parent” method to “move” a Group inside a container?


#5

I see. So I have to move an entire group, then? I can’t move a particular element, like a face?


#6

Open the nested groups down to the context where you can select the Face. Select it and either copy or cut. Then close out of that Group and select into the destination Group until you reach the required context there. Then paste.

oops - didn’t read carefully to see you want to do this via the API not the GUI :flushed:. TIG’s techniques can apply to any Entity, I believe.


#7

Thanks guys - I’ll mark this as the solution for now. I went a different path in the meanwhile but will refactor to do it this way soon.