compas-dev / compas-dev/tutorials

IFC tutorial scripts broken with compas_ifc 1.7.0 and compas_viewer 2.x

Ouverte
#4 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
1
Forks
2
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## Environment
- OS: Windows 11
- Python: 3.12
- compas_ifc: 1.7.0
- compas_viewer: 2.0.2
- ifcopenshell: 0.8.5

## Problem
The tutorial scripts `viewer.py`, `spatial_tree.py`, and `attribute_tree.py`
use outdated APIs that no longer work with current package versions.

## Fixes required

### viewer.py / spatial_tree.py / attribute_tree.py

**1. `body_with_opening` no longer exists**
```python
# OLD
viewer.add(entity.body_with_opening, name=entity.name)
# NEW
geom = entity.geometry
if geom:
viewer.scene.add(geom, name=entity.name)
```

**2. `viewer.add()` no longer exists → use `viewer.scene.add()`**

**3. `from compas_viewer.layout import Treeform` no longer exists**
```python
# OLD
from compas_viewer.layout import Treeform
# NEW
from compas_viewer.components.treeform import Treeform
```

**4. `from compas_ifc.entities import Entity` no longer exists**
```python
# OLD
from compas_ifc.entities import Entity
# NEW
from compas_ifc.entities.base import Base as Entity
```

**5. `viewer.layout.sidedock.add_element()` no longer exists**
```python
# OLD
viewer.layout.sidedock.add_element(Treeform(...))
# NEW
treeform = Treeform(...)
treeform.update() # required to populate the widget
viewer.ui.sidedock.add(treeform)
```

**6. Treeform columns API changed**
```python
# OLD
Treeform(tree, {"Name": ".name", "Value": ".attributes['value']"})
# NEW
Treeform(tree, columns={"Name": lambda n: n.name,
"Value": lambda n: n.attributes.get("value", "")})
```

**7. Scale needed for correct geometry size (IFC units are in mm)**
```python
from compas.geometry import Scale
S = Scale.from_factors([0.001, 0.001, 0.001])
geom.transform(S)
```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par lire viewer.py, spatial_tree.py et attribute_tree.py, puis comparez leurs imports, leurs appels à viewer, la configuration de Treeform et la gestion de la géométrie avec les API actuelles indiquées. Mettez à jour les trois scripts pour compas_ifc 1.7.0 et compas_viewer 2.x, y compris l’échelle des unités IFC, et confirmez que les tutoriels s’exécutent avec l’environnement indiqué.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
documentation
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
74/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.