method.group

33 views
Skip to first unread message

Louis King

unread,
Feb 29, 2024, 12:39:04 AMFeb 29
to VPython-users
Bruce, As often happens looking for one thing I find something else.
Found the Beta group method. Will there be an ungroup function?

I'm thinking as in the example, a wheel comes off of the car. I'm starting on a Rubik's cube application: there are 26 objects that it would be nice to move as a single group of 9, ungroup, create a new group of 9 and move ...

While in beta would be a good time think about this.

Bruce Sherwood

unread,
Feb 29, 2024, 1:04:43 PMFeb 29
to VPython-users
Good point. Thanks!

I guess the following should work (but doesn't at the moment):

g = group()
h = group()
b = box(group=g....)
....
b.group = None  (or move to a different group: b.group = h)

I should mention that group is not yet implemented for the vpython module used with installed Python.

Bruce

Message has been deleted
Message has been deleted

Louis King

unread,
Mar 1, 2024, 1:32:21 AMMar 1
to VPython-users
Forgive my syntactically incorrect last post. My thinking about groups without remembering the documentation, resulted in worrying about problems the you had already addressed with the syntax.

There is only one valid result from my 2 hr drive today. Using the documentation example of the car group,
If the wheel comes off of the car you can set wheel.visible = False
To bounce the wheel down the road just clone the wheel and bounce the clone.
OR
bounce = group()
wheel.group(bounce)
# bounce is a one-object group

Love the potential differences between combine and group.
On Thursday, February 29, 2024 at 7:48:24 PM UTC-7 Louis King wrote:
Hm not implemented with installed Python yet.
Spent the day driving so had time to think about this,
1) If the group structure is local to a method then mygroup1 could be created as a local object when the method is called, used, then automatically deleted when the method ends.
2) As you show above, redefining a named group (deletes the old group) or redefining as an empty list b = group([])

All of this due to the conflicts rising from an example: Having defined objects a,b,c,d  then defining group x=group([a,b,c]) and y=group([b,c,d])  That "obviously" has issues when group x is moved/rotated, what then happens when group y is then moved?

Love the potential differences between combine and group.

Lou
Reply all
Reply to author
Forward
0 new messages