Compare commits

...

23 Commits

Author SHA1 Message Date
Dion Moult aaac864dcf More import fixes 2024-07-18 19:09:08 +10:00
Dion Moult c408bf339c Tool module: make all "import" imports relative 2024-07-18 16:32:52 +10:00
Dion Moult 3d02b60160 Tool module: make all "import as" imports relative 2024-07-18 16:29:20 +10:00
Dion Moult 72ecfbb9e1 Tool module: make all "from" imports relative 2024-07-18 16:27:23 +10:00
Dion Moult e4193c59ac Make all "import" imports relative 2024-07-18 16:15:16 +10:00
Dion Moult a0feae8717 Make all "import as foo" imports relative 2024-07-18 15:06:22 +10:00
Dion Moult 1f95037c32 Make all "import as" imports relative 2024-07-18 15:03:40 +10:00
Dion Moult 52cb9f865f Make all "from" imports relative 2024-07-18 14:59:17 +10:00
Dion Moult cec732138c Make some of the more complex imports relative 2024-07-18 14:18:17 +10:00
Dion Moult 93a1355c5e Fix missing imports prior to deciding 4.2 import strategy 2024-07-18 14:05:40 +10:00
Andrej730 8a8caf1427 Create blenderbim_redirect.py 2024-07-17 18:09:14 +05:00
Dion Moult 13009284f9 Fix non-valid Blender manifest (strings too long apparently) 2024-07-17 23:08:51 +10:00
Dion Moult 8799a6effa Fix ifcopenshell-python wheel packaging missing util schema json files 2024-07-17 23:08:33 +10:00
Dion Moult 60c3bb00c5 Fix ifc5d packaging missing json mapping files 2024-07-17 23:08:17 +10:00
Dion Moult db1f58b958 Add blender platform support 2024-07-17 22:46:51 +10:00
Dion Moult 54cfe8b405 Bump permissions and tags in blender manifest 2024-07-17 22:46:51 +10:00
Andrej730 7cb8592ad4 fix bpypolyskel and ifcjson wheels 2024-07-17 17:41:13 +05:00
Andrej730 49037d8b2e build wheel for bpypolyskel 2024-07-17 16:43:29 +05:00
Dion Moult ba25c68e85 Remove behave and bimtester module - only used by advanced users and confuses users with ifctester 2024-07-17 21:42:46 +10:00
Andrej730 39b883ea21 makefile - do not download pkg_resources as it's provided by blender
It seems Blender started providing pkg_resources by default at some point, see:
blender-4.2.0/4.2/python/lib/site-packages/pkg_resources
2024-07-17 16:30:53 +05:00
Andrej730 a76f12062b pack ifcjson to wheel 2024-07-17 16:30:52 +05:00
Dion Moult fded69aaa4 WIP BlenderBIM makefile update 2024-07-17 21:29:58 +10:00
Dion Moult ef1f27a088 Fix ifccityjson wheel 2024-07-17 21:29:21 +10:00
293 changed files with 1644 additions and 2037 deletions
+106 -159
View File
@@ -68,18 +68,22 @@ endif
ifeq ($(PLATFORM), linux)
PYPI_PLATFORM:=--platform manylinux_2_17_x86_64
BLENDER_PLATFORM:=linux-x64
endif
ifeq ($(PLATFORM), macos)
PYPI_PLATFORM:=--platform macosx_10_10_x86_64
BLENDER_PLATFORM:=macos-x64
endif
ifeq ($(PLATFORM), macosm1)
PYPI_PLATFORM:=--platform macosx_11_0_arm64
BLENDER_PLATFORM:=macos-arm64
endif
ifeq ($(PLATFORM), win)
PYPI_PLATFORM:=--platform win_amd64
BLENDER_PLATFORM:=windows-x64
endif
# Current build commit hash.
@@ -100,61 +104,86 @@ endif
mkdir -p dist/blenderbim
cp -r blenderbim/* dist/blenderbim/
# Provides IfcOpenShell Python functionality
cd dist/working && wget https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-$(PYNUMBER)-v0.7.9-${OLD}-$(PLATFORM)64.zip
cd dist/working && unzip ifcopenshell-python*
cp -r dist/working/ifcopenshell dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Provides dependencies that are part of IfcOpenShell
mkdir dist/working
cd dist/working && wget https://github.com/IfcOpenShell/IfcOpenShell/archive/refs/heads/v0.8.0.zip
cd dist/working && unzip v0.8.0.zip
# IfcOpenBot sometimes lags behind, so we only use its binaries
mv dist/blenderbim/libs/site/packages/ifcopenshell/*ifcopenshell_wrapper* dist/working/
rm -rf dist/blenderbim/libs/site/packages/ifcopenshell
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcopenshell-python/ifcopenshell dist/blenderbim/libs/site/packages/
mv dist/working/*ifcopenshell_wrapper* dist/blenderbim/libs/site/packages/ifcopenshell/
# Provides bcf functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/bcf/src/bcf dist/blenderbim/libs/site/packages/
# Provides IFCClash functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcclash/ifcclash dist/blenderbim/libs/site/packages/
# Provides BIMTester functionality
# To scope any build-time dependencies
cd dist/working && $(PYTHON) -m venv env
cd dist/working && . env/bin/activate && $(PIP) install pybabel
cd dist/working && . env/bin/activate && $(PIP) install babel
cd dist/working && . env/bin/activate && ./env/bin/pybabel compile -d ./IfcOpenShell-0.8.0/src/ifcbimtester/bimtester/locale/
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcbimtester/bimtester dist/blenderbim/libs/site/packages/
# Provides IFCTester functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifctester/ifctester dist/blenderbim/libs/site/packages/
# Provides IFCFM functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcfm/ifcfm dist/blenderbim/libs/site/packages/
# Provides bSDD functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/bsdd/* dist/blenderbim/libs/site/packages/
# Provides IFCDiff functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcdiff/* dist/blenderbim/libs/site/packages/
# Provides IFCCSV functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifccsv/* dist/blenderbim/libs/site/packages/
# Provides IFCPatch functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcpatch/ifcpatch dist/blenderbim/libs/site/packages/
# Provides IFC4D functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifc4d/ifc4d dist/blenderbim/libs/site/packages/
# Provides IFC5D functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifc5d/ifc5d dist/blenderbim/libs/site/packages/
# Provides IFCCityJSON functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifccityjson dist/blenderbim/libs/site/packages/
# Provides IfcGit functionality
cd dist/working && . env/bin/activate && $(PIP) install GitPython --target=./site-packages
cp -r dist/working/site-packages/smmap dist/blenderbim/libs/site/packages/
cp -r dist/working/site-packages/gitdb dist/blenderbim/libs/site/packages/
cp -r dist/working/site-packages/git dist/blenderbim/libs/site/packages/
rm -rf dist/working
cd dist/working && . env/bin/activate && $(PIP) install wheel
# Provides IfcOpenShell Python functionality
cd ../ifcopenshell-python && make dist PLATFORM=$(PLATFORM)64 PYVERSION=$(PYVERSION) && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../bcf && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifcclash && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifcbimtester && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifctester && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifcfm && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../bsdd && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifcdiff && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifccsv && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifcpatch && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifc4d && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifc5d && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd ../ifccityjson && make dist && cp dist/*.whl ../blenderbim/dist/blenderbim/wheels/
cd dist/working && . env/bin/activate && $(PIP) download GitPython --dest=../blenderbim/wheels
# Provides audio playback for costing
mkdir -p dist/working
git clone https://github.com/Andrej730/aud.git --branch master-reduced-size --depth 1 dist/working/aud
cd dist/working/aud && git checkout 529af208fbcb707c387bfb681d2605c0b6112de7
cp -r dist/working/aud/aud dist/blenderbim/libs/site/packages/
# This is a REALLY IMPORTANT feature
cd dist/working && . env/bin/activate && $(PIP) wheel git+https://github.com/Andrej730/aud.git --wheel-dir=../blenderbim/wheels
# IfcOpenShell dependency - support for new typing features
cd dist/working && . env/bin/activate && $(PIP) download typing_extensions --dest=../blenderbim/wheels
# Required by IfcCSV
cd dist/working && . env/bin/activate && $(PIP) download pandas $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
# Pandas ships with very heavy tests
# cd dist/working/site-packages/pandas && rm -rf tests
cd dist/working && . env/bin/activate && $(PIP) download openpyxl --dest=../blenderbim/wheels
# odfpy doesn't come with its own wheel, so whee'l (get it?) create it ourselves!
cd dist/working && . env/bin/activate && $(PIP) wheel odfpy --wheel-dir=../blenderbim/wheels
# Required by IFCCityJSON
cd dist/working && . env/bin/activate && $(PIP) download cjio --dest=../blenderbim/wheels
# Provides express rule validation for ifcopenshell.validate
cd dist/working && . env/bin/activate && $(PIP) download pytest --dest=../blenderbim/wheels
# Provides Brickschema functionality
cd dist/working && . env/bin/activate && $(PIP) download "brickschema[persistence]==0.7.6a2" --dest=../blenderbim/wheels
# Required for SVG to DXF conversion
cd dist/working && . env/bin/activate && $(PIP) download ezdxf --dest=../blenderbim/wheels
# Required by bcf
cd dist/working && . env/bin/activate && $(PIP) download xsdata --dest=../blenderbim/wheels
cd dist/working && . env/bin/activate && $(PIP) download xmlschema --dest=../blenderbim/wheels
cd dist/working && . env/bin/activate && $(PIP) download elementpath --dest=../blenderbim/wheels
cd dist/working && . env/bin/activate && $(PIP) download six --dest=../blenderbim/wheels
# Required by drawing module
cd dist/working && . env/bin/activate && $(PIP) download lxml $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
# Required by qto and drawing module
cd dist/working && . env/bin/activate && $(PIP) download shapely $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
# Required by the BIM type manager thumbnail generator
cd dist/working && . env/bin/activate && $(PIP) download pillow $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
# Provides mustache templating in construction docs and web UI data
cd dist/working && . env/bin/activate && $(PIP) download pystache --dest=../blenderbim/wheels
# Provides SVG export in construction documentation
cd dist/working && . env/bin/activate && $(PIP) download svgwrite --dest=../blenderbim/wheels
# Provides fuzzy date parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) download python-dateutil --dest=../blenderbim/wheels
# Provides duration parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) download isodate --dest=../blenderbim/wheels
# Provides networkx graph analysis for project dependency calculations
cd dist/working && . env/bin/activate && $(PIP) download networkx --dest=../blenderbim/wheels
# Required by IFCDiff
cd dist/working && . env/bin/activate && $(PIP) download deepdiff --dest=../blenderbim/wheels
# Required by IFCCSV and ifcopenshell.util.selector
cd dist/working && . env/bin/activate && $(PIP) download lark --dest=../blenderbim/wheels
# Required by IFC4D
cd dist/working && . env/bin/activate && $(PIP) download PyP6Xer --dest=../blenderbim/wheels
# Required by web module
cd dist/working && . env/bin/activate && $(PIP) download python-socketio[asyncio_client] --dest=../blenderbim/wheels
cd dist/working && . env/bin/activate && $(PIP) download aiohttp --dest=../blenderbim/wheels
# Required by light module
cd dist/working && . env/bin/activate && $(PIP) download pytz --dest=../blenderbim/wheels
cd dist/working && . env/bin/activate && $(PIP) download tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
# pyradiance is using different platform versions than defaults in our makefile.
ifeq ($(PLATFORM), linux)
cd dist/working && . env/bin/activate && $(PIP) download pyradiance --platform manylinux_2_35_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
else ifeq ($(PLATFORM), macos)
cd dist/working && . env/bin/activate && $(PIP) download pyradiance --platform macosx_10_13_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
else
cd dist/working && . env/bin/activate && $(PIP) download pyradiance $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=../blenderbim/wheels
endif
rm -rf dist/working
# Provides jsgantt-improved supports for web-based construction sequencing gantt charts
@@ -164,106 +193,24 @@ endif
cp dist/working/jsgantt* dist/blenderbim/bim/data/gantt/
rm -rf dist/working
mkdir dist/working
cd dist/working && $(PYTHON) -m venv env
cd dist/working && mkdir site-packages
# IfcOpenShell dependency - support for new typing features
cd dist/working && . env/bin/activate && $(PIP) install typing_extensions --target=./site-packages
# Required by IfcCSV
cd dist/working && . env/bin/activate && $(PIP) install pandas $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Pandas ships with very heavy tests
cd dist/working/site-packages/pandas && rm -rf tests
cd dist/working && . env/bin/activate && $(PIP) install openpyxl --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install odfpy --target=./site-packages
# Required by IFCCityJSON
cd dist/working && . env/bin/activate && $(PIP) install cjio --target=./site-packages
# Provides express rule validation for ifcopenshell.validate
cd dist/working && . env/bin/activate && $(PIP) install pytest --target=./site-packages
# Provides Brickschema functionality
cd dist/working && . env/bin/activate && $(PIP) install "brickschema[persistence]==0.7.6a2" --target=./site-packages
# Required for SVG to DXF conversion
cd dist/working && . env/bin/activate && $(PIP) install ezdxf --target=./site-packages
# Required by bcf
cd dist/working && . env/bin/activate && $(PIP) install xsdata --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install xmlschema --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install elementpath --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install six --target=./site-packages
# Required by drawing module
cd dist/working && . env/bin/activate && $(PIP) install lxml $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Required by qto and drawing module
cd dist/working && . env/bin/activate && $(PIP) install shapely $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Required by the BIM type manager thumbnail generator
cd dist/working && . env/bin/activate && $(PIP) install pillow $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Provides mustache templating in construction docs and web UI data
cd dist/working && . env/bin/activate && $(PIP) install pystache --target=./site-packages
# Provides SVG export in construction documentation
cd dist/working && . env/bin/activate && $(PIP) install svgwrite --target=./site-packages
# Provides fuzzy date parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) install python-dateutil --target=./site-packages
# Provides duration parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) install isodate --target=./site-packages
# Provides networkx graph analysis for project dependency calculations
cd dist/working && . env/bin/activate && $(PIP) install networkx --target=./site-packages
# Required by IFCDiff
cd dist/working && . env/bin/activate && $(PIP) install deepdiff --target=./site-packages
# Required by IFCCSV and ifcopenshell.util.selector
cd dist/working && . env/bin/activate && $(PIP) install lark --target=./site-packages
# Required by IFC4D
cd dist/working && . env/bin/activate && $(PIP) install PyP6Xer --target=./site-packages
# Required by web module
cd dist/working && . env/bin/activate && $(PIP) install python-socketio[asyncio_client] --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install aiohttp --target=./site-packages
# Required by light module
cd dist/working && . env/bin/activate && $(PIP) install pytz --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# pyradiance is using different platform versions than defaults in our makefile.
ifeq ($(PLATFORM), linux)
cd dist/working && . env/bin/activate && $(PIP) install pyradiance --platform manylinux_2_35_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
else ifeq ($(PLATFORM), macos)
cd dist/working && . env/bin/activate && $(PIP) install pyradiance --platform macosx_10_13_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
else
cd dist/working && . env/bin/activate && $(PIP) install pyradiance $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
endif
cp -r dist/working/site-packages/* dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Required by BIMTester
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/c8/4b/d0a8c23b6c8985e5544ea96d27105a273ea22051317f850c2cdbf2029fe4/behave-1.2.6.tar.gz
cd dist/working && tar -xzvf behave*
cd dist/working/behave-1.2.6/ && cp -r behave ../../blenderbim/libs/site/packages/
# See bug #1294
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/model_core.patch
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/runner_util.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/model_core.py < model_core.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/runner_util.py < runner_util.patch
# See bug #2159
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/junit.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/reporter/junit.py < junit.patch
rm -rf dist/working
# Required by behave
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/f4/65/220bb4075fddb09d5b3ea2c1c1fa66c1c72be9361ec187aab50fa161e576/parse-1.15.0.tar.gz
cd dist/working && tar -xzvf parse*
cd dist/working/parse-1.15.0/ && cp parse.py ../../blenderbim/libs/site/packages/
rm -rf dist/working
# Required by behave
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/2e/79/81bebd1b0446d46733db99d74543b4bb80646ef4c988584bae0862e706bc/parse_type-0.5.2.tar.gz
cd dist/working && tar -xzvf parse_type*
cd dist/working/parse_type-0.5.2/ && cp -r parse_type ../../blenderbim/libs/site/packages/
rm -rf dist/working
# Provides IFCJSON functionality
mkdir dist/working
cd dist/working && wget https://github.com/IFCJSON-Team/IFC2JSON_python/archive/master.zip
cd dist/working && unzip master.zip
cp -r dist/working/IFC2JSON_python-master/file_converters/ifcjson dist/blenderbim/libs/site/packages/
# IFCJSON doesn't have pyproject.toml, so we use python command.
cd dist/working/IFC2JSON_python-master/file_converters && \
$(PYTHON) -c "from setuptools import setup; \
setup( \
name='ifcjson', \
version='0.0.0', \
author='Jan Brouwer', \
author_email='jan@brewsky.nl', \
packages=['ifcjson'], \
)" bdist_wheel
cp -r dist/working/IFC2JSON_python-master/file_converters/dist/*.whl dist/blenderbim/wheels/
rm -rf dist/working
# Brickschema requires pkg_resources which is provided by Blender.
# Provides Brickschema functionality
mkdir dist/working
# For now lets bundle the latest nightly schema
@@ -271,19 +218,18 @@ endif
cd dist/working && cp Brick.ttl ../blenderbim/bim/schema/Brick.ttl
rm -rf dist/working
# Required by brickschema
# This is a bit of a dodgy one, it should be provided by setuptools which Blender doesn't ship.
mkdir dist/working
cd dist/working && wget https://github.com/IfcOpenShell/IfcOpenShell/raw/v0.8.0/src/blenderbim/scripts/pkg_resources.tar.gz
cd dist/working && tar -xzvf pkg_resources*
cd dist/working/ && cp -r pkg_resources ../blenderbim/libs/site/packages/
rm -rf dist/working
# Required for hipped roof generation
mkdir dist/working
cd dist/working && wget https://github.com/prochitecture/bpypolyskel/archive/refs/heads/master.zip
cd dist/working && unzip master.zip
cp -r dist/working/bpypolyskel-master/bpypolyskel dist/blenderbim/libs/site/packages/
cd dist/working/bpypolyskel-master && \
$(PYTHON) -c "from setuptools import setup; \
setup( \
name='bpypolyskel', \
version='0.0.0', \
packages=['bpypolyskel'], \
)" bdist_wheel
cp -r dist/working/bpypolyskel-master/dist/*.whl dist/blenderbim/wheels/
rm -rf dist/working
# Required for Desktop icon and file association
@@ -295,19 +241,20 @@ endif
rm -rf dist/working
# Remove dependencies also bundled with Blender
rm -rf dist/blenderbim/libs/site/packages/numpy
rm -rf dist/blenderbim/libs/site/packages/numpy.libs
rm -rf dist/blenderbim/wheels/numpy*
ifeq ($(IS_STABLE), TRUE)
cd dist/blenderbim && $(SED) "s/0, 0, 0/$(VERSION_MAJOR), $(VERSION_MINOR), $(VERSION_PATCH)/" __init__.py
cd dist/blenderbim && $(SED) "s/0.0.0/$(VERSION)/" blender_manifest.toml
cd dist && zip -r blenderbim-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ./*
cd dist && zip -r blenderbim_$(PYVERSION)-$(VERSION)-$(BLENDER_PLATFORM).zip ./*
else
cd dist/blenderbim && $(SED) "s/0, 0, 0/$(VERSION_MAJOR), $(VERSION_MINOR), $(VERSION_PATCH), $(VERSION_DATE)/" __init__.py
# Blender manifest version must be semver compatible.
cd dist/blenderbim && $(SED) "s/0.0.0/$(VERSION)-$(VERSION_DATE)/" blender_manifest.toml
cd dist/blenderbim && $(SED) "s/os-arch/$(BLENDER_PLATFORM)/" blender_manifest.toml
$(PYTHON) scripts/get_wheels.py dist/blenderbim/wheels dist/blenderbim/blender_manifest.toml
cd dist/blenderbim && $(SED) "s/8888888/$(LAST_COMMIT_HASH)/" __init__.py
cd dist && zip -r blenderbim-$(VERSION).$(VERSION_DATE)-$(PYVERSION)-$(PLATFORM).zip ./*
cd dist && zip -r blenderbim_$(PYVERSION)-$(VERSION)-$(VERSION_DATE)-$(BLENDER_PLATFORM).zip ./*
endif
rm -rf dist/blenderbim
+3 -5
View File
@@ -19,14 +19,13 @@
import os
import bpy
import bpy.utils.previews
import blenderbim
import importlib
from pathlib import Path
from . import handler, ui, prop, operator, helper
from typing import Callable, Union
try:
from blenderbim.translations import translations_dict
from .translations import translations_dict
except ImportError:
translations_dict = {}
cwd = os.path.dirname(os.path.realpath(__file__))
@@ -75,7 +74,6 @@ modules = {
"clash": None,
"csv": None,
"tester": None,
"bimtester": None,
"diff": None,
"patch": None,
"gis": None,
@@ -93,7 +91,7 @@ modules = {
for name in modules.keys():
modules[name] = importlib.import_module(f"blenderbim.bim.module.{name}")
modules[name] = importlib.import_module(f".module.{name}", package=__package__)
classes = [
@@ -291,7 +289,7 @@ def unregister():
km.keymap_items.remove(kmi)
addon_keymaps.clear()
import blenderbim.tool as tool
from . import tool
# use tuple() as method will be removing keys from dict
for panel in tuple(original_scene_panels_polls.keys()):
+7 -7
View File
@@ -29,12 +29,12 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.placement
import ifcopenshell.util.unit
import blenderbim.tool as tool
import blenderbim.core.geometry
import blenderbim.core.aggregate
import blenderbim.core.spatial
import blenderbim.core.style
from blenderbim.bim.ifc import IfcStore
from .. import tool
from ..core import geometry as core_geometry
from ..core import aggregate as core_aggregate
from ..core import spatial as core_spatial
from ..core import style as core_style
from .ifc import IfcStore
from mathutils import Vector
from typing import Union
from logging import Logger
@@ -152,7 +152,7 @@ class IfcExporter:
return self.sync_grid_axis_object_placement(obj, element)
if not hasattr(element, "ObjectPlacement"):
return
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
return element
def sync_grid_axis_object_placement(self, obj: bpy.types.Object, element: ifcopenshell.entity_instance) -> None:
+9 -9
View File
@@ -23,14 +23,14 @@ import addon_utils
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.owner.settings
import blenderbim.bim
import blenderbim.tool as tool
import blenderbim.core.owner as core_owner
from .. import bim
from .. import tool
from ..core import owner as core_owner
from bpy.app.handlers import persistent
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
from blenderbim.bim.module.model.data import AuthoringData
from blenderbim.bim.module.model.workspace import LIST_OF_TOOLS, TOOLS_TO_CLASSES_MAP
from .ifc import IfcStore
from .module.owner.prop import get_user_person, get_user_organisation
from .module.model.data import AuthoringData
from .module.model.workspace import LIST_OF_TOOLS, TOOLS_TO_CLASSES_MAP
from mathutils import Vector
from math import cos, degrees
from typing import Union
@@ -170,7 +170,7 @@ def subscribe_to(obj, data_path, callback):
def refresh_ui_data():
from blenderbim.bim import modules
from . import modules
for name, value in modules.items():
try:
@@ -308,7 +308,7 @@ def load_post(scene):
# tab. We override default scene properties panels with our own poll
# to hide them unless the user has chosen to view Blender properties.
for panel in tool.Blender.get_scene_panels_list():
if panel in blenderbim.bim.original_scene_panels_polls:
if panel in bim.original_scene_panels_polls:
continue
tool.Blender.override_scene_panel(panel)
tool.Blender.setup_tabs()
+2 -2
View File
@@ -26,8 +26,8 @@ import ifcopenshell.util.element
from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, get_property_doc
from mathutils import geometry
from mathutils import Vector
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from .. import tool
from .ifc import IfcStore
from typing import Optional, Callable, Any, Union
+14 -13
View File
@@ -24,17 +24,18 @@ import hashlib
import zipfile
import tempfile
import traceback
import importlib
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper
import blenderbim
import blenderbim.bim.handler
import blenderbim.tool as tool
from . import handler as bim_handler
from .. import tool
from pathlib import Path
from blenderbim.tool.brick import BrickStore
from ..tool.brick import BrickStore
from typing import Set, Union, Optional, TypedDict, Callable
bbim = importlib.import_module("..", package=__package__)
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
@@ -252,11 +253,11 @@ class IfcStore:
else:
obj.BIMObjectProperties.ifc_definition_id = element.id()
blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback)
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
if isinstance(obj, bpy.types.Object):
blenderbim.bim.handler.subscribe_to(
obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback
bim_handler.subscribe_to(
obj, "active_material_index", bim_handler.active_material_index_callback
)
if IfcStore.history:
@@ -279,10 +280,10 @@ class IfcStore:
IfcStore.id_map[data["id"]] = obj
if "guid" in data:
IfcStore.guid_map[data["guid"]] = obj
blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback)
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
if isinstance(obj, bpy.types.Object):
blenderbim.bim.handler.subscribe_to(
obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback
bim_handler.subscribe_to(
obj, "active_material_index", bim_handler.active_material_index_callback
)
# TODO Listeners are not re-registered. Does this cause nasty problems to debug later on?
# TODO We're handling id_map and guid_map, but what about edited_objs? This might cause big problems.
@@ -364,7 +365,7 @@ class IfcStore:
@staticmethod
def execute_ifc_operator(operator: bpy.types.Operator, context: bpy.types.Context, is_invoke=False):
blenderbim.last_actions.append({"type": "operator", "name": operator.bl_idname})
bbim.last_actions.append({"type": "operator", "name": operator.bl_idname})
bpy.context.scene.BIMProperties.is_dirty = True
is_top_level_operator = not bool(IfcStore.current_transaction)
@@ -385,7 +386,7 @@ class IfcStore:
else:
result = getattr(operator, "_execute")(context)
except:
blenderbim.last_error = traceback.format_exc()
bbim.last_error = traceback.format_exc()
raise
if is_top_level_operator:
@@ -397,7 +398,7 @@ class IfcStore:
if BrickStore.graph is not None: # `if BrickStore.graph` by itself takes ages.
BrickStore.end_transaction()
IfcStore.end_transaction(operator)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return result
+3 -3
View File
@@ -32,10 +32,10 @@ import ifcopenshell.util.geolocation
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import blenderbim.tool as tool
from .. import tool
from itertools import chain, accumulate
from blenderbim.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
from blenderbim.tool.loader import OBJECT_DATA_TYPE
from .ifc import IfcStore, IFC_CONNECTED_TYPE
from ..tool.loader import OBJECT_DATA_TYPE
from typing import Dict, Union, Optional, Any
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from .... import tool
import ifcopenshell.util.element
@@ -19,11 +19,11 @@
import bpy
import ifcopenshell
import ifcopenshell.util.element
import blenderbim.tool as tool
import blenderbim.core.aggregate as core
import blenderbim.core.spatial
import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore
from .... import tool
from ....core import aggregate as core
from ....core import spatial as core_spatial
from ... import handler as bim_handler
from ...ifc import IfcStore
class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator):
@@ -163,7 +163,7 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator):
related_obj=aggregate,
)
elif current_container:
blenderbim.core.spatial.assign_container(
core_spatial.assign_container(
tool.Ifc,
tool.Collector,
tool.Spatial,
@@ -283,7 +283,7 @@ class BIM_OT_add_part_to_object(bpy.types.Operator, tool.Ifc.Operator):
part_class=self.part_class,
part_name=self.part_name,
)
blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial)
core_spatial.import_spatial_decomposition(tool.Spatial)
class BIM_OT_break_link_to_other_aggregates(bpy.types.Operator, tool.Ifc.Operator):
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, Attribute
from blenderbim.bim.module.spatial.data import SpatialData
from ...prop import StrProperty, Attribute
from ..spatial.data import SpatialData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,10 +17,10 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel
from blenderbim.bim.module.aggregate.data import AggregateData
from blenderbim.bim.module.group.data import GroupsData, ObjectGroupsData
from blenderbim.bim.ifc import IfcStore
import blenderbim.tool as tool
from .data import AggregateData
from ..group.data import GroupsData, ObjectGroupsData
from ...ifc import IfcStore
from .... import tool
class BIM_PT_aggregate(Panel):
@@ -18,7 +18,7 @@
import bpy
import ifcopenshell
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -21,11 +21,11 @@ import json
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.guid
import blenderbim.bim.helper
import blenderbim.bim.handler
import blenderbim.tool as tool
import blenderbim.core.attribute as core
from blenderbim.bim.ifc import IfcStore
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import attribute as core
from ...ifc import IfcStore
class EnableEditingAttributes(bpy.types.Operator):
@@ -58,13 +58,13 @@ class EnableEditingAttributes(bpy.types.Operator):
new.data_type = "string"
new.ifc_class = data["type"]
new.string_value = "" if new.is_null else json.dumps(data[name])
blenderbim.bim.helper.add_attribute_description(new)
bim_helper.add_attribute_description(new)
new.description += " The degrees, minutes and seconds should follow this format : [12,34,56]"
if name in ("PredefinedType", "ObjectType") and has_inherited_predefined_type:
props.attributes.remove(len(props.attributes) - 1)
return True
blenderbim.bim.helper.import_attributes2(element, props.attributes, callback=callback)
bim_helper.import_attributes2(element, props.attributes, callback=callback)
props.is_editing_attributes = True
return {"FINISHED"}
@@ -105,7 +105,7 @@ class EditAttributes(bpy.types.Operator, tool.Ifc.Operator):
attributes[prop.name] = None
return True
attributes = blenderbim.bim.helper.export_attributes(props.attributes, callback=callback)
attributes = bim_helper.export_attributes(props.attributes, callback=callback)
ifcopenshell.api.run("attribute.edit_attributes", self.file, product=product, attributes=attributes)
bpy.ops.bim.disable_editing_attributes(obj=obj.name)
return {"FINISHED"}
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.prop import StrProperty, Attribute
from ...ifc import IfcStore
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.attribute.data import AttributesData
from ...ifc import IfcStore
from .data import AttributesData
def draw_ui(context, layout, attributes):
@@ -34,7 +34,7 @@ def draw_ui(context, layout, attributes):
op = row.operator("bim.disable_editing_attributes", icon="CANCEL", text="")
op.obj = obj.name
blenderbim.bim.helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
bim_helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
else:
row = layout.row()
op = row.operator("bim.enable_editing_attributes", icon="GREASEPENCIL", text="Edit")
@@ -27,10 +27,10 @@ import tempfile
import webbrowser
import ifcopenshell
import ifcopenshell.util.unit
import blenderbim.bim.module.bcf.prop as bcf_prop
from . import prop as bcf_prop
from . import bcfstore
from pathlib import Path
from blenderbim.bim.ifc import IfcStore
from ...ifc import IfcStore
from math import radians, degrees, atan, tan, cos, sin
from mathutils import Vector, Matrix, Euler, geometry
from xsdata.models.datatype import XmlDateTime
@@ -18,7 +18,7 @@
import bpy
from . import bcfstore
from blenderbim.bim.prop import StrProperty
from ...prop import StrProperty
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -1,42 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BlenderBIM Add-on is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from . import ui, prop, operator
classes = (
operator.ExecuteBIMTester,
operator.BIMTesterPurge,
operator.SelectFeature,
operator.SelectSteps,
operator.SelectBIMTesterIfcFile,
operator.RejectElement,
operator.ApproveClass,
operator.RejectClass,
operator.SelectAudited,
prop.BimTesterProperties,
ui.BIM_PT_qa,
)
def register():
bpy.types.Scene.BimTesterProperties = bpy.props.PointerProperty(type=prop.BimTesterProperties)
def unregister():
del bpy.types.Scene.BimTesterProperties
@@ -1,238 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BlenderBIM Add-on is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import os
import bpy
import tempfile
import webbrowser
try:
import bimtester
import bimtester.run
import bimtester.reports
except:
print("Failed to load BIMTester. Try disabling other add-ons, in particular Blender-OSM. See bug #1318.")
from pathlib import Path
from blenderbim.bim.ifc import IfcStore
class ExecuteBIMTester(bpy.types.Operator):
bl_idname = "bim.execute_bim_tester"
bl_label = "Execute BIMTester"
@classmethod
def poll(cls, context):
props = context.scene.BimTesterProperties
return (props.ifc_file or props.should_load_from_memory) and props.feature
def execute(self, context):
props = context.scene.BimTesterProperties
with tempfile.TemporaryDirectory() as dirpath:
report = os.path.join(dirpath, "{}.html".format(props.feature))
args = {
"action": "run",
"advanced_arguments": "",
"console": False,
"feature": props.feature,
"ifc": props.ifc_file,
"path": "",
"report": report,
"schema_file": "",
"schema_name": "",
"lang": "en",
"steps": props.steps,
}
use_stored_ifc = props.should_load_from_memory and IfcStore.get_file()
runner = bimtester.run.TestRunner(args["ifc"], ifc=IfcStore.get_file() if use_stored_ifc else None)
report_json = runner.run(args)
bimtester.reports.ReportGenerator().generate(report_json, args["report"])
webbrowser.open("file://" + report)
return {"FINISHED"}
class BIMTesterPurge(bpy.types.Operator):
bl_idname = "bim.bim_tester_purge"
bl_label = "Purge Tests"
def execute(self, context):
cwd = os.getcwd()
os.chdir(context.scene.BimTesterProperties.features_dir)
bimtester.clean.TestPurger().purge()
os.chdir(cwd)
return {"FINISHED"}
class SelectFeature(bpy.types.Operator):
bl_idname = "bim.select_feature"
bl_label = "Select Feature / IDS"
bl_options = {"REGISTER", "UNDO"}
filename_ext = ".feature"
filter_glob: bpy.props.StringProperty(default="*.feature;*.xml", options={"HIDDEN"})
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
context.scene.BimTesterProperties.feature = self.filepath
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class SelectSteps(bpy.types.Operator):
bl_idname = "bim.select_steps"
bl_label = "Select Steps"
bl_options = {"REGISTER", "UNDO"}
filename_ext = ".py"
filter_glob: bpy.props.StringProperty(default="*.py", options={"HIDDEN"})
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
context.scene.BimTesterProperties.steps = self.filepath
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class SelectBIMTesterIfcFile(bpy.types.Operator):
bl_idname = "bim.select_bimtester_ifc_file"
bl_label = "Select BIMTester IFC File"
bl_options = {"REGISTER", "UNDO"}
filename_ext = ".ifc"
filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml", options={"HIDDEN"})
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
context.scene.BimTesterProperties.ifc_file = self.filepath
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class RejectElement(bpy.types.Operator):
bl_idname = "bim.reject_element"
bl_label = "Reject Element"
def execute(self, context):
lines = []
self.file = IfcStore.get_file()
for obj in context.selected_objects:
lines.append(
" * The element {} should not exist because {}".format(
self.file.by_id(obj.BIMObjectProperties.ifc_definition_id).GlobalId,
context.scene.BimTesterProperties.qa_reject_element_reason,
)
)
QAHelper.append_to_scenario(lines, context)
return {"FINISHED"}
class ApproveClass(bpy.types.Operator):
bl_idname = "bim.approve_class"
bl_label = "Approve Class"
def execute(self, context):
lines = []
self.file = IfcStore.get_file()
for obj in context.selected_objects:
if not obj.BIMObjectProperties.ifc_definition_id:
continue
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
lines.append(" * The element {} is an {}".format(element.GlobalId, element.is_a()))
QAHelper.append_to_scenario(lines, context)
return {"FINISHED"}
class RejectClass(bpy.types.Operator):
bl_idname = "bim.reject_class"
bl_label = "Reject Class"
def execute(self, context):
lines = []
self.file = IfcStore.get_file()
for obj in context.selected_objects:
if not obj.BIMObjectProperties.ifc_definition_id:
continue
lines.append(
" * The element {} is an {}".format(
self.file.by_id(obj.BIMObjectProperties.ifc_definition_id).GlobalId,
context.scene.BimTesterProperties.audit_ifc_class,
)
)
QAHelper.append_to_scenario(lines, context)
return {"FINISHED"}
class SelectAudited(bpy.types.Operator):
bl_idname = "bim.select_audited"
bl_label = "Select Audited"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
audited_global_ids = []
self.file = IfcStore.get_file()
for filename in Path(context.scene.BimTesterProperties.features_dir).glob("*.feature"):
with open(filename, "r") as feature_file:
lines = feature_file.readlines()
for line in lines:
words = line.strip().split()
for word in words:
if self.is_a_global_id(word):
audited_global_ids.append(word)
for obj in context.visible_objects:
if not obj.BIMObjectProperties.ifc_definition_id:
continue
if self.file.by_id(obj.BIMObjectProperties.ifc_definition_id).GlobalId in audited_global_ids:
obj.select_set(True)
return {"FINISHED"}
def is_a_global_id(self, word):
return word[0] in ["0", "1", "2", "3"] and len(word) == 22
class QAHelper:
@classmethod
def append_to_scenario(cls, lines, context):
filename = os.path.join(
context.scene.BimTesterProperties.features_dir,
context.scene.BimTesterProperties.features_file + ".feature",
)
if os.path.exists(filename + "~"):
os.remove(filename + "~")
os.rename(filename, filename + "~")
with open(filename, "w") as destination:
with open(filename + "~", "r") as source:
is_in_scenario = False
for source_line in source:
if (
"Scenario: " in source_line
and context.scene.BimTesterProperties.scenario == source_line.strip()[len("Scenario: ") :]
):
is_in_scenario = True
elif is_in_scenario:
for line in lines:
destination.write(line + "\n")
is_in_scenario = False
destination.write(source_line)
os.remove(filename + "~")
@@ -1,71 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BlenderBIM Add-on is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import os
from pathlib import Path
from blenderbim.bim.prop import StrProperty
from blenderbim.bim.module.root.prop import get_ifc_classes
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
CollectionProperty,
)
scenarios_enum = []
def purge():
global scenarios_enum
scenarios_enum = []
def getScenarios(self, context):
global scenarios_enum
if len(scenarios_enum) < 1:
scenarios_enum.clear()
if context.scene.BimTesterProperties.feature != "":
with open(context.scene.BimTesterProperties.feature, "r") as feature_file:
lines = feature_file.readlines()
for line in lines:
if "Scenario:" in line:
s = line.strip()[len("Scenario: ") :]
scenarios_enum.append((s, s, ""))
return scenarios_enum
def refreshScenarios(self, context):
global scenarios_enum
scenarios_enum.clear()
getScenarios(self, context)
class BimTesterProperties(PropertyGroup):
feature: StringProperty(default="", name="Feature", update=refreshScenarios)
steps: StringProperty(default="", name="Custom Steps")
ifc_file: StringProperty(default="", name="IFC File")
audit_ifc_class: EnumProperty(items=get_ifc_classes, name="Audit Class")
qa_reject_element_reason: StringProperty(name="Element Rejection Reason")
scenario: EnumProperty(items=getScenarios, name="Scenario")
should_load_from_memory: BoolProperty(default=False, name="Load from Memory")
@@ -1,81 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BlenderBIM Add-on is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
class BIM_PT_qa(Panel):
bl_label = "BIMTester"
bl_idname = "BIM_PT_qa"
bl_options = {"DEFAULT_CLOSED"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_tab_quality_control"
def draw(self, context):
self.layout.use_property_split = True
props = context.scene.BimTesterProperties
if IfcStore.get_file():
row = self.layout.row()
row.prop(props, "should_load_from_memory")
if not IfcStore.get_file() or not props.should_load_from_memory:
row = self.layout.row(align=True)
row.prop(props, "ifc_file")
row.operator("bim.select_bimtester_ifc_file", icon="FILE_FOLDER", text="")
row = self.layout.row(align=True)
row.prop(props, "feature")
row.operator("bim.select_feature", icon="FILE_FOLDER", text="")
row = self.layout.row(align=True)
row.prop(props, "steps")
row.operator("bim.select_steps", icon="FILE_FOLDER", text="")
has_ifc_file = (IfcStore.get_file() and props.should_load_from_memory) or (
props.ifc_file and not props.should_load_from_memory
)
row = self.layout.row(align=True)
row.operator("bim.execute_bim_tester")
row.operator("bim.bim_tester_purge")
if props.feature and has_ifc_file:
self.layout.label(text="Scenario Authoring:")
row = self.layout.row(align=True)
row.prop(props, "scenario")
row = self.layout.row()
row.prop(props, "qa_reject_element_reason")
row = self.layout.row()
row.operator("bim.reject_element")
row = self.layout.row()
row.prop(props, "audit_ifc_class")
row = self.layout.row(align=True)
row.operator("bim.approve_class")
row.operator("bim.reject_class")
row = self.layout.row()
row.operator("bim.select_audited")
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -18,7 +18,7 @@
import gpu
import bmesh
import blenderbim.tool as tool
from .... import tool
from bpy.types import SpaceView3D
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
@@ -31,15 +31,15 @@ import ifcopenshell.util.shape
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import blenderbim.tool as tool
import blenderbim.bim.import_ifc as import_ifc
from .... import tool
from ... import import_ifc
from math import pi, inf, degrees, acos, radians
from mathutils import Vector, Matrix
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.model.decorator import ProfileDecorator
from blenderbim.bim.module.boundary.decorator import BoundaryDecorator
import blenderbim.core
import blenderbim.core.geometry
from ...ifc import IfcStore
from ..model.decorator import ProfileDecorator
from .decorator import BoundaryDecorator
from .... import core as core
from ....core import geometry as core_geometry
def get_boundaries_collection(blender_space):
@@ -521,7 +521,7 @@ class ShowBoundaries(bpy.types.Operator, tool.Ifc.Operator):
if not element or not getattr(element, "BoundedBy", None):
continue
if tool.Ifc.is_moved(obj):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
element = tool.Ifc.get_entity(obj)
for rel in element.BoundedBy or []:
boundary_obj = loader.load_boundary(rel, obj)
@@ -1014,7 +1014,7 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
def get_flattened_polygon(self, element, relating_space_obj, target_face_matrix_i):
obj = tool.Ifc.get_object(element)
if obj and tool.Ifc.is_moved(obj):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
space_matrix_i = relating_space_obj.matrix_world.inverted()
@@ -18,7 +18,7 @@
import bpy
from bpy.types import PropertyGroup
from blenderbim.bim.prop import ObjProperty
from ...prop import ObjProperty
from bpy.props import (
PointerProperty,
StringProperty,
@@ -29,7 +29,7 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
import blenderbim.tool as tool
from .... import tool
def space_filter(self, object):
@@ -17,11 +17,11 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
import blenderbim.tool as tool
from blenderbim.bim.module.boundary.data import SpaceBoundariesData
from ...ifc import IfcStore
from .... import tool
from .data import SpaceBoundariesData
class BIM_PT_SceneBoundaries(Panel):
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from blenderbim.tool.brick import BrickStore
from .... import tool
from ....tool.brick import BrickStore
try:
from rdflib import URIRef, BNode
@@ -19,11 +19,11 @@
import os
import bpy
import ifcopenshell.api
import blenderbim.tool as tool
import blenderbim.core.brick as core
import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore
from blenderbim.tool.brick import BrickStore
from .... import tool
from ....core import brick as core
from ... import handler as bim_handler
from ...ifc import IfcStore
from ....tool.brick import BrickStore
class LoadBrickProject(bpy.types.Operator, tool.Ifc.Operator):
@@ -197,7 +197,7 @@ class NewBrickFile(bpy.types.Operator):
}
IfcStore.add_transaction_operation(self, rollback=lambda data: True, commit=self.commit)
IfcStore.end_transaction(self)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def _execute(self, context):
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData
from blenderbim.bim.prop import StrProperty, Attribute
from .data import BrickschemaData, BrickschemaReferencesData
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -30,9 +30,9 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
import blenderbim.core.brick as core
import blenderbim.tool.brick as tool
from blenderbim.tool.brick import BrickStore
from ....core import brick as core
from ....tool import brick as tool
from ....tool.brick import BrickStore
def update_active_brick_index(self, context):
BrickschemaData.is_loaded = False
@@ -16,11 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.tool as tool
from .... import tool
from bpy.types import Panel, UIList
from blenderbim.bim.helper import prop_with_search
from blenderbim.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData
from blenderbim.tool.brick import BrickStore
from ...helper import prop_with_search
from .data import BrickschemaData, BrickschemaReferencesData
from ....tool.brick import BrickStore
class BIM_PT_brickschema(Panel):
@@ -18,8 +18,8 @@
import bpy
import bsdd
import blenderbim.tool as tool
from blenderbim.core import bsdd as core
from .... import tool
from ....core import bsdd as core
class LoadBSDDDomains(bpy.types.Operator):
@@ -18,7 +18,7 @@
import bpy
from bpy.types import PropertyGroup
from blenderbim.bim.prop import Attribute, StrProperty
from ...prop import Attribute, StrProperty
from bpy.props import (
PointerProperty,
StringProperty,
@@ -16,9 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.tool as tool
from .... import tool
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
from ...ifc import IfcStore
class BIM_PT_bsdd(Panel):
@@ -21,7 +21,7 @@ import math
import bmesh
import mathutils
import bpy_extras
import blenderbim.tool as tool
from .... import tool
from mathutils import Vector, Matrix
from math import pi, radians, sin, cos, sqrt
import ifcopenshell.util.unit
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.module.model.data import AuthoringData
from ..model.data import AuthoringData
from bpy.types import PropertyGroup
from math import pi
@@ -18,11 +18,11 @@
import os
import bpy
import blenderbim.tool as tool
import blenderbim.bim.module.type.prop as type_prop
from .... import tool
from ..type import prop as type_prop
import ifcopenshell.util.unit
from bpy.types import WorkSpaceTool
from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData
from ..model.data import AuthoringData, RailingData, RoofData
class CadTool(WorkSpaceTool):
@@ -19,7 +19,7 @@
import bpy
import json
import ifcopenshell.util.element
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -19,7 +19,7 @@
import blf
import gpu
import bmesh
import blenderbim.tool as tool
from .... import tool
from bpy.types import SpaceView3D
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
@@ -23,11 +23,11 @@ import bmesh
import logging
import numpy as np
import ifcopenshell
import blenderbim.tool as tool
from .... import tool
from math import radians
from mathutils import Matrix, Vector
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.clash.decorator import ClashDecorator
from ...ifc import IfcStore
from .decorator import ClashDecorator
class ExportClashSets(bpy.types.Operator):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, Attribute, BIMFilterGroup
from ...prop import StrProperty, Attribute, BIMFilterGroup
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from blenderbim.bim.module.clash.data import ClashData
from .data import ClashData
class BIM_PT_ifcclash(Panel):
@@ -92,7 +92,7 @@ class BIM_PT_ifcclash(Panel):
op.group = "a"
if source.mode != "a":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
layout, source.filter_groups, ClashData, f"clash_{props.active_clash_set_index}_a_{index}"
)
@@ -112,7 +112,7 @@ class BIM_PT_ifcclash(Panel):
op.group = "b"
if source.mode != "a":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
layout, source.filter_groups, ClashData, f"clash_{props.active_clash_set_index}_b_{index}"
)
@@ -20,8 +20,8 @@ import bpy
import ifcopenshell
import ifcopenshell.util.date
import ifcopenshell.util.classification
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from .... import tool
from ...ifc import IfcStore
def refresh():
@@ -22,9 +22,9 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.classification
import ifcopenshell.util.element
import blenderbim.tool as tool
import blenderbim.bim.helper
from blenderbim.bim.ifc import IfcStore
from .... import tool
from ... import helper as bim_helper
from ...ifc import IfcStore
class LoadClassificationLibrary(bpy.types.Operator, tool.Ifc.Operator):
@@ -63,7 +63,7 @@ class AddManualClassification(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMClassificationProperties
attributes = blenderbim.bim.helper.export_attributes(props.classification_attributes)
attributes = bim_helper.export_attributes(props.classification_attributes)
classification = ifcopenshell.api.run(
"classification.add_classification", tool.Ifc.get(), classification="Unnamed"
)
@@ -89,7 +89,7 @@ class AddManualClassificationReference(bpy.types.Operator, tool.Ifc.Operator):
else:
objects = [self.obj]
props = context.scene.BIMClassificationReferenceProperties
attributes = blenderbim.bim.helper.export_attributes(props.reference_attributes)
attributes = bim_helper.export_attributes(props.reference_attributes)
products = [
tool.Ifc.get().by_id(ifc_definition_id)
for obj in objects
@@ -140,7 +140,7 @@ class EnableAddingManualClassification(bpy.types.Operator):
props.is_adding = True
props.active_classification_id = 0
props.classification_attributes.clear()
blenderbim.bim.helper.import_attributes2("IfcClassification", props.classification_attributes)
bim_helper.import_attributes2("IfcClassification", props.classification_attributes)
return {"FINISHED"}
@@ -164,7 +164,7 @@ class EnableAddingManualClassificationReference(bpy.types.Operator):
props = context.scene.BIMClassificationReferenceProperties
props.is_adding = True
props.reference_attributes.clear()
blenderbim.bim.helper.import_attributes2("IfcClassificationReference", props.reference_attributes)
bim_helper.import_attributes2("IfcClassificationReference", props.reference_attributes)
return {"FINISHED"}
@@ -198,7 +198,7 @@ class EnableEditingClassification(bpy.types.Operator):
props = context.scene.BIMClassificationProperties
props.classification_attributes.clear()
blenderbim.bim.helper.import_attributes2(
bim_helper.import_attributes2(
tool.Ifc.get().by_id(self.classification), props.classification_attributes, callback
)
props.active_classification_id = self.classification
@@ -268,7 +268,7 @@ class EnableEditingClassificationReference(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMClassificationReferenceProperties
props.reference_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.reference), props.reference_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.reference), props.reference_attributes)
props.active_reference_id = self.reference
return {"FINISHED"}
@@ -17,10 +17,10 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.prop import StrProperty, Attribute
from blenderbim.bim.module.classification.data import ClassificationsData, ClassificationReferencesData
from ... import helper as bim_helper
from ...ifc import IfcStore
from ...prop import StrProperty, Attribute
from .data import ClassificationsData, ClassificationReferencesData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -16,12 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
import blenderbim.tool as tool
import blenderbim.bim.module.classification.prop as classification_prop
from ... import helper as bim_helper
from .... import tool
from . import prop as classification_prop
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.classification.data import (
from ...ifc import IfcStore
from .data import (
ClassificationsData,
ClassificationReferencesData,
MaterialClassificationsData,
@@ -67,7 +67,7 @@ class BIM_PT_classifications(Panel):
def draw_add_manual_ui(self, context):
if self.props.is_adding:
blenderbim.bim.helper.draw_attributes(self.props.classification_attributes, self.layout)
bim_helper.draw_attributes(self.props.classification_attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.add_manual_classification", text="Save", icon="CHECKMARK")
row.operator("bim.disable_adding_manual_classification", text="", icon="CANCEL")
@@ -104,7 +104,7 @@ class BIM_PT_classifications(Panel):
row = self.layout.row(align=True)
row.operator("bim.edit_classification", text="Save changes", icon="CHECKMARK")
row.operator("bim.disable_editing_classification", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.classification_attributes, self.layout)
bim_helper.draw_attributes(self.props.classification_attributes, self.layout)
def draw_ui(self, classification):
row = self.layout.row(align=True)
@@ -151,7 +151,7 @@ class ReferenceUI:
row = self.layout.row()
row.prop(self.props, "classifications", text="")
if self.props.is_adding:
blenderbim.bim.helper.draw_attributes(self.props.reference_attributes, self.layout)
bim_helper.draw_attributes(self.props.reference_attributes, self.layout)
row = self.layout.row(align=True)
op = row.operator("bim.add_manual_classification_reference", text="Save", icon="CHECKMARK")
op.obj_type = self.data.data["object_type"]
@@ -203,7 +203,7 @@ class ReferenceUI:
box = self.layout.box()
row = box.row()
row.label(text=pset.name, icon="COPY_ID")
blenderbim.bim.helper.draw_attributes(pset.properties, box)
bim_helper.draw_attributes(pset.properties, box)
def draw_add_file_ui(self, context):
if not self.data.data["active_classification_library"]:
@@ -243,7 +243,7 @@ class ReferenceUI:
row = self.layout.row(align=True)
row.operator("bim.edit_classification_reference", text="Save changes", icon="CHECKMARK")
row.operator("bim.disable_editing_classification_reference", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.reference_attributes, self.layout)
bim_helper.draw_attributes(self.props.reference_attributes, self.layout)
def draw_reference_ui(self, reference):
row = self.layout.row(align=True)
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -20,9 +20,9 @@ import bpy
import json
import ifcopenshell.api
import ifcopenshell.util.attribute
import blenderbim.bim.helper
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from ... import helper as bim_helper
from .... import tool
from ...ifc import IfcStore
class LoadObjectives(bpy.types.Operator):
@@ -62,7 +62,7 @@ class EnableEditingConstraint(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMConstraintProperties
props.constraint_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.constraint), props.constraint_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.constraint), props.constraint_attributes)
props.active_constraint_id = self.constraint
return {"FINISHED"}
@@ -18,8 +18,8 @@
import bpy
from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
from blenderbim.bim.prop import Attribute
from .... import tool
from ...prop import Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.helper import draw_attributes
from blenderbim.bim.module.constraint.data import ConstraintsData, ObjectConstraintsData
from ...ifc import IfcStore
from ...helper import draw_attributes
from .data import ConstraintsData, ObjectConstraintsData
class BIM_PT_constraints(Panel):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -17,11 +17,11 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
import blenderbim.core.context as core
import blenderbim.bim.module.context.data
import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore
from .... import tool
from ....core import context as core
from . import data as bim_module_context_data
from ... import handler as bim_handler
from ...ifc import IfcStore
class AddContext(bpy.types.Operator, tool.Ifc.Operator):
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, Attribute
from blenderbim.bim.module.context.data import ContextData
from ...prop import StrProperty, Attribute
from .data import ContextData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
import blenderbim.tool as tool
from blenderbim.bim.module.context.data import ContextData
from ... import helper as bim_helper
from .... import tool
from .data import ContextData
class BIM_PT_context(bpy.types.Panel):
@@ -56,7 +56,7 @@ class BIM_PT_context(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_context", icon="CHECKMARK")
row.operator("bim.disable_editing_context", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(ifc_context["props"], box)
bim_helper.draw_attributes(ifc_context["props"], box)
else:
row = box.row(align=True)
row.label(text=ifc_context["context_type"])
@@ -64,8 +64,8 @@ class BIM_PT_context(bpy.types.Panel):
row.operator("bim.remove_context", icon="X", text="").context = ifc_context["id"]
row = box.row(align=True)
blenderbim.bim.helper.prop_with_search(row, props, "subcontexts", text="")
blenderbim.bim.helper.prop_with_search(row, props, "target_views", text="")
bim_helper.prop_with_search(row, props, "subcontexts", text="")
bim_helper.prop_with_search(row, props, "target_views", text="")
op = row.operator("bim.add_context", icon="ADD", text="")
op.context_type = ifc_context["context_type"]
op.context_identifier = props.subcontexts
@@ -77,7 +77,7 @@ class BIM_PT_context(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_context", icon="CHECKMARK")
row.operator("bim.disable_editing_context", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(subcontext["props"], box)
bim_helper.draw_attributes(subcontext["props"], box)
else:
row = box.row(align=True)
row.label(text=subcontext["context_type"])
@@ -22,8 +22,8 @@ import ifcopenshell.util.cost
import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.unit
import blenderbim.tool as tool
import blenderbim.bim.schema
from .... import tool
from ... import schema as bim_schema
from ifcopenshell.util.doc import get_entity_doc, get_predefined_type_doc
from typing import Any
@@ -21,11 +21,11 @@ import bpy
import json
import time
import ifcopenshell.api
import blenderbim.bim.helper
import blenderbim.tool as tool
from ... import helper as bim_helper
from .... import tool
from bpy_extras.io_utils import ImportHelper
import blenderbim.tool as tool
import blenderbim.core.cost as core
from .... import tool
from ....core import cost as core
class AddCostSchedule(bpy.types.Operator, tool.Ifc.Operator):
@@ -18,11 +18,11 @@
import bpy
import ifcopenshell.api
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.classification.data import CostClassificationsData
from blenderbim.bim.module.cost.data import CostSchedulesData, CostItemRatesData, CostItemQuantitiesData
from blenderbim.bim.prop import StrProperty, Attribute
from .... import tool
from ...ifc import IfcStore
from ..classification.data import CostClassificationsData
from .data import CostSchedulesData, CostItemRatesData, CostItemQuantitiesData
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -16,11 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
import blenderbim.bim.module.cost.prop as CostProp
from ... import helper as bim_helper
from . import prop as CostProp
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.cost.data import CostSchedulesData
from ...ifc import IfcStore
from .data import CostSchedulesData
from typing import Any
@@ -131,7 +131,7 @@ class BIM_PT_cost_schedules(Panel):
row.operator("bim.add_currency", text="", icon="ADD")
def draw_editable_cost_schedule_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
bim_helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
def draw_editable_cost_item_ui(self):
row = self.layout.row(align=True)
@@ -188,7 +188,7 @@ class BIM_PT_cost_schedules(Panel):
self.draw_editable_cost_item_values_ui()
def draw_editable_cost_item_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.cost_item_attributes, self.layout)
bim_helper.draw_attributes(self.props.cost_item_attributes, self.layout)
def draw_editable_cost_item_quantities_ui(self, cost_item: dict[str, Any]):
quantities = CostSchedulesData.data["cost_quantities"]
@@ -225,7 +225,7 @@ class BIM_PT_cost_schedules(Panel):
op.physical_quantity = quantity["id"]
if self.props.active_cost_item_quantity_id and self.props.active_cost_item_quantity_id == quantity["id"]:
blenderbim.bim.helper.draw_attributes(self.props.quantity_attributes, self.layout.box())
bim_helper.draw_attributes(self.props.quantity_attributes, self.layout.box())
def draw_editable_cost_item_values_ui(self):
row = self.layout.row(align=True)
@@ -245,7 +245,7 @@ class BIM_PT_cost_schedules(Panel):
self.draw_readonly_cost_value_ui(row, cost_value)
if self.props.cost_value_editing_type == "ATTRIBUTES":
blenderbim.bim.helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
bim_helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
def draw_readonly_cost_value_ui(self, layout, cost_value):
if cost_value["name"]:
@@ -17,8 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, Attribute
#from blenderbim.bim.module.spatial.data import SpatialData
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -30,9 +29,6 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
#import blenderbim.tool as tool
#import blenderbim.core.geometry
#import ifcopenshell
class BIMCoveringProperties(PropertyGroup):
@@ -20,12 +20,12 @@
import os
import bpy
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.helper import prop_with_search
from blenderbim.bim.module.model.data import AuthoringData
from .... import tool
from ...helper import prop_with_search
from ..model.data import AuthoringData
from bpy.types import WorkSpaceTool
from blenderbim.bim.ifc import IfcStore
import blenderbim.bim.handler
from ...ifc import IfcStore
from ... import handler as bim_handler
class CoveringTool(WorkSpaceTool):
@@ -21,7 +21,7 @@ import json
import ifcopenshell
import ifcopenshell.util.element
from math import degrees, atan2
from blenderbim.bim.ifc import IfcStore
from ...ifc import IfcStore
from .api import Api
@@ -24,10 +24,10 @@ import logging
import tempfile
import ifcopenshell
import ifcopenshell.util.selector
import blenderbim.tool as tool
import blenderbim.bim.module.drawing.scheduler as scheduler
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.handler import refresh_ui_data
from .... import tool
from ..drawing import scheduler
from ...ifc import IfcStore
from ...handler import refresh_ui_data
class AddCsvAttribute(bpy.types.Operator):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, BIMFilterGroup
from ...prop import StrProperty, BIMFilterGroup
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.search.data import SearchData
from ...ifc import IfcStore
from ..search.data import SearchData
class BIM_PT_ifccsv(Panel):
@@ -85,7 +85,7 @@ class BIM_PT_ifccsv(Panel):
row.prop(props, "concat_value")
layout.use_property_split = False
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv")
bim_helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv")
row = layout.row(align=True)
op = row.operator("bim.search", text="Select", icon="VIEWZOOM")
@@ -23,6 +23,7 @@ import time
import random
import logging
import platform
import importlib
import subprocess
import ifcopenshell
import ifcopenshell.api
@@ -30,14 +31,16 @@ import ifcopenshell.geom
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import blenderbim.tool as tool
import blenderbim.core.debug as core
import blenderbim.bim.handler
import blenderbim.bim.import_ifc as import_ifc
from .... import tool
from ....core import debug as core
from ... import handler as bim_handler
from ... import import_ifc
from pathlib import Path
from blenderbim import get_debug_info, format_debug_info
from blenderbim.bim.ifc import IfcStore
from ...ifc import IfcStore
bbim = importlib.import_module("....", package=__package__)
get_debug_info = bbim.get_debug_info
format_debug_info = bbim.format_debug_info
class CopyDebugInformation(bpy.types.Operator):
bl_idname = "bim.copy_debug_information"
@@ -99,7 +102,7 @@ class ConvertToBlender(bpy.types.Operator):
context.scene.BIMProperties.ifc_file = ""
context.scene.BIMDebugProperties.attributes.clear()
IfcStore.purge()
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -406,7 +409,7 @@ class ParseExpress(bpy.types.Operator):
def execute(self, context):
core.parse_express(tool.Debug, context.scene.BIMDebugProperties.express_file)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -607,8 +610,6 @@ class PipInstall(bpy.types.Operator):
name: bpy.props.StringProperty()
def execute(self, context):
import blenderbim.bim
target = [p for p in sys.path if p.endswith("packages") and "addons" in p][0]
py_exec = str(sys.executable)
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from blenderbim.bim.prop import StrProperty, Attribute
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -29,7 +29,7 @@
# of "fetching data" and "displaying data" is a common concept that makes UI
# code much simpler, more efficient, and less error-prone to refresh data.
import blenderbim.tool as tool
from .... import tool
# All data must have a refresh function. The refresh function simply sets all
@@ -28,9 +28,9 @@
# "Operators", since they correlate to a single user operation.
import bpy
import blenderbim.tool as tool
import blenderbim.core.demo as core
import blenderbim.bim.handler
from .... import tool
from ....core import demo as core
from ... import handler as bim_handler
# Each button correlates to a class like the one below. In this case, we're
@@ -27,7 +27,7 @@
# panels, buttons, labels, and input fields are laid out.
import bpy
from blenderbim.bim.module.demo.data import DemoData
from .data import DemoData
# Every panel in the interface correlates to one of these classes. If you enable
# the "Developer Extras" option in Blender, then you can actually right click on
@@ -18,7 +18,7 @@
import bpy
import json
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -20,9 +20,10 @@ import bpy
import json
import logging
import ifcopenshell
import blenderbim.bim.handler
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from ... import import_ifc
from ... import handler as bim_handler
from .... import tool
from ...ifc import IfcStore
class SelectDiffJsonFile(bpy.types.Operator):
@@ -172,7 +173,7 @@ class ExecuteIfcDiff(bpy.types.Operator):
self.load_changed_elements(ifc_diff)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def load_changed_elements(self, ifc_diff):
@@ -181,8 +182,8 @@ class ExecuteIfcDiff(bpy.types.Operator):
active_ifc = tool.Ifc.get()
logger = logging.getLogger("ImportIFC")
ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger)
ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings)
ifc_import_settings = import_ifc.IfcImportSettings.factory(bpy.context, None, logger)
ifc_importer = import_ifc.IfcImporter(ifc_import_settings)
if self.props.active_file == "NEW":
tool.Ifc.set(ifc_diff.old)
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, BIMFilterGroup
from blenderbim.bim.module.diff.data import DiffData
from ...prop import StrProperty, BIMFilterGroup
from .data import DiffData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,10 +17,10 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.diff.data import DiffData
import blenderbim.bim.helper
import blenderbim.tool as tool
from ...ifc import IfcStore
from .data import DiffData
from ... import helper as bim_helper
from .... import tool
class BIM_PT_diff(Panel):
@@ -93,7 +93,7 @@ class BIM_PT_diff(Panel):
remove.collection = "diff_relationships"
remove.index = index
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, DiffData, "diff")
bim_helper.draw_filter(self.layout, props.filter_groups, DiffData, "diff")
row = layout.row()
row.operator("bim.execute_ifc_diff")
@@ -20,7 +20,7 @@ import os
import bpy
import ifcopenshell
import ifcopenshell.util.schema
import blenderbim.tool as tool
from .... import tool
def refresh():
@@ -20,9 +20,9 @@ import bpy
import json
import ifcopenshell.api
import ifcopenshell.util.attribute
import blenderbim.tool as tool
import blenderbim.core.document as core
from blenderbim.bim.ifc import IfcStore
from .... import tool
from ....core import document as core
from ...ifc import IfcStore
class LoadProjectDocuments(bpy.types.Operator, tool.Ifc.Operator):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.prop import StrProperty, Attribute
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel, UIList
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.helper import draw_attributes
from blenderbim.bim.module.document.data import DocumentData, ObjectDocumentData
from ...ifc import IfcStore
from ...helper import draw_attributes
from .data import DocumentData, ObjectDocumentData
class BIM_PT_documents(Panel):
@@ -20,7 +20,7 @@ import os
import bpy
import math
import bmesh
import blenderbim.tool as tool
from .... import tool
import ifcopenshell.util.element
from mathutils import Vector, Matrix
@@ -21,7 +21,7 @@ import bpy
import json
import ifcopenshell.util.element
import ifcopenshell.util.representation
import blenderbim.tool as tool
from .... import tool
from pathlib import Path
from typing import Any, Union
@@ -25,16 +25,16 @@ import bmesh
import shapely
import ifcopenshell
import ifcopenshell.util.element
import blenderbim.tool as tool
import blenderbim.bim.module.drawing.helper as helper
from .... import tool
from . import helper
from math import pi, sin, cos, tan, acos, atan, degrees, radians, ceil
from bpy.types import SpaceView3D
from mathutils import Vector, Matrix
from bpy_extras.view3d_utils import location_3d_to_region_2d
from gpu_extras.batch import batch_for_shader
from blenderbim.bim.module.drawing.data import DecoratorData, DrawingsData
from blenderbim.bim.module.drawing.shaders import add_verts_sequence, add_offsets
from blenderbim.bim.module.drawing.helper import format_distance
from .data import DecoratorData, DrawingsData
from .shaders import add_verts_sequence, add_offsets
from .helper import format_distance
from timeit import default_timer as timer
from functools import lru_cache
from typing import Optional, Iterator, Type, Union
@@ -23,7 +23,7 @@ from bpy import types
from mathutils import Vector
from mathutils import geometry
from bpy_extras import view3d_utils
from blenderbim.bim.module.drawing.shaders import DotsGizmoShader, ExtrusionGuidesShader
from .shaders import DotsGizmoShader, ExtrusionGuidesShader
from ifcopenshell.util.unit import si_conversions
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.module.drawing.decoration as decoration
import blenderbim.tool as tool
from . import decoration
from .... import tool
from bpy.app.handlers import persistent
@@ -19,7 +19,7 @@
import bpy
import math
import mathutils.geometry
import blenderbim.tool as tool
from .... import tool
from mathutils import Vector
# Code taken and updated from https://blenderartists.org/t/detecting-intersection-of-bounding-boxes/457520/2
@@ -35,23 +35,26 @@ import ifcopenshell.geom
import ifcopenshell.util.selector
import ifcopenshell.util.representation
import ifcopenshell.util.element
import blenderbim.bim.schema
import blenderbim.tool as tool
import blenderbim.core.drawing as core
import blenderbim.bim.module.drawing.svgwriter as svgwriter
import blenderbim.bim.module.drawing.annotation as annotation
import blenderbim.bim.module.drawing.sheeter as sheeter
import blenderbim.bim.module.drawing.scheduler as scheduler
import blenderbim.bim.module.drawing.helper as helper
import blenderbim.bim.export_ifc
from blenderbim.bim.module.drawing.decoration import CutDecorator
from blenderbim.bim.module.drawing.data import DecoratorData, DrawingsData
from ... import schema as bim_schema
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import geometry as core_geometry
from ....core import drawing as core
from . import svgwriter
from . import annotation
from . import sheeter
from . import scheduler
from . import helper
from ... import export_ifc as bim_export_ifc
from .decoration import CutDecorator
from .data import DecoratorData, DrawingsData
from typing import NamedTuple, List, Union, Optional, Literal
from lxml import etree
from mathutils import Vector, Color, Matrix
from timeit import default_timer as timer
from blenderbim.bim.module.drawing.prop import RasterStyleProperty, RASTER_STYLE_PROPERTIES_EXCLUDE
from blenderbim.bim.ifc import IfcStore
from .prop import RasterStyleProperty, RASTER_STYLE_PROPERTIES_EXCLUDE
from ...ifc import IfcStore
from pathlib import Path
from bpy_extras.image_utils import load_image
@@ -496,7 +499,7 @@ class CreateDrawing(bpy.types.Operator):
if self.sync and self.drawing_index == 0:
with profile("sync"):
# All very hackish whilst prototyping
exporter = blenderbim.bim.export_ifc.IfcExporter(None)
exporter = bim_export_ifc.IfcExporter(None)
exporter.file = tool.Ifc.get()
invalidated_elements = exporter.sync_all_objects()
invalidated_elements += exporter.sync_edited_objects()
@@ -1490,7 +1493,7 @@ class ActivateModel(bpy.types.Operator):
if model:
current_representation = tool.Geometry.get_active_representation(obj)
if current_representation != model:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -1829,7 +1832,7 @@ class SaveDrawingStylesData(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run(
"pset.edit_pset", ifc_file, pset=pset, properties={"CurrentShadingStyle": new_style_name}
)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -1858,7 +1861,7 @@ class ActivateDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run(
"pset.edit_pset", ifc_file, pset=pset, properties={"CurrentShadingStyle": self.drawing_style.name}
)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def set_raster_style(self, context):
@@ -2224,7 +2227,7 @@ class EditTextPopup(bpy.types.Operator):
# skip BoxAlignment since we're going to format it ourselves
attributes = [a for a in literal_props.attributes if a.name != "BoxAlignment"]
blenderbim.bim.helper.draw_attributes(attributes, box, popup_active_attribute=attributes[0])
bim_helper.draw_attributes(attributes, box, popup_active_attribute=attributes[0])
row = box.row(align=True)
cols = [row.column(align=True) for i in range(3)]
@@ -2308,7 +2311,7 @@ class AddTextLiteral(bpy.types.Operator):
"Path": "RIGHT",
"BoxAlignment": "bottom_left",
}
# emulates `blenderbim.bim.helper.import_attributes2(ifc_literal, literal_props.attributes)`
# emulates `bim_helper.import_attributes2(ifc_literal, literal_props.attributes)`
for attr_name in literal_attr_values:
attr = literal_attributes.add()
attr.name = attr_name
@@ -21,15 +21,15 @@ import bpy
import json
import enum
import ifcopenshell
import blenderbim.tool as tool
import blenderbim.core.drawing as core
import blenderbim.bim.module.drawing.annotation as annotation
import blenderbim.bim.module.drawing.decoration as decoration
from blenderbim.bim.prop import BIMFilterGroup
from blenderbim.bim.module.drawing.data import DrawingsData, DecoratorData, SheetsData, AnnotationData
from blenderbim.bim.module.drawing.data import refresh as refresh_drawing_data
from .... import tool
from ....core import drawing as core
from . import annotation
from . import decoration
from ...prop import BIMFilterGroup
from .data import DrawingsData, DecoratorData, SheetsData, AnnotationData
from .data import refresh as refresh_drawing_data
from pathlib import Path
from blenderbim.bim.prop import Attribute, StrProperty
from ...prop import Attribute, StrProperty
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -23,7 +23,7 @@ import string
import svgwrite
import openpyxl
from blenderbim.bim.module.drawing.svgwriter import SvgWriter
from .svgwriter import SvgWriter
from odf.opendocument import load as load_ods
from odf.table import Table, TableRow, TableColumn, TableCell
from odf.text import P
@@ -24,7 +24,7 @@ import ntpath
import pystache
import urllib.parse
import xml.etree.ElementTree as ET
import blenderbim.tool as tool
from .... import tool
import ifcopenshell.util.geolocation
from xml.dom import minidom
from mathutils import Vector
@@ -29,13 +29,13 @@ import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.selector
import blenderbim.tool as tool
import blenderbim.bim.module.drawing.helper as helper
import blenderbim.bim.module.drawing.annotation as annotation
from blenderbim.bim.module.drawing.data import DrawingsData
from .... import tool
from . import helper
from . import annotation
from .data import DrawingsData
from blenderbim.bim.module.drawing.data import DecoratorData
from blenderbim.bim.ifc import IfcStore
from .data import DecoratorData
from ...ifc import IfcStore
from math import pi, ceil, atan, degrees, acos
from mathutils import geometry, Vector
@@ -17,10 +17,10 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
import blenderbim.tool as tool
from ... import helper as bim_helper
from .... import tool
from bpy.types import Panel
from blenderbim.bim.module.drawing.data import (
from .data import (
ProductAssignmentsData,
SheetsData,
DocumentsData,
@@ -119,7 +119,7 @@ class BIM_PT_element_filters(Panel):
props = context.scene.camera.data.BIMCameraProperties
if props.filter_mode == "INCLUDE":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
self.layout, props.include_filter_groups, ElementFiltersData, "drawing_include"
)
row = self.layout.row(align=True)
@@ -128,7 +128,7 @@ class BIM_PT_element_filters(Panel):
).filter_mode = "INCLUDE"
row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE"
elif props.filter_mode == "EXCLUDE":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
self.layout, props.exclude_filter_groups, ElementFiltersData, "drawing_exclude"
)
row = self.layout.row(align=True)
@@ -532,7 +532,7 @@ class BIM_PT_text(Panel):
# skip BoxAlignment since we're going to format it ourselves
attributes = [a for a in literal_props.attributes if a.name != "BoxAlignment"]
blenderbim.bim.helper.draw_attributes(attributes, box)
bim_helper.draw_attributes(attributes, box)
row = box.row(align=True)
cols = [row.column(align=True) for i in range(3)]
@@ -19,13 +19,14 @@
import os
import bpy
import blenderbim.tool as tool
from blenderbim.bim.helper import prop_with_search
from ....core import type as core_type
from .... import tool
from ...helper import prop_with_search
from bpy.types import WorkSpaceTool
from blenderbim.bim.module.drawing.data import DecoratorData, AnnotationData
from blenderbim.bim.ifc import IfcStore
import blenderbim.bim.handler
from .data import DecoratorData, AnnotationData
from ...ifc import IfcStore
from ... import handler as bim_handler
class LaunchAnnotationTypeManager(bpy.types.Operator):
@@ -170,7 +171,7 @@ def create_annotation_occurrence(context):
ifc_representation_class=tool.Drawing.get_ifc_representation_class(object_type),
)
blenderbim.core.type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
core_type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
tool.Ifc.run("group.assign_group", group=tool.Drawing.get_drawing_group(drawing), products=[element])
tool.Collector.assign(obj)
@@ -23,8 +23,8 @@ import ifcfm
import logging
import tempfile
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.operator import MultipleFileSelector
from .... import tool
from ...operator import MultipleFileSelector
class SelectFMIfcFile(MultipleFileSelector):
@@ -17,8 +17,8 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blenderbim.bim.module.fm.data import FMData
from blenderbim.bim.prop import StrProperty
from .data import FMData
from ...prop import StrProperty
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.tool as tool
from .... import tool
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.fm.data import FMData
from ...ifc import IfcStore
from .data import FMData
class BIM_PT_fm(Panel):
@@ -18,7 +18,7 @@
import bpy
import ifcopenshell.util.element
import blenderbim.tool as tool
from .... import tool
import ifcopenshell.util.placement
from mathutils import Vector
@@ -21,7 +21,7 @@ import bmesh
import mathutils
import ifcopenshell
import ifcopenshell.util.unit
import blenderbim.tool as tool
from .... import tool
from math import pi, pow
from mathutils import Vector, Matrix, geometry
from typing import Union
@@ -28,17 +28,17 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.placement
import ifcopenshell.api
import blenderbim.core.geometry
import blenderbim.core.geometry as core
import blenderbim.core.aggregate
import blenderbim.core.style
import blenderbim.core.root
import blenderbim.core.drawing
import blenderbim.tool as tool
import blenderbim.bim.handler
from ....core import geometry as core_geometry
from ....core import geometry as core
from ....core import aggregate as core_aggregate
from ....core import style as core_style
from ....core import root as core_root
from ....core import drawing as core_drawing
from .... import tool
from ... import handler as bim_handler
from mathutils import Vector, Matrix
from time import time
from blenderbim.bim.ifc import IfcStore
from ...ifc import IfcStore
from ifcopenshell.util.shape_builder import ShapeBuilder
from typing import Any
@@ -89,7 +89,7 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
if new_obj == obj:
continue
# This is not very efficient, it needlessly copies the representations first.
blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new_objs.append(new_obj)
for new_obj in new_objs:
bpy.ops.bim.update_representation(obj=new_obj.name)
@@ -874,7 +874,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# Prior to duplicating, sync the object placement to make decomposition recreation more stable.
if tool.Ifc.is_moved(obj):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
new_obj = obj.copy()
temp_data = None
@@ -897,7 +897,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# clear object's collection so it will be able to have it's own
new_obj.BIMObjectProperties.collection = None
# copy the actual class
new = blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new = core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
# clean up the orphaned mesh with ifc id of the original object to avoid confusion
# IfcGridAxis keeps the same mesh data (it's pointing to ifc id 0, so it's not a problem)
@@ -934,7 +934,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# Recreate decompositions
tool.Root.recreate_decompositions(decomposition_relationships, old_to_new)
OverrideDuplicateMove.remove_linked_aggregate_data(old_to_new)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return old_to_new
@staticmethod
@@ -1200,7 +1200,7 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
if location_from_3d_cursor:
get_location_from_3d_cursor(old_to_new, selected_element)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return old_to_new
@@ -1430,7 +1430,7 @@ class RefreshLinkedAggregate(bpy.types.Operator):
new_aggregate = ifcopenshell.util.element.get_aggregate(new[0])
if not new_aggregate:
blenderbim.core.aggregate.assign_object(
core_aggregate.assign_object(
tool.Ifc,
tool.Aggregate,
tool.Collector,
@@ -1442,7 +1442,7 @@ class RefreshLinkedAggregate(bpy.types.Operator):
new_obj = tool.Ifc.get_object(new[0])
set_original_name(new_obj, original_names)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
operator_time = time() - refresh_start_time
if operator_time > 10:
@@ -1919,7 +1919,7 @@ def poll_editing_representaiton_item_style(cls, context):
if shape_aspect == "":
return True
from blenderbim.bim.module.material.data import ObjectMaterialData
from ..material.data import ObjectMaterialData
if not ObjectMaterialData.is_loaded:
ObjectMaterialData.load()
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.tool as tool
from blenderbim.bim.prop import StrProperty, Attribute
from blenderbim.bim.module.geometry.data import RepresentationsData, ViewportData
from .... import tool
from ...prop import StrProperty, Attribute
from .data import RepresentationsData, ViewportData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -56,7 +56,7 @@ def get_mode(self, context):
def get_styles(self, context):
# postponed import to avoid circular import
from blenderbim.bim.module.material.data import MaterialsData
from ..material.data import MaterialsData
if not MaterialsData.is_loaded:
MaterialsData.load()
@@ -70,7 +70,7 @@ def get_shape_aspects(self, context):
def get_material_constituents(self, context, edit_text):
from blenderbim.bim.module.material.data import ObjectMaterialData
from ..material.data import ObjectMaterialData
if not ObjectMaterialData.is_loaded:
ObjectMaterialData.load()
@@ -17,19 +17,19 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim
import blenderbim.tool as tool
from .... import bim
from .... import tool
from bpy.types import Panel, Menu, UIList
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.helper import prop_with_search
from blenderbim.bim.module.geometry.data import (
from ...ifc import IfcStore
from ...helper import prop_with_search
from .data import (
RepresentationsData,
RepresentationItemsData,
ConnectionsData,
PlacementData,
DerivedCoordinatesData,
)
from blenderbim.bim.module.layer.data import LayersData
from ..layer.data import LayersData
def mode_menu(self, context):
@@ -38,7 +38,7 @@ def mode_menu(self, context):
row = self.layout.row(align=True)
if context.scene.BIMGeometryProperties.mode == "EDIT":
row.operator("bim.override_mode_set_object", icon="CANCEL", text="Discard Changes").should_save = False
row.prop(context.scene.BIMGeometryProperties, "mode", text="", icon_value=blenderbim.bim.icons["IFC"].icon_id)
row.prop(context.scene.BIMGeometryProperties, "mode", text="", icon_value=bim.icons["IFC"].icon_id)
def object_menu(self, context):
@@ -69,7 +69,7 @@ class BIM_MT_hotkey_separate(Menu):
bl_label = "Separate"
def draw(self, context):
self.layout.label(text="IFC Separate", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.label(text="IFC Separate", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("bim.override_mesh_separate", text="Selection").type = "SELECTED"
self.layout.operator("bim.override_mesh_separate", text="By Material").type = "MATERIAL"
self.layout.operator("bim.override_mesh_separate", text="By Loose Parts").type = "LOOSE"
@@ -19,7 +19,7 @@
import bpy
import numpy as np
import blenderbim.tool as tool
from .... import tool
import ifcopenshell.util.geolocation
from mathutils import Matrix
from ifcopenshell.util.doc import get_entity_doc
@@ -20,13 +20,13 @@ import blf
import gpu
import bmesh
import ifcopenshell
import blenderbim.tool as tool
from .... import tool
from math import radians
from bpy.types import SpaceView3D
from mathutils import Vector, Matrix
from gpu_extras.batch import batch_for_shader
from bpy_extras.view3d_utils import location_3d_to_region_2d
from blenderbim.bim.module.georeference.data import GeoreferenceData
from .data import GeoreferenceData
class GeoreferenceDecorator:
@@ -18,9 +18,9 @@
import bpy
import blenderbim.tool as tool
import blenderbim.core.georeference as core
from blenderbim.bim.module.georeference.decorator import GeoreferenceDecorator
from .... import tool
from ....core import georeference as core
from .decorator import GeoreferenceDecorator
class AddGeoreferencing(bpy.types.Operator, tool.Ifc.Operator):

Some files were not shown because too many files have changed in this diff Show More