Skip to content

Commit

Permalink
Merge pull request #1165 from smoothumut/master
Browse files Browse the repository at this point in the history
Update assembly.py
  • Loading branch information
marcomusy authored Jul 25, 2024
2 parents d44315e + faeb67e commit a89d2c7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vedo/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ def __init__(self, objects=()):
"""Form groups of generic objects (not necessarily meshes)."""
super().__init__()

self.objects = []

if isinstance(objects, dict):
for name in objects:
objects[name].name = name
objects = list(objects.values())
elif vedo.utils.is_sequence(objects):
self.objects = objects


self.actor = self

Expand Down Expand Up @@ -139,6 +144,7 @@ def __iadd__(self, obj):
self.AddPart(a)
except TypeError:
self.AddPart(a.actor)
self.objcects.append(a)
return self

def _unpack(self):
Expand Down Expand Up @@ -166,6 +172,7 @@ def clear(self) -> "Group":
"""Remove all parts"""
for a in self._unpack():
self.RemovePart(a)
self.objects = []
return self

def on(self) -> "Group":
Expand Down Expand Up @@ -193,6 +200,10 @@ def print(self) -> "Group":
print(self)
return self

def objects(self) -> List["vedo.Mesh"]:
"""Return the list of objects in the group."""
return self.objects


#################################################
class Assembly(CommonVisual, Actor3DHelper, vtki.vtkAssembly):
Expand Down

0 comments on commit a89d2c7

Please sign in to comment.