项目作者: Nobatek

项目描述 :
An IFC file reader, using ifcopenshell.
高级语言: Python
项目地址: git://github.com/Nobatek/ifc-datareader.git
创建时间: 2018-07-17T09:20:38Z
项目社区:https://github.com/Nobatek/ifc-datareader

开源协议:MIT License

下载


ifc-datareader

Build status
Coverage Status
Codacy Badge

About

An IFC file reader, using IfcOpenShell.

This lib mainly aims to help on IFC entities manipulation, by abstracting
as much as possible all the specifications and tricks of the IFC standard (relations, property sets, …).

Examples

  1. from ifc_datareader import IfcDataReader
  2. # Open an IFC file and access metadata
  3. data_reader = IfcDataReader(ifc_file_path)
  4. assert data_reader.filename == ifc_file_path
  5. # IFC schema specifications loaded from version read in file
  6. assert data_reader.schema_version == 'IFC2X3'
  7. # Get IfcSite entities from the IFC file
  8. ifc_sites = data_reader.read_sites()
  9. assert len(ifc_sites) > 0
  10. first_ifc_site = ifc_sites[0]
  11. # IFC entity GlobalId
  12. assert first_ifc_site.global_id is not None
  13. # The parent of a site is expected to be a project
  14. assert first_ifc_site.parent == data_reader.ifc_project
  15. # Try the 'read_entity' feature
  16. ifc_site_entities = data_reader.read_entity('IfcSite')
  17. assert len(ifc_site_entities) == len(ifc_sites)
  18. assert ifc_site_entities == ifc_sites

Installation

  1. pip install setup.py

IfcOpenShell dependancy

IfcOpenShell has to be installed manually:

  • Download ifcopenshell-python archive from the official site (acceptable version >= 0.5.0 preview 2).
  • Place the extracted archive in the site-packages folder of the projet’s
    virtualenv: $VENV_DIR/lib/python3.5/site-packages/.

Development

Use a virtual environnement to debug or develop

  1. # Create virtual environment
  2. $ virtualenv -p /usr/bin/python3 $ROOT_VENVS_DIR/ifc-datareader
  3. # Activate virtualenv
  4. $ source $ROOT_VENVS_DIR/ifc-datareader/bin/activate

Tests

  1. # Install test dependencies
  2. $ pip install -e .[test]
  3. # Run tests
  4. $ py.test
  5. # Skip slow tests
  6. $ py.test -m 'not slow'
  7. # Run tests with coverage
  8. $ py.test --cov=ifc_datareader --cov-report term-missing