Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#4 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
74/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
冷清
技術堆疊
python
領域
documentation

研究方向

先閱讀 viewer.py、spatial_tree.py 和 attribute_tree.py,然後將它們的匯入、viewer 呼叫、Treeform 設定以及幾何處理方式與列出的目前 API 進行比較。針對 compas_ifc 1.7.0 和 compas_viewer 2.x 更新全部三個腳本,包括 IFC 單位縮放,並確認教學課程能在所述環境中執行。

由索引模型根據 Issue 內容生成。

描述

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)
主要語言
Python
星號
1
分支
2
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。