Skip to main content

IFC viewer AnyWidget using That Open Company Open BIM Components

Project description

IFC viewer anywidget

Display an IFC model in your Jupyter/marimo notebook.

Uses anywidget and IFCLite

  • Displays an ifcopenshell.file object using the IFCLite viewer
  • returns the list of GlobalIds of the selected elements via selected_guids attribute

marimo example

install

If you're using marimo in sandbox mode, skip this part. Marimo will detect the import and ask you to install the package.

If you're running JupyterLab, add the library to your environment:

pip install ifc-anywidget

if you're using uv (highly recommended), run

uv add ifc-anywidget

usage

from ifc_anywidget import IfcViewer
import ifcopenshell

model = ifcopenshell.open("my-awesome-model.ifc")
viewer = IfcViewer(ifc_model=model) # for marimo: wrap it with mo.ui.anywidget()
viewer

IfcVewer supports the following attributes:

  • ifc_model: the ifcopenshell.file instance to show
  • hide_sites: whether to hide IfcSite elements (default: False)
  • hide_spaces: whether to hide IfcSpace elements (default: True)
  • hide_spatial_zones: whether to hide IfcSpatialZone elements (default: True)
  • hide_opening_elements: whether to hide IfcOpeningElement elements (default: True)
  • hide_annotations: whether to hide IfcAnnotation elements (default: True)
  • hide_grids: whether to hide IfcGrid elements (default: True)

Using marimo, you can set these attributes reactively (for instance, with a toggle widget).
Take a look at the tests/test_marimo.py notebook to see an example.

development

Clone the repo and run uv sync to initialize the environment with all the needed dependencies.

For testing within marimo, just run

uv run marimo edit tests/test_marimo.py

For testing within jupyter lab, run

uv run jupyter lab tests/test_jupyter.ipynb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ifc_anywidget-0.5.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ifc_anywidget-0.5.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file ifc_anywidget-0.5.0.tar.gz.

File metadata

  • Download URL: ifc_anywidget-0.5.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ifc_anywidget-0.5.0.tar.gz
Algorithm Hash digest
SHA256 75b2607e8eee10d2cad1c83e5ca7a91b32cd92530dee53d27fbc3665ba07af50
MD5 4bff2f782dc932a035336af5fc826675
BLAKE2b-256 77f662ce8abfe5a20aaf8ce2631777a4b08be553366a6a6614b2fa248a57faa7

See more details on using hashes here.

File details

Details for the file ifc_anywidget-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: ifc_anywidget-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ifc_anywidget-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1195812a05feff14927348068e675e797a2eccf38cfaf4b0b478aeea531da28b
MD5 7b4011341170c2dccc20a6928aa630b8
BLAKE2b-256 d2857e70d22d509f26d818fd4b362c1fb2b4a1824ad470e1c136bcf3481d4695

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page