|
1 | | -from typing import Optional |
2 | | - |
3 | 1 | from compas.geometry import Transformation |
4 | | -from compas.scene import Group |
5 | 2 | from compas.scene import SceneObject |
6 | 3 | from compas_model.models import Model |
7 | 4 |
|
8 | 5 |
|
9 | 6 | class ModelObject(SceneObject): |
10 | | - def __init__( |
11 | | - self, |
12 | | - show_elements: Optional[bool] = True, |
13 | | - show_contacts: Optional[bool] = False, |
14 | | - **kwargs, |
15 | | - ) -> None: |
| 7 | + def __init__(self, **kwargs) -> None: |
16 | 8 | super().__init__(**kwargs) |
17 | 9 |
|
18 | | - self.show_elements = show_elements |
19 | | - self.show_contacts = show_contacts |
20 | | - |
21 | | - self._add_elements(**kwargs) |
22 | | - |
23 | | - def _add_elements(self, **kwargs) -> None: |
24 | | - elements_group = self.add(Group(name="Elements", context=self.context)) |
25 | | - contacts_group = self.add(Group(name="Contacts", context=self.context)) |
26 | | - |
27 | | - if self.show_elements: |
28 | | - for element in self.model.tree.rootelements: |
29 | | - element_kwargs = kwargs.copy() |
30 | | - element_kwargs["item"] = element |
31 | | - elements_group.add(**element_kwargs) |
32 | | - |
33 | | - if self.show_contacts: |
34 | | - for contact in self.model.contacts(): |
35 | | - contact_kwargs = kwargs.copy() |
36 | | - contact_kwargs["item"] = contact |
37 | | - contacts_group.add(**contact_kwargs) |
| 10 | + for element in self.model.tree.rootelements: |
| 11 | + element_kwargs = kwargs.copy() |
| 12 | + element_kwargs["item"] = element |
| 13 | + self.add(**element_kwargs) |
38 | 14 |
|
39 | 15 | @property |
40 | 16 | def model(self) -> Model: |
|
0 commit comments