IFC tutorial scripts broken with compas_ifc 1.7.0 and compas_viewer 2.x
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- documentation
Research direction
Start by reading viewer.py, spatial_tree.py, and attribute_tree.py, then compare their imports, viewer calls, Treeform setup, and geometry handling with the listed current APIs. Update all three scripts for compas_ifc 1.7.0 and compas_viewer 2.x, including the IFC unit scale, and confirm that the tutorials run with the stated environment.
Written by the indexing model from the issue text.
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
# 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
# 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
# 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
# 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
# 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)
from compas.geometry import Scale
S = Scale.from_factors([0.001, 0.001, 0.001])
geom.transform(S)
- Dominant language
- Python
- Stars
- 1
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·