Merge branch 'v0.8.0' into saikei

This commit is contained in:
Dion Moult
2026-02-19 10:22:31 +11:00
committed by GitHub
684 changed files with 32439 additions and 30707 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ jobs:
cd .. cd ..
- name: Configure AWS credentials - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5 uses: aws-actions/configure-aws-credentials@v6
with: with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
+1 -1
View File
@@ -77,7 +77,7 @@ jobs:
git push || echo "Push failed" git push || echo "Push failed"
- name: Configure AWS credentials - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5 uses: aws-actions/configure-aws-credentials@v6
with: with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
+1 -1
View File
@@ -118,7 +118,7 @@ jobs:
cd .. cd ..
- name: Configure AWS credentials - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5 uses: aws-actions/configure-aws-credentials@v6
with: with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
+1 -1
View File
@@ -118,7 +118,7 @@ jobs:
cd .. cd ..
- name: Configure AWS credentials - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5 uses: aws-actions/configure-aws-credentials@v6
with: with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
+1 -1
View File
@@ -73,7 +73,7 @@ jobs:
git push || echo "Push failed" git push || echo "Push failed"
- name: Configure AWS Credentials - name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5 uses: aws-actions/configure-aws-credentials@v6
with: with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
+6 -1
View File
@@ -35,7 +35,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
pyver: [py311, py312] pyver: [py311, py312, py313]
config: config:
- { - {
name: "Windows Build", name: "Windows Build",
@@ -53,6 +53,11 @@ jobs:
name: "MacOS ARM Build", name: "MacOS ARM Build",
short_name: macosm1, short_name: macosm1,
} }
exclude:
# Python 3.13 is needed for Blender 5.1+ and Blender dropped Intel Mac support in 5.0.
- pyver: py313
config:
short_name: macos
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python - uses: actions/setup-python@v6 # https://github.com/actions/setup-python
+23 -5
View File
@@ -53,7 +53,6 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install xmlschema xsdata numpy lxml pytest isodate lark networkx tabulate python-dateutil shapely pip install xmlschema xsdata numpy lxml pytest isodate lark networkx tabulate python-dateutil shapely
pip install src/bcf --no-deps pip install src/bcf --no-deps
pip install git+https://github.com/zdhoward/aud
pip install pytest-xdist==3.8.0 pip install pytest-xdist==3.8.0
- name: Install C++ dependencies - name: Install C++ dependencies
@@ -209,17 +208,36 @@ jobs:
- name: Build standalone examples to test cmake package - name: Build standalone examples to test cmake package
run: | run: |
set -x
cd src/examples cd src/examples
mkdir build && cd build mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \ cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build . cmake --build .
./arbitrary_open_profile_def && test -f arbitrary_open_profile_def.ifc
./composite_profile_def && test -f composite_profile_def.ifc
./csg_primitive && test -f csg_primitive.ifc
./ellipse_pies && test -f ellipse_pies.ifc
./faces && test -f faces.ifc
./ifc_curve_rebar && test -f ifc_curve_rebar.ifc
./profiles
test -f IfcUShapeProfileDef.ifc
test -f IfcTShapeProfileDef.ifc
test -f IfcZShapeProfileDef.ifc
test -f IfcEllipseProfileDef.ifc
test -f IfcIShapeProfileDef.ifc
test -f IfcLShapeProfileDef.ifc
test -f IfcCShapeProfileDef.ifc
test -f IfcCircleProfileDef.ifc
test -f IfcRectangleProfileDef.ifc
test -f IfcTrapeziumProfileDef.ifc
./IfcParseExamples "../IfcParseExamples_test.ifc" ./IfcParseExamples "../IfcParseExamples_test.ifc"
./IfcOpenHouse ./IfcOpenHouse && test -f IfcOpenHouse.ifc
./IfcAdvancedHouse ./IfcAdvancedHouse && test -f IfcAdvancedHouse.ifc
./IfcAlignment ./IfcAlignment && test -f IfcAlignment.ifc
./IfcSimplifiedAlignment ./IfcSimplifiedAlignment && test -f IfcSimplifiedAlignment.ifc
./triangulated_faceset && test -f triangulated_faceset.ifc
- name: Test ifcopenshell-python - name: Test ifcopenshell-python
run: | run: |
+2
View File
@@ -82,6 +82,8 @@ src/bonsai/bonsai/translations.py
# bonsai test temp files # bonsai test temp files
src/bonsai/test/files/temp src/bonsai/test/files/temp
src/bonsai/test/files/basic.ifc.cache.blend
src/bonsai/test/files/basic.ifc.cache.sqlite
# bonsai data # bonsai data
src/bonsai/bonsai/bim/data/build/ src/bonsai/bonsai/bim/data/build/
+153
View File
@@ -0,0 +1,153 @@
<!-- This file was generated with the assistance of an AI coding tool. -->
# AGENTS.md
Guidelines for AI coding agents contributing to IfcOpenShell. This file is
intended to be read by all AI agents regardless of platform (Claude Code,
Copilot, Cursor, etc.) in addition to any tool-specific configuration files.
Human contributors using AI tools should also read this document carefully,
as they are responsible for ensuring their contributions comply with these
guidelines.
## Project Overview
IfcOpenShell is an open source library for working with Industry Foundation
Classes (IFC). It provides C++ and Python APIs, geometry processing, and an
ecosystem of tools including IfcConvert and the Bonsai Blender add-on.
## Licensing
All contributions must be compatible with the project's licensing:
- **Library code** (everything except Bonsai): **LGPL-3.0-or-later**
- **Bonsai** (`src/bonsai/`): **GPL-3.0-or-later**
There is no Contributor License Agreement (CLA). By submitting a pull request,
you agree that your contribution is licensed under the applicable license above.
## Indicating AI-Generated Code
Contributors must clearly indicate when code has been generated or
substantially written by an AI tool.
### Commits
Commits that modify existing code must include a note in the **body** of the
commit message (not the subject line) indicating that the change was
AI-generated. For example:
```
Fix off-by-one error in element iteration
The loop termination condition was incorrect when processing
IfcRelAggregates relationships.
Generated with the assistance of an AI coding tool.
```
### New Files
New files that are AI-generated must include a comment near the top of the
file indicating this. Use the appropriate comment syntax for the language:
```python
# This file was generated with the assistance of an AI coding tool.
```
```cpp
// This file was generated with the assistance of an AI coding tool.
```
### Pull Requests
Pull requests containing AI-generated code must indicate in the PR description
which parts of the contribution are AI-generated. If the entire PR is
AI-generated, state that clearly. If only specific commits or files are
AI-generated, identify them.
## Pull Request Guidelines
### Scope and Size
- Each pull request should address a **single issue or feature**.
- Do not mix unrelated changes (e.g., bug fixes with refactoring or style
changes) in the same PR.
- Large pull requests should be broken down into **multiple small, standalone
commits** that are each easy to review independently. Rewrite commit history
for this purpose if necessary.
- PRs that are minimal, focused solutions to a specific problem are much more
likely to be accepted.
### What to Avoid
- **Over-engineering**: Do not add features, abstractions, or configurability
beyond what is needed to solve the immediate problem.
- **Scope creep**: Do not make changes to files or code that are not directly
related to the task at hand.
- **Unnecessary additions**: Do not add docstrings, comments, type annotations,
or error handling to code you did not otherwise need to change.
- **Cosmetic changes**: Do not reformat, rename, or reorganize code that is
unrelated to your change.
## Commit Messages
- The **subject line** must be **50 characters or less**.
- Use the **imperative mood** (e.g., "Fix crash in geometry kernel", not
"Fixed crash" or "Fixes crash").
- A commit message can be a single line if the purpose is obvious from the
subject alone.
- Otherwise, add a blank line after the subject followed by a short explanation
of a few lines in the body.
## Code Style
### Python
- **Line length**: 120 characters
- **Formatter**: black
- **Linter**: ruff
- Configuration is in `pyproject.toml`
### C++
- **Standard**: C++17 minimum
- **Formatter**: clang-format (configuration in `.clang-format`)
- **Linter**: clang-tidy (configuration in `.clang-tidy`)
Run linters and formatters **before submitting** your pull request. Do not rely
on CI to catch formatting issues.
## Testing
- Pull requests with test coverage are **much more likely to be merged**.
- If tests are appropriate and feasible for your change, they should be
included.
- Tests are not required for every change (e.g., documentation-only changes),
but the expectation is that testable code changes come with tests.
- Python tests use **pytest** and are located in `test/` or `tests/` directories
within each package under `src/`.
- Run the existing test suite for the package you modified before submitting.
## Architecture Quick Reference
### Directory Structure
- `src/ifcparse/` — C++ IFC file parsing
- `src/ifcgeom/` — C++ geometry processing (OpenCASCADE and CGAL kernels)
- `src/serializers/` — Output format serializers (glTF, Collada, SVG, etc.)
- `src/ifcwrap/` — SWIG Python bindings
- `src/ifcconvert/` — CLI conversion tool
- `src/ifcopenshell-python/` — Python API (`ifcopenshell` package)
- `src/bonsai/` — Blender add-on (GPL-3.0-or-later)
- `src/ifctester/` — IDS model auditing
- `src/ifcpatch/` — IFC file manipulation scripts
- `src/ifcdiff/` — IFC model comparison
- `src/ifcclash/` — Clash detection
- `src/ifccsv/` — Schedule import/export
### IFC Schema Versions
The library supports IFC2x3 TC1, IFC4 Add2 TC1, IFC4x1, IFC4x2, and
IFC4x3 Add2. Schema-specific code is compiled conditionally. Be aware of
which schema versions your change affects.
+9 -5
View File
@@ -13,7 +13,14 @@ include(CMakeFindDependencyMacro)
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME OFF) set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
set(Boost_COMPONENTS system program_options regex thread date_time iostreams) set(Boost_COMPONENTS
system
program_options
regex
thread
date_time
iostreams
)
find_dependency(Boost CONFIG COMPONENTS ${Boost_COMPONENTS}) find_dependency(Boost CONFIG COMPONENTS ${Boost_COMPONENTS})
find_dependency(Eigen3 CONFIG) find_dependency(Eigen3 CONFIG)
@@ -39,7 +46,6 @@ if(IFCOPENSHELL_IFCXML)
find_dependency(LibXml2 CONFIG) find_dependency(LibXml2 CONFIG)
endif() endif()
if(IFCOPENSHELL_WITH_CGAL) if(IFCOPENSHELL_WITH_CGAL)
find_dependency(CGAL CONFIG) find_dependency(CGAL CONFIG)
endif() endif()
@@ -48,9 +54,7 @@ if(IFCOPENSHELL_WITH_OPENCASCADE)
find_dependency(OpenCASCADE CONFIG) find_dependency(OpenCASCADE CONFIG)
if(OpenCASCADE_VERSION VERSION_LESS "7.7.0") if(OpenCASCADE_VERSION VERSION_LESS "7.7.0")
# cmake configs < 7.7.0 were not adding include directories to targets automatically. # cmake configs < 7.7.0 were not adding include directories to targets automatically.
set_target_properties(TKernel PROPERTIES set_target_properties(TKernel PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OpenCASCADE_INCLUDE_DIR}")
INTERFACE_INCLUDE_DIRECTORIES "${OpenCASCADE_INCLUDE_DIR}"
)
endif() endif()
endif() endif()
+6 -13
View File
@@ -25,19 +25,12 @@ file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}") string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files}) foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}") set(filepath "$ENV{DESTDIR}${file}")
message(STATUS "Uninstalling ${filepath}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") if(IS_SYMLINK "${filepath}" OR EXISTS "${filepath}")
exec_program( file(REMOVE "${filepath}")
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" else(NOT EXISTS "${filepath}")
OUTPUT_VARIABLE rm_out message(STATUS "File ${filepath} does not exist.")
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif() endif()
endforeach() endforeach()
+19 -24
View File
@@ -1,14 +1,10 @@
#Look for an executable called sphinx-build #Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Path to sphinx-build executable")
NAMES sphinx-build
DOC "Path to sphinx-build executable")
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
#Handle standard arguments to find_package like REQUIRED and QUIET #Handle standard arguments to find_package like REQUIRED and QUIET
find_package_handle_standard_args(Sphinx find_package_handle_standard_args(Sphinx "Failed to find sphinx-build executable" SPHINX_EXECUTABLE)
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE)
find_package(Doxygen REQUIRED) find_package(Doxygen REQUIRED)
#find_package(Sphinx REQUIRED) #find_package(Sphinx REQUIRED)
@@ -16,25 +12,24 @@ find_package(Doxygen REQUIRED)
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}) set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx) set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx)
MESSAGE(STATUS "SPHINX BUILD ${CMAKE_CURRENT_BINARY_DIR}") message(STATUS "SPHINX BUILD ${CMAKE_CURRENT_BINARY_DIR}")
file(MAKE_DIRECTORY ./output/doxygen) file(MAKE_DIRECTORY ./output/doxygen)
if (DOXYGEN_FOUND) if(DOXYGEN_FOUND)
add_custom_target(
Sphinx
ALL
COMMAND ${SPHINX_EXECUTABLE} -v -T -b html ${SPHINX_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/output
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output
COMMENT "Generating documentation with Sphinx"
)
add_custom_target(Sphinx ALL # add_custom_target(ifcopenshell_python_docs ALL
COMMAND # COMMAND make html
${SPHINX_EXECUTABLE} -v -T -b html # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcblenderexport/docs
${SPHINX_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/output # OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcblenderexport/docs
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output # COMMENT "Generating documentation with Sphinx")
COMMENT "Generating documentation with Sphinx") else(DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
# add_custom_target(ifcopenshell_python_docs ALL endif(DOXYGEN_FOUND)
# COMMAND make html
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcblenderexport/docs
# OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcblenderexport/docs
# COMMENT "Generating documentation with Sphinx")
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
+2
View File
@@ -1177,6 +1177,8 @@ if "cgal" in targets:
# Disable assembly, otherwise `emcc -c conftest.s` will crash due to assembly mismatch. # Disable assembly, otherwise `emcc -c conftest.s` will crash due to assembly mismatch.
gmp_args.extend(("--disable-assembly", "--enable-cxx")) gmp_args.extend(("--disable-assembly", "--enable-cxx"))
mpfr_args.extend(("--host", "none")) mpfr_args.extend(("--host", "none"))
elif "x86" in arch:
gmp_args.append("--enable-fat") # See issues #7458 #7556
OLD_CC = None OLD_CC = None
if MAC_CROSS_COMPILE_INTEL: if MAC_CROSS_COMPILE_INTEL:
+4 -4
View File
@@ -2,10 +2,10 @@
name = "IfcOpenShell" name = "IfcOpenShell"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"black==25.12", "black==26.1.0",
"ruff==0.14.13", "ruff==0.15.1",
"poethepoet", "poethepoet",
"gersemi==0.25.1", "gersemi==0.25.4",
] ]
[tool.black] [tool.black]
@@ -82,4 +82,4 @@ black = "black ."
format.sequence = ["black", "ruff-main", "ruff-old"] format.sequence = ["black", "ruff-main", "ruff-old"]
cmake-format = "gersemi cmake src --in-place" cmake-format = "gersemi . --in-place"
+2 -1
View File
@@ -2,6 +2,8 @@ import tempfile
from pathlib import Path from pathlib import Path
from typing import Optional, Union from typing import Optional, Union
from typing_extensions import assert_never
import bcf.agnostic.model as mdl import bcf.agnostic.model as mdl
import bcf.v2.bcfxml import bcf.v2.bcfxml
import bcf.v2.model import bcf.v2.model
@@ -9,7 +11,6 @@ import bcf.v2.topic
import bcf.v3.bcfxml import bcf.v3.bcfxml
import bcf.v3.model import bcf.v3.model
import bcf.v3.topic import bcf.v3.topic
from typing_extensions import assert_never
TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler] TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler]
+1 -1
View File
@@ -14,7 +14,7 @@
# Currently extensions support for v2 is only read-only. # Currently extensions support for v2 is only read-only.
from dataclasses import dataclass, field, fields from dataclasses import dataclass, field
from typing import Optional from typing import Optional
+1 -2
View File
@@ -3,11 +3,10 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
import tempfile
import uuid import uuid
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from typing import Any, NoReturn, Optional, Union from typing import Any, NoReturn, Optional
import numpy as np import numpy as np
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
+1 -1
View File
@@ -1,7 +1,7 @@
import uuid import uuid
import zipfile import zipfile
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any, Literal, Optional, Union from typing import Literal, Optional, Union
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.unit import ifcopenshell.util.unit
-1
View File
@@ -24,7 +24,6 @@ import time
import urllib.parse import urllib.parse
import uuid import uuid
import webbrowser import webbrowser
from re import A
from typing import Any, Optional from typing import Any, Optional
import requests import requests
+1 -1
View File
@@ -1,7 +1,7 @@
"""BCF XML V3 Documents handler.""" """BCF XML V3 Documents handler."""
import zipfile import zipfile
from typing import Any, Optional from typing import Optional
import bcf.v3.model as mdl import bcf.v3.model as mdl
from bcf.inmemory_zipfile import ZipFileInterface from bcf.inmemory_zipfile import ZipFileInterface
+1 -1
View File
@@ -1,7 +1,7 @@
import uuid import uuid
import zipfile import zipfile
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any, Literal, Optional, Union from typing import Literal, Optional, Union
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.unit import ifcopenshell.util.unit
+6
View File
@@ -140,3 +140,9 @@ max-attributes = 10
[tool.pylint.format] [tool.pylint.format]
expected-line-ending-format = "LF" expected-line-ending-format = "LF"
max-line-length = 120 max-line-length = 120
[tool.ruff]
extend = "../../pyproject.toml"
lint.select = [
"F401", # unused imports
]
+1
View File
@@ -1,4 +1,5 @@
import pytest import pytest
from bcf.xml_parser import XmlParserSerializer from bcf.xml_parser import XmlParserSerializer
+2 -1
View File
@@ -4,8 +4,9 @@ import uuid
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import bcf.v2.model as mdl
import pytest import pytest
import bcf.v2.model as mdl
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
from bcf.v2.topic import TopicHandler from bcf.v2.topic import TopicHandler
from bcf.v2.visinfo import ( from bcf.v2.visinfo import (
+2 -1
View File
@@ -3,10 +3,11 @@ import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from xsdata.models.datatype import XmlDateTime
import bcf.v2.model as mdl import bcf.v2.model as mdl
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
from bcf.v2.topic import TopicHandler from bcf.v2.topic import TopicHandler
from xsdata.models.datatype import XmlDateTime
def test_maximum_information() -> None: def test_maximum_information() -> None:
+1
View File
@@ -1,5 +1,6 @@
import numpy as np import numpy as np
import pytest import pytest
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
+2 -1
View File
@@ -4,8 +4,9 @@ import uuid
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import bcf.v3.model as mdl
import pytest import pytest
import bcf.v3.model as mdl
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
from bcf.v3.topic import TopicHandler from bcf.v3.topic import TopicHandler
from bcf.v3.visinfo import ( from bcf.v3.visinfo import (
+2 -3
View File
@@ -1,12 +1,11 @@
import json
import os import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from xsdata.models.datatype import XmlDateTime
import bcf.v3.model as mdl import bcf.v3.model as mdl
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
from bcf.v3.topic import TopicHandler
from xsdata.models.datatype import XmlDateTime
def test_doc_ref_internal() -> None: def test_doc_ref_internal() -> None:
+1
View File
@@ -1,5 +1,6 @@
import numpy as np import numpy as np
import pytest import pytest
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
+22
View File
@@ -0,0 +1,22 @@
# Build Bonsai .zip.
# Usage:
# # While in `bonsai` folder.
# docker build -t bonsai-dist .
# # Output zip file will be in `dist` folder.
# # See possible values for variables in `Makefile`'s `dist` target description.
# docker run --rm -v "$PWD/../../:/work" -w /work -e PLATFORM=win -e PYVERSION=py313 bonsai-dist
FROM ubuntu:24.04
RUN apt-get update
RUN apt-get install -y make git wget unzip zip
# Python
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y python3.11 python3.11-venv
RUN apt-get install -y npm
WORKDIR /work
CMD cd src/bonsai && make dist PLATFORM=$PLATFORM PYVERSION=$PYVERSION
+41 -21
View File
@@ -48,18 +48,33 @@ VERSION_PATCH:=$(shell cat '../../VERSION' | cut -d '.' -f 3)
VERSION_DATE:=$(shell date '+%y%m%d') VERSION_DATE:=$(shell date '+%y%m%d')
LAST_COMMIT_HASH:=$(shell git rev-parse HEAD) LAST_COMMIT_HASH:=$(shell git rev-parse HEAD)
LAST_COMMIT_DATE:=$(shell git show -s --format=%cI) LAST_COMMIT_DATE:=$(shell git show -s --format=%cI)
PYVERSION:=py310
PYPI_IMP:=cp PYPI_IMP:=cp
ifeq ($(PYVERSION), py311) ifdef PYVERSION
PYLIBDIR:=python3.11 SUPPORTED_PYVERSIONS := py311 py312 py313
PYNUMBER:=311
PYPI_VERSION:=3.11 ifeq ($(filter $(PYVERSION),$(SUPPORTED_PYVERSIONS)),)
$(error Unsupported PYVERSION=$(PYVERSION). Must be one of $(SUPPORTED_PYVERSIONS))
endif
PYMINOR:=$(subst py3,,$(PYVERSION))
PYLIBDIR:=python3.$(PYMINOR)
PYNUMBER:=3$(PYMINOR)
PYPI_VERSION:=3.$(PYMINOR)
endif # def PYVERSION
ifdef PLATFORM
SUPPORTED_PLATFORMS := linux macos macosm1 win
ifeq ($(filter $(PLATFORM),$(SUPPORTED_PLATFORMS)),)
$(error Unsupported PLATFORM=$(PLATFORM). Must be one of $(SUPPORTED_PLATFORMS))
endif
ifeq ($(PLATFORM),macos)
ifeq ($(PYVERSION),py313)
$(error Blender 5.1 with Python 3.13 doesn't support intel macOS.)
endif endif
ifeq ($(PYVERSION), py312)
PYLIBDIR:=python3.12
PYNUMBER:=312
PYPI_VERSION:=3.12
endif endif
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
@@ -86,6 +101,8 @@ PYPI_PLATFORM:=--platform win_amd64
BLENDER_PLATFORM:=windows-x64 BLENDER_PLATFORM:=windows-x64
endif endif
endif # def PLATFORM
# Current build commit hash. # Current build commit hash.
OLD:=e8eb5e4 OLD:=e8eb5e4
.PHONY: bump .PHONY: bump
@@ -99,7 +116,10 @@ endif
.PHONY: dist .PHONY: dist
dist: dist:
ifndef PLATFORM ifndef PLATFORM
$(error PLATFORM is not set) $(error PLATFORM is not set. Example values: $(SUPPORTED_PLATFORMS).)
endif
ifndef PYVERSION
$(error PYVERSION is not set. Example values: $(SUPPORTED_PYVERSIONS). )
endif endif
rm -rf build rm -rf build
mkdir -p build mkdir -p build
@@ -125,9 +145,6 @@ endif
cd ../ifc5d && make dist && mv dist/*.whl ../bonsai/build/wheels/ cd ../ifc5d && make dist && mv dist/*.whl ../bonsai/build/wheels/
cd ../ifccityjson && make dist && mv dist/*.whl ../bonsai/build/wheels/ cd ../ifccityjson && make dist && mv dist/*.whl ../bonsai/build/wheels/
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download GitPython --dest=./wheels cd build && . env/$(VENV_ACTIVATE) && $(PIP) download GitPython --dest=./wheels
# Provides audio playback for costing
# This is a REALLY IMPORTANT feature
cd build && . env/$(VENV_ACTIVATE) && $(PIP) wheel git+https://github.com/zdhoward/aud --wheel-dir=./wheels
# IfcOpenShell dependency - support for new typing features # IfcOpenShell dependency - support for new typing features
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download typing_extensions --dest=./wheels cd build && . env/$(VENV_ACTIVATE) && $(PIP) download typing_extensions --dest=./wheels
# Required by IfcCSV # Required by IfcCSV
@@ -189,7 +206,7 @@ endif
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels cd build && . env/$(VENV_ACTIVATE) && $(PIP) download tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# pyradiance is using different platform versions than defaults in our makefile. # pyradiance is using different platform versions than defaults in our makefile.
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pyradiance --platform manylinux_2_35_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pyradiance --platform manylinux_2_28_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
else ifeq ($(PLATFORM), macos) else ifeq ($(PLATFORM), macos)
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pyradiance --platform macosx_10_13_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pyradiance --platform macosx_10_13_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
else else
@@ -267,6 +284,11 @@ else
$(SED) 's/version = "0.0.0"/version = "$(VERSION)-alpha$(VERSION_DATE)"/' build/pyproject.toml $(SED) 's/version = "0.0.0"/version = "$(VERSION)-alpha$(VERSION_DATE)"/' build/pyproject.toml
endif endif
# Blender 5.1+ requires Python 3.13.
ifeq ($(PYVERSION), py313)
$(SED) 's/blender_version_min = "4\.2\.0"/blender_version_min = "5.1.0"/' build/bonsai/blender_manifest.toml
endif
$(SED) "s/os-arch/$(BLENDER_PLATFORM)/" build/bonsai/blender_manifest.toml $(SED) "s/os-arch/$(BLENDER_PLATFORM)/" build/bonsai/blender_manifest.toml
# Provides bonsai Add-on functionality # Provides bonsai Add-on functionality
@@ -288,12 +310,6 @@ endif
fi fi
mv build/wheels/*.whl build/bonsai/wheels/ mv build/wheels/*.whl build/bonsai/wheels/
# Temporary workaround for Blender not handling non-3.11 wheels #5743.
# Use '-n' as on macos x86-64 doesn't have a binary wheel and it autoincludes 'cp311'.
prev_whl_name=$$(find build/bonsai/wheels/tzfpy-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/-cp39-/-cp$(PYNUMBER)-/"); \
mv --update=none "$$prev_whl_name" "$$whl_name";
ifneq ($(PLATFORM), linux) ifneq ($(PLATFORM), linux)
# Safeguard: in case one of `pip download` will break, # Safeguard: in case one of `pip download` will break,
# it will produce a linux wheel for non-linux build (our github action machine is using linux). # it will produce a linux wheel for non-linux build (our github action machine is using linux).
@@ -336,7 +352,11 @@ test:
.PHONY: test-core .PHONY: test-core
test-core: test-core:
ifndef MODULE
pytest -p no:pytest-blender test/core pytest -p no:pytest-blender test/core
else
pytest -p no:pytest-blender test/core/test_${MODULE}.py
endif
.PHONY: test-bim .PHONY: test-bim
test-bim: test-bim:
@@ -351,7 +371,7 @@ test-tool:
ifndef MODULE ifndef MODULE
pytest test/tool pytest test/tool
else else
pytest test/tool/test_$(MODULE).py pytest test/tool/test_$(MODULE).py --maxfail=1
endif endif
# Reregistering test is not added to the standard test suite because during unregister # Reregistering test is not added to the standard test suite because during unregister
+6 -7
View File
@@ -32,17 +32,16 @@ if IN_BLENDER:
# and then as a bonsai-package. # and then as a bonsai-package.
IN_PACKAGE = __package__ == "bonsai" IN_PACKAGE = __package__ == "bonsai"
import re
import platform import platform
import traceback import re
import webbrowser
import uuid
import shutil import shutil
import traceback
import uuid
import webbrowser
from collections import deque from collections import deque
from pathlib import Path
from typing import Union, Any
from collections.abc import Generator from collections.abc import Generator
from pathlib import Path
from typing import Any, Union
last_commit_hash = "8888888" last_commit_hash = "8888888"
last_commit_date = "9999999" last_commit_date = "9999999"
+7 -5
View File
@@ -16,14 +16,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import importlib
import os import os
from collections.abc import Callable
from typing import Union
import bpy import bpy
import bpy.utils.previews import bpy.utils.previews
import importlib from bpy_extras.io_utils import ExportHelper, ImportHelper
from bpy_extras.io_utils import ImportHelper, ExportHelper
from . import handler, ui, prop, operator from . import handler, operator, prop, ui
from typing import Union
from collections.abc import Callable
try: try:
from bonsai.translations import translations_dict from bonsai.translations import translations_dict
@@ -1,6 +1,5 @@
import sys
import os import os
import sys
bonsai_lib_path = os.environ.get("BONSAI_LIB_PATH") bonsai_lib_path = os.environ.get("BONSAI_LIB_PATH")
bonsai_version = os.environ.get("BONSAI_VERSION") bonsai_version = os.environ.get("BONSAI_VERSION")
@@ -9,13 +8,14 @@ if bonsai_lib_path:
sys.path.insert(0, bonsai_lib_path) sys.path.insert(0, bonsai_lib_path)
import argparse import argparse
from aiohttp import web
import socketio
import pystache
import json
import base64 import base64
import json
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import pystache
import socketio
from aiohttp import web
sio_port = 8080 # default port sio_port = 8080 # default port
sio = socketio.AsyncServer(cors_allowed_origins="*", async_mode="aiohttp", max_http_buffer_size=10000000) sio = socketio.AsyncServer(cors_allowed_origins="*", async_mode="aiohttp", max_http_buffer_size=10000000)
+13 -11
View File
@@ -17,27 +17,30 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import os
import bpy
import json
import datetime import datetime
import zipfile import json
import os
import tempfile import tempfile
import zipfile
from logging import Logger
from math import radians
from typing import Union
import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.unit import ifcopenshell.util.unit
import bonsai.tool as tool from mathutils import Vector
import bonsai.core.geometry
import bonsai.core.aggregate import bonsai.core.aggregate
import bonsai.core.geometry
import bonsai.core.spatial import bonsai.core.spatial
import bonsai.core.style import bonsai.core.style
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from mathutils import Vector
from typing import Union
from logging import Logger
from math import radians
class IfcExporter: class IfcExporter:
@@ -49,7 +52,6 @@ class IfcExporter:
self.set_header() self.set_header()
IfcStore.update_cache() IfcStore.update_cache()
self.sync_all_objects() self.sync_all_objects()
tool.Project.save_linked_models_to_ifc()
extension = self.ifc_export_settings.output_file.split(".")[-1].lower() extension = self.ifc_export_settings.output_file.split(".")[-1].lower()
if extension == "ifczip": if extension == "ifczip":
with tempfile.TemporaryDirectory() as unzipped_path: with tempfile.TemporaryDirectory() as unzipped_path:
+16 -11
View File
@@ -17,26 +17,31 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os import os
import weakref
from collections.abc import Callable
from math import cos
from typing import Union
import bpy import bpy
import ifcopenshell.api.owner.settings
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.unit import ifcopenshell.util.unit
import ifcopenshell.api.owner.settings from bpy.app.handlers import persistent
from mathutils import Vector
import bonsai.bim import bonsai.bim
import bonsai.tool as tool import bonsai.tool as tool
import weakref
from bpy.app.handlers import persistent
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.model.data import AuthoringData
from bonsai.bim.module.aggregate.decorator import AggregateDecorator from bonsai.bim.module.aggregate.decorator import AggregateDecorator
from bonsai.bim.module.georeference.decorator import GeoreferenceDecorator from bonsai.bim.module.georeference.decorator import GeoreferenceDecorator
from bonsai.bim.module.model.decorator import WallAxisDecorator, SlabDirectionDecorator, BoundingBoxDecorator from bonsai.bim.module.model.data import AuthoringData
from bonsai.bim.module.model.decorator import (
BoundingBoxDecorator,
SlabDirectionDecorator,
WallAxisDecorator,
)
from bonsai.bim.module.nest.decorator import NestDecorator from bonsai.bim.module.nest.decorator import NestDecorator
from mathutils import Vector
from math import cos
from typing import Union
from collections.abc import Callable
cwd = os.path.dirname(os.path.realpath(__file__)) cwd = os.path.dirname(os.path.realpath(__file__))
global_subscription_owner = object() global_subscription_owner = object()
@@ -202,8 +207,8 @@ def refresh_ui_data():
Note that calling non-ifc-operators by itself doesn't refresh the UI data Note that calling non-ifc-operators by itself doesn't refresh the UI data
and it need to be refreshed manually if needed. and it need to be refreshed manually if needed.
""" """
from bonsai.bim import modules
import bonsai.bim.ui import bonsai.bim.ui
from bonsai.bim import modules
bonsai.bim.ui.refresh() bonsai.bim.ui.refresh()
+13 -6
View File
@@ -17,24 +17,31 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import importlib import importlib
import bpy
import json import json
from collections.abc import Callable, Iterable, Sequence
from types import EllipsisType
from typing import TYPE_CHECKING, Any, Optional, Union
import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as W import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.attribute import ifcopenshell.util.attribute
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.unit import ifcopenshell.util.unit
from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, get_property_doc from ifcopenshell.util.doc import (
get_attribute_doc,
get_predefined_type_doc,
get_property_doc,
)
import bonsai.tool as tool import bonsai.tool as tool
from types import EllipsisType
from typing import Optional, Any, Union, TYPE_CHECKING
from collections.abc import Callable, Iterable, Sequence
if TYPE_CHECKING: if TYPE_CHECKING:
import bonsai.bim.prop import bonsai.bim.prop
from bonsai.bim.prop import Attribute
from bonsai.bim.module.search.prop import BIMFilterGroup from bonsai.bim.module.search.prop import BIMFilterGroup
from bonsai.bim.prop import Attribute
# ImportCallback return values: # ImportCallback return values:
# - None - property should be imported by default workflow # - None - property should be imported by default workflow
+12 -10
View File
@@ -17,26 +17,28 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import os
import bpy
import uuid
import shutil
import hashlib import hashlib
import zipfile import os
import shutil
import tempfile import tempfile
import traceback import traceback
import uuid
import zipfile
from collections.abc import Callable
from pathlib import Path
from typing import Literal, NotRequired, Optional, TypedDict, Union
import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper import ifcopenshell.ifcopenshell_wrapper
from ifcopenshell.file import UndoSystemError
import bonsai import bonsai
import bonsai.bim.handler import bonsai.bim.handler
import bonsai.tool as tool import bonsai.tool as tool
from ifcopenshell.file import UndoSystemError
from pathlib import Path
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
from typing import Union, Optional, TypedDict, NotRequired, Literal
from collections.abc import Callable
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object] IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
+17 -23
View File
@@ -17,33 +17,36 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bpy
import time
import json import json
import ifcpatch
import logging import logging
import traceback
import mathutils
import numpy as np
import numpy.typing as npt
import multiprocessing import multiprocessing
import time
import traceback
from collections.abc import Iterable
from typing import Any, Literal, Optional, Union
import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api.pset import ifcopenshell.api.pset
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper as W import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.unit
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.geolocation import ifcopenshell.util.geolocation
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.shape import ifcopenshell.util.shape
import bonsai.tool as tool import ifcopenshell.util.unit
from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE import ifcpatch
from bonsai.tool.loader import OBJECT_DATA_TYPE import mathutils
from typing import Union, Optional, Any, Literal import numpy as np
from collections.abc import Iterable import numpy.typing as npt
from ifcopenshell.util.shape import MatrixType from ifcopenshell.util.shape import MatrixType
import bonsai.tool as tool
from bonsai.bim.ifc import IFC_CONNECTED_TYPE, IfcStore
from bonsai.tool.loader import OBJECT_DATA_TYPE
class MaterialCreator: class MaterialCreator:
mesh: bpy.types.Mesh mesh: bpy.types.Mesh
@@ -290,7 +293,6 @@ class IfcImporter:
self.profile_code("Load linked models") self.profile_code("Load linked models")
self.add_project_to_scene() self.add_project_to_scene()
self.profile_code("Add project to scene") self.profile_code("Add project to scene")
self.hide_ifc_spaces()
if self.ifc_import_settings.should_clean_mesh and len(self.file.by_type("IfcElement")) < 1000: if self.ifc_import_settings.should_clean_mesh and len(self.file.by_type("IfcElement")) < 1000:
self.clean_mesh() self.clean_mesh()
self.profile_code("Mesh cleaning") self.profile_code("Mesh cleaning")
@@ -1287,14 +1289,6 @@ class IfcImporter:
properties={"Aggregate_Index": aggregate_index, "Name": name}, properties={"Aggregate_Index": aggregate_index, "Name": name},
) )
def hide_ifc_spaces(self):
"""Hide IfcSpace objects after they've been added to the scene."""
for ifc_definition_id, obj in self.added_data.items():
if isinstance(obj, bpy.types.Object):
element = self.file.by_id(ifc_definition_id)
if element.is_a("IfcSpace"):
obj.hide_set(True)
class IfcImportSettings: class IfcImportSettings:
""" """
@@ -1312,7 +1306,7 @@ class IfcImportSettings:
self.should_load_geometry = True self.should_load_geometry = True
self.should_clean_mesh = False self.should_clean_mesh = False
self.should_cache = True self.should_cache = True
self.deflection_tolerance = 0.001 self.deflection_tolerance = 0.05 # Default is 0.001, but I find this to be more practical
self.angular_tolerance = 0.5 self.angular_tolerance = 0.5
self.void_limit = 30 self.void_limit = 30
self.style_limit = 300 self.style_limit = 300
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.BIM_OT_add_aggregate, operator.BIM_OT_add_aggregate,
@@ -16,11 +16,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import bonsai.tool as tool
import ifcopenshell.util.element
from typing import Union from typing import Union
import bpy
import ifcopenshell.util.element
import bonsai.tool as tool
def refresh(): def refresh():
AggregateData.is_loaded = False AggregateData.is_loaded = False
@@ -21,11 +21,12 @@ import bpy
import gpu import gpu
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool
from bpy.types import SpaceView3D from bpy.types import SpaceView3D
from bpy_extras import view3d_utils from bpy_extras import view3d_utils
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from mathutils import Vector from mathutils import Vector
import bonsai.tool as tool
from bonsai.bim.module.geometry.decorator import ItemDecorator from bonsai.bim.module.geometry.decorator import ItemDecorator
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
@@ -23,10 +25,10 @@ import ifcopenshell.api.group
import ifcopenshell.api.pset import ifcopenshell.api.pset
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool
import bonsai.core.aggregate as core import bonsai.core.aggregate as core
import bonsai.core.spatial import bonsai.core.spatial
from typing import TYPE_CHECKING import bonsai.tool as tool
class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator): class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator):
@@ -222,7 +224,7 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator):
tool.Collector, tool.Collector,
tool.Spatial, tool.Spatial,
container=current_container, container=current_container,
element_obj=aggregate, objs=[aggregate],
) )
core.assign_object(tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=aggregate, related_obj=obj) core.assign_object(tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=aggregate, related_obj=obj)
+16 -11
View File
@@ -16,24 +16,29 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Union
import bpy import bpy
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool
from bonsai.bim.prop import StrProperty, Attribute
from bonsai.bim.module.spatial.data import SpatialData
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from bonsai.bim.module.aggregate.decorator import AggregateDecorator, AggregateModeDecorator from bpy.types import PropertyGroup
from typing import TYPE_CHECKING, Union
import bonsai.tool as tool
from bonsai.bim.module.aggregate.decorator import (
AggregateDecorator,
AggregateModeDecorator,
)
from bonsai.bim.module.spatial.data import SpatialData
from bonsai.bim.prop import Attribute, StrProperty
def can_aggregate(relating_obj: bpy.types.Object, related_obj: bpy.types.Object) -> bool: def can_aggregate(relating_obj: bpy.types.Object, related_obj: bpy.types.Object) -> bool:
+3 -2
View File
@@ -17,10 +17,11 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from bpy.types import Panel from bpy.types import Panel
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.aggregate.data import AggregateData from bonsai.bim.module.aggregate.data import AggregateData
from bonsai.bim.module.group.data import GroupsData, ObjectGroupsData from bonsai.bim.module.group.data import GroupsData, ObjectGroupsData
from bonsai.bim.ifc import IfcStore
import bonsai.tool as tool
class BIM_PT_aggregate(Panel): class BIM_PT_aggregate(Panel):
@@ -18,6 +18,7 @@
# pyright: reportUnnecessaryTypeIgnoreComment=error # pyright: reportUnnecessaryTypeIgnoreComment=error
import bpy import bpy
import math import math
import time import time
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.EnableEditingAttributes, operator.EnableEditingAttributes,
@@ -18,6 +18,7 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import bonsai.tool as tool import bonsai.tool as tool
@@ -16,22 +16,25 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import json import json
from typing import TYPE_CHECKING, Any, Literal, Union
import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api.attribute import ifcopenshell.api.attribute
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.bim.helper import bonsai.bim.helper
import bonsai.tool as tool
import bonsai.core.attribute as core import bonsai.core.attribute as core
import bonsai.core.spatial import bonsai.core.spatial
from typing import TYPE_CHECKING, Any, Union, Literal import bonsai.tool as tool
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.prop import Attribute
import bpy.stub_internal.rna_enums as rna_enums import bpy.stub_internal.rna_enums as rna_enums
from bonsai.bim.prop import Attribute
def get_objs_for_operation( def get_objs_for_operation(
operator_properties: "AttributesOperator", context: bpy.types.Context operator_properties: "AttributesOperator", context: bpy.types.Context
+11 -9
View File
@@ -16,21 +16,23 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Union
import bpy import bpy
import bonsai.tool as tool
from bonsai.bim.prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from typing import TYPE_CHECKING, Union from bpy.types import PropertyGroup
import bonsai.tool as tool
from bonsai.bim.prop import Attribute, StrProperty
class BIMAttributeProperties(PropertyGroup): class BIMAttributeProperties(PropertyGroup):
+6 -3
View File
@@ -17,12 +17,15 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bonsai.bim.helper
from typing import TYPE_CHECKING
import bpy.types import bpy.types
from bpy.types import Panel from bpy.types import Panel
from bonsai.bim.module.attribute.data import AttributesData
import bonsai.bim.helper
import bonsai.tool as tool import bonsai.tool as tool
from typing import TYPE_CHECKING from bonsai.bim.module.attribute.data import AttributesData
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.attribute.prop import BIMExplorerProperties, ExplorerEntity from bonsai.bim.module.attribute.prop import BIMExplorerProperties, ExplorerEntity
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
prop.AuginProperties, prop.AuginProperties,
@@ -16,14 +16,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import datetime
import os import os
import bpy
import string
import random import random
import shutil import shutil
import requests import string
import tempfile import tempfile
import datetime
import bpy
import requests
import bonsai.tool as tool import bonsai.tool as tool
+1
View File
@@ -17,6 +17,7 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy.types import bpy.types
import bonsai.tool as tool import bonsai.tool as tool
+2 -1
View File
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.ActivateBcfViewpoint, operator.ActivateBcfViewpoint,
+4 -2
View File
@@ -17,12 +17,14 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os import os
import bpy from typing import Union
import bcf import bcf
import bcf.bcfxml import bcf.bcfxml
import bcf.v2.bcfxml import bcf.v2.bcfxml
import bpy
import bonsai.tool as tool import bonsai.tool as tool
from typing import Union
class BcfStore: class BcfStore:
+21 -19
View File
@@ -17,6 +17,20 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os import os
import tempfile
import uuid
import webbrowser
from math import atan, cos, degrees, radians, sin, tan
from pathlib import Path
import bcf
import bcf.agnostic.topic
import bcf.agnostic.visinfo
import bcf.bcfxml
import bcf.v2.bcfxml
import bcf.v2.model
import bcf.v2.topic
import bcf.v2.visinfo
import bcf.v3 import bcf.v3
import bcf.v3.bcfxml import bcf.v3.bcfxml
import bcf.v3.document import bcf.v3.document
@@ -24,30 +38,18 @@ import bcf.v3.model
import bcf.v3.topic import bcf.v3.topic
import bcf.v3.visinfo import bcf.v3.visinfo
import bpy import bpy
import bcf
import bcf.bcfxml
import bcf.v2.bcfxml
import bcf.v2.model
import bcf.v2.topic
import bcf.v2.visinfo
import bcf.agnostic.topic
import bcf.agnostic.visinfo
import uuid
import numpy as np
import tempfile
import webbrowser
import ifcopenshell import ifcopenshell
import ifcopenshell.util.geolocation import ifcopenshell.util.geolocation
import ifcopenshell.util.unit import ifcopenshell.util.unit
import bonsai.tool as tool import numpy as np
import bonsai.bim.module.bcf.prop as bcf_prop from bpy_extras.io_utils import ExportHelper, ImportHelper
import bonsai.bim.module.bcf.bcfstore as bcfstore from mathutils import Euler, Matrix, Vector, geometry
from bpy_extras.io_utils import ImportHelper, ExportHelper
from pathlib import Path
from math import radians, degrees, atan, tan, cos, sin
from mathutils import Vector, Matrix, Euler, geometry
from xsdata.models.datatype import XmlDateTime from xsdata.models.datatype import XmlDateTime
import bonsai.bim.module.bcf.bcfstore as bcfstore
import bonsai.bim.module.bcf.prop as bcf_prop
import bonsai.tool as tool
class NewBcfProject(bpy.types.Operator): class NewBcfProject(bpy.types.Operator):
bl_idname = "bim.new_bcf_project" bl_idname = "bim.new_bcf_project"
+18 -16
View File
@@ -16,24 +16,26 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import bonsai.tool as tool
from . import bcfstore
from bonsai.bim.prop import StrProperty
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
CollectionProperty,
)
from bcf.agnostic.extensions import get_extensions_attributes
from typing import TYPE_CHECKING, Union from typing import TYPE_CHECKING, Union
import bpy
from bcf.agnostic.extensions import get_extensions_attributes
from bpy.props import (
BoolProperty,
CollectionProperty,
EnumProperty,
FloatProperty,
FloatVectorProperty,
IntProperty,
PointerProperty,
StringProperty,
)
from bpy.types import PropertyGroup
import bonsai.tool as tool
from bonsai.bim.prop import StrProperty
from . import bcfstore
bcfviewpoints_enum = None bcfviewpoints_enum = None
+9 -5
View File
@@ -17,15 +17,19 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import os import os
import bpy
import bonsai.tool as tool
from . import bcfstore
from bpy.types import Panel
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import bpy
from bpy.types import Panel
import bonsai.tool as tool
from . import bcfstore
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.bcf.prop import BcfTopic, BCFProperties from bonsai.bim.module.bcf.prop import BCFProperties, BcfTopic
class BIM_PT_bcf(Panel): class BIM_PT_bcf(Panel):
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, operator, prop
from . import operator, prop, ui
classes = ( classes = (
operator.AddBoundary, operator.AddBoundary,
@@ -17,6 +17,7 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
import bonsai.tool as tool import bonsai.tool as tool
@@ -16,12 +16,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import gpu
import bmesh import bmesh
import bonsai.tool as tool import gpu
from bpy.types import SpaceView3D from bpy.types import SpaceView3D
from mathutils import Vector
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from mathutils import Vector
import bonsai.tool as tool
class BoundaryDecorator: class BoundaryDecorator:
@@ -16,34 +16,36 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import bmesh
import logging import logging
import shapely
import shapely.ops
import mathutils
import numpy as np
import multiprocessing import multiprocessing
from math import acos, degrees, inf, pi, radians
from typing import Optional, Union
import bmesh
import bpy
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.boundary import ifcopenshell.api.boundary
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.unit
import ifcopenshell.util.shape
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.representation import ifcopenshell.util.representation
import bonsai.tool as tool import ifcopenshell.util.shape
import bonsai.bim.import_ifc as import_ifc import ifcopenshell.util.unit
from math import pi, inf, degrees, acos, radians import mathutils
from mathutils import Vector, Matrix import numpy as np
from bonsai.bim.ifc import IfcStore import shapely
from bonsai.bim.module.model.decorator import ProfileDecorator import shapely.ops
from bonsai.bim.module.boundary.decorator import BoundaryDecorator
from ifcopenshell.util.shape_builder import ShapeBuilder from ifcopenshell.util.shape_builder import ShapeBuilder
from mathutils import Matrix, Vector
import bonsai.bim.import_ifc as import_ifc
import bonsai.core import bonsai.core
import bonsai.core.geometry import bonsai.core.geometry
from typing import Union, Optional import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.boundary.decorator import BoundaryDecorator
from bonsai.bim.module.model.decorator import ProfileDecorator
def disable_editing_boundary_geometry(context): def disable_editing_boundary_geometry(context):
+10 -8
View File
@@ -16,21 +16,23 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Union
import bpy import bpy
from bpy.types import PropertyGroup
from bonsai.bim.prop import ObjProperty
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from bpy.types import PropertyGroup
import bonsai.tool as tool import bonsai.tool as tool
from typing import TYPE_CHECKING, Union from bonsai.bim.prop import ObjProperty
def space_filter(self: "BIMObjectBoundaryProperties", object: bpy.types.Object) -> bool: def space_filter(self: "BIMObjectBoundaryProperties", object: bpy.types.Object) -> bool:
@@ -18,6 +18,7 @@
import bpy import bpy
from bpy.types import Panel, UIList from bpy.types import Panel, UIList
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.module.boundary.data import SpaceBoundariesData from bonsai.bim.module.boundary.data import SpaceBoundariesData
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.AddBrick, operator.AddBrick,
+2 -1
View File
@@ -17,11 +17,12 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
try: try:
from rdflib import URIRef, BNode from rdflib import BNode, URIRef
except: except:
# See #1860 # See #1860
print("Warning: brickschema not available.") print("Warning: brickschema not available.")
@@ -17,12 +17,14 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os import os
import bpy import bpy
import ifcopenshell.api import ifcopenshell.api
import bonsai.tool as tool from bpy_extras.io_utils import ExportHelper, ImportHelper
import bonsai.core.brick as core
import bonsai.bim.handler import bonsai.bim.handler
from bpy_extras.io_utils import ImportHelper, ExportHelper import bonsai.core.brick as core
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
+11 -9
View File
@@ -16,24 +16,26 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING
import bpy import bpy
from bonsai.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData
from bonsai.bim.prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from bpy.types import PropertyGroup
import bonsai.core.brick as core import bonsai.core.brick as core
import bonsai.tool.brick as tool import bonsai.tool.brick as tool
from bonsai.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData
from bonsai.bim.prop import Attribute, StrProperty
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
from typing import TYPE_CHECKING
def update_active_brick_index(self, context): def update_active_brick_index(self, context):
+2 -1
View File
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bonsai.tool as tool
from bpy.types import Panel, UIList from bpy.types import Panel, UIList
import bonsai.tool as tool
from bonsai.bim.helper import prop_with_search from bonsai.bim.helper import prop_with_search
from bonsai.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData from bonsai.bim.module.brick.data import BrickschemaData, BrickschemaReferencesData
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.AddBSDDProperties, operator.AddBSDDProperties,
+2 -1
View File
@@ -18,8 +18,9 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.date
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
@@ -16,13 +16,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import textwrap import textwrap
from typing import Any
import bpy import bpy
import bsdd import bsdd
import bonsai.tool as tool
import ifcopenshell.api.pset import ifcopenshell.api.pset
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool
from bonsai.core import bsdd as core from bonsai.core import bsdd as core
from typing import Any
class LoadBSDDDictionaries(bpy.types.Operator): class LoadBSDDDictionaries(bpy.types.Operator):
+16 -14
View File
@@ -16,23 +16,25 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Literal, Union
import bpy import bpy
import bonsai.tool as tool from bpy.props import (
BoolProperty,
CollectionProperty,
EnumProperty,
FloatProperty,
FloatVectorProperty,
IntProperty,
PointerProperty,
StringProperty,
)
from bpy.types import PropertyGroup from bpy.types import PropertyGroup
import bonsai.tool as tool
from bonsai.bim.module.bsdd.data import BSDDData from bonsai.bim.module.bsdd.data import BSDDData
from bonsai.bim.module.classification.data import ClassificationsData from bonsai.bim.module.classification.data import ClassificationsData
from bonsai.bim.prop import Attribute, StrProperty from bonsai.bim.prop import Attribute, StrProperty
from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
CollectionProperty,
)
from typing import Union, TYPE_CHECKING, Literal
def get_active_dictionary(self: "BIMBSDDProperties", context: object) -> tool.Blender.BLENDER_ENUM_ITEMS: def get_active_dictionary(self: "BIMBSDDProperties", context: object) -> tool.Blender.BLENDER_ENUM_ITEMS:
@@ -161,7 +163,7 @@ class BIMBSDDProperties(PropertyGroup):
default=False, default=False,
) )
classification_psets: CollectionProperty(name="Classification Psets", type=BSDDPset) classification_psets: CollectionProperty(name="Classification Psets", type=BSDDPset)
if TYPE_CHECKING: if TYPE_CHECKING:
active_dictionary: str active_dictionary: str
active_dictionary: str active_dictionary: str
@@ -180,7 +182,7 @@ class BIMBSDDProperties(PropertyGroup):
should_filter_ifc_class: bool should_filter_ifc_class: bool
use_only_ifc_properties: bool use_only_ifc_properties: bool
classification_psets: bpy.types.bpy_prop_collection_idprop[BSDDPset] classification_psets: bpy.types.bpy_prop_collection_idprop[BSDDPset]
@property @property
def active_class(self) -> Union[BSDDClassification, None]: def active_class(self) -> Union[BSDDClassification, None]:
return tool.Blender.get_active_uilist_element(self.classes, self.active_class_index) return tool.Blender.get_active_uilist_element(self.classes, self.active_class_index)
+14 -6
View File
@@ -17,14 +17,23 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bpy
import bonsai.tool as tool
from bonsai.bim.module.bsdd.data import BSDDData
from bpy.types import Panel, UIList
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import bpy
from bpy.types import Panel, UIList
import bonsai.tool as tool
import bsdd
from bonsai.bim.module.bsdd.data import BSDDData
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.bsdd.prop import BIMBSDDProperties, BSDDDictionary, BSDDClassification, BSDDProperty from bonsai.bim.module.bsdd.prop import (
BIMBSDDProperties,
BSDDClassification,
BSDDDictionary,
BSDDProperty,
)
class BIM_PT_bsdd(Panel): class BIM_PT_bsdd(Panel):
@@ -75,7 +84,6 @@ class BIM_PT_bsdd(Panel):
row = self.layout.row() row = self.layout.row()
row.operator("bim.load_bsdd_dictionaries") row.operator("bim.load_bsdd_dictionaries")
class BIM_UL_bsdd_dictionaries(UIList): class BIM_UL_bsdd_dictionaries(UIList):
def draw_item( def draw_item(
self, self,
@@ -17,6 +17,7 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import operator, prop, workspace from . import operator, prop, workspace
classes = ( classes = (
+9 -8
View File
@@ -16,17 +16,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import math import math
import bmesh from math import cos, pi, radians, sin, sqrt
import mathutils
import bpy_extras
import bonsai.tool as tool
from mathutils import Vector, Matrix
from math import pi, radians, sin, cos, sqrt
import ifcopenshell.util.unit
from typing import Union from typing import Union
import bmesh
import bpy
import bpy_extras
import ifcopenshell.util.unit
import mathutils
from mathutils import Matrix, Vector
import bonsai.tool as tool
messages = { messages = {
"SHARED_VERTEX": "Shared Vertex, no intersection possible", "SHARED_VERTEX": "Shared Vertex, no intersection possible",
+5 -3
View File
@@ -16,12 +16,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
from bonsai.bim.module.model.data import AuthoringData
from bpy.types import PropertyGroup
from math import pi from math import pi
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import bpy
from bpy.types import PropertyGroup
from bonsai.bim.module.model.data import AuthoringData
class BIMCadProperties(PropertyGroup): class BIMCadProperties(PropertyGroup):
resolution: bpy.props.IntProperty(name="Arc Resolution", min=1, default=1) resolution: bpy.props.IntProperty(name="Arc Resolution", min=1, default=1)
@@ -17,13 +17,15 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os import os
from functools import partial
import bpy import bpy
import bonsai.tool as tool
import bonsai.bim.module.type.prop as type_prop
import ifcopenshell.util.unit import ifcopenshell.util.unit
from bpy.types import WorkSpaceTool from bpy.types import WorkSpaceTool
import bonsai.bim.module.type.prop as type_prop
import bonsai.tool as tool
from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData
from functools import partial
def load_custom_icons(): def load_custom_icons():
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.AddClashSet, operator.AddClashSet,
+3 -1
View File
@@ -16,9 +16,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import json import json
import bpy
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool import bonsai.tool as tool
@@ -17,13 +17,14 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import blf import blf
import gpu
import bmesh import bmesh
import bonsai.tool as tool import gpu
from bpy.types import SpaceView3D from bpy.types import SpaceView3D
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
from bpy_extras.view3d_utils import location_3d_to_region_2d from bpy_extras.view3d_utils import location_3d_to_region_2d
from gpu_extras.batch import batch_for_shader
from mathutils import Vector
import bonsai.tool as tool
class ClashDecorator: class ClashDecorator:
+12 -10
View File
@@ -16,22 +16,24 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
import bpy
import json import json
import tempfile
import bmesh
import logging import logging
import numpy as np import os
import ifcopenshell import tempfile
import bonsai.tool as tool
from pathlib import Path
from bpy_extras.io_utils import ExportHelper, ImportHelper
from math import radians from math import radians
from pathlib import Path
from typing import TYPE_CHECKING
import bmesh
import bpy
import ifcopenshell
import numpy as np
from bpy_extras.io_utils import ExportHelper, ImportHelper
from mathutils import Matrix, Vector from mathutils import Matrix, Vector
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.clash.decorator import ClashDecorator from bonsai.bim.module.clash.decorator import ClashDecorator
from typing import TYPE_CHECKING
class ExportClashSets(bpy.types.Operator, ExportHelper): class ExportClashSets(bpy.types.Operator, ExportHelper):
+12 -10
View File
@@ -16,23 +16,25 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Literal, Union
import bpy import bpy
import bonsai.tool as tool
from bonsai.bim.prop import StrProperty, Attribute, BIMFilterGroup
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from ifcopenshell.geom.main import ClashType, CLASH_TYPE_ITEMS from bpy.types import PropertyGroup
from ifcopenshell.geom.main import CLASH_TYPE_ITEMS, ClashType
from mathutils import Vector from mathutils import Vector
from typing import TYPE_CHECKING, Literal, Union
import bonsai.tool as tool
from bonsai.bim.prop import Attribute, BIMFilterGroup, StrProperty
class ClashSource(PropertyGroup): class ClashSource(PropertyGroup):
+14 -6
View File
@@ -17,15 +17,23 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bpy
import bonsai.tool as tool
import bonsai.bim.helper
from bpy.types import Panel
from bonsai.bim.module.clash.data import ClashData
from typing import TYPE_CHECKING, assert_never from typing import TYPE_CHECKING, assert_never
import bpy
from bpy.types import Panel
import bonsai.bim.helper
import bonsai.tool as tool
from bonsai.bim.module.clash.data import ClashData
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.clash.prop import BIMClashProperties, ClashSet, SmartClashGroup, Clash from bonsai.bim.module.clash.prop import (
BIMClashProperties,
Clash,
ClashSet,
SmartClashGroup,
)
class BIM_PT_ifcclash(Panel): class BIM_PT_ifcclash(Panel):
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.AddClassification, operator.AddClassification,
@@ -16,12 +16,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import Any, Literal, Union
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.date
import bonsai.tool as tool import bonsai.tool as tool
from typing import Any, Literal, Union
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
@@ -19,13 +19,14 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.pset
import ifcopenshell.api.classification import ifcopenshell.api.classification
import ifcopenshell.api.pset
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.element import ifcopenshell.util.element
import bonsai.tool as tool
import bonsai.bim.helper
from bpy_extras.io_utils import ImportHelper from bpy_extras.io_utils import ImportHelper
import bonsai.bim.helper
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
@@ -16,22 +16,27 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING
import bpy import bpy
import bonsai.tool as tool
from bonsai.bim.prop import Attribute
from bonsai.bim.module.classification.data import ClassificationsData, ObjectClassificationsData
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from typing import TYPE_CHECKING from bpy.types import PropertyGroup
import bonsai.tool as tool
from bonsai.bim.module.classification.data import (
ClassificationsData,
ObjectClassificationsData,
)
from bonsai.bim.prop import Attribute
def get_available_classifications( def get_available_classifications(
@@ -17,24 +17,29 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bpy
import bonsai.bim.helper
import bonsai.tool as tool
import bonsai.bim.module.classification.prop as classification_prop
import ifcopenshell.util.classification
from bpy.types import Panel, UIList
from bonsai.bim.module.classification.data import (
ClassificationsData,
ObjectClassificationsData,
MaterialClassificationsData,
CostClassificationsData,
ZoneClassificationsData,
)
from typing import TYPE_CHECKING, Any, Union from typing import TYPE_CHECKING, Any, Union
import bpy
import ifcopenshell.util.classification
from bpy.types import Panel, UIList
import bonsai.bim.helper
import bonsai.bim.module.classification.prop as classification_prop
import bonsai.tool as tool
from bonsai.bim.module.classification.data import (
ClassificationsData,
CostClassificationsData,
MaterialClassificationsData,
ObjectClassificationsData,
ZoneClassificationsData,
)
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.classification.prop import BIMClassificationProperties, ClassificationReference from bonsai.bim.module.classification.prop import (
BIMClassificationProperties,
ClassificationReference,
)
class BIM_PT_classifications(Panel): class BIM_PT_classifications(Panel):
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.LoadObjectives, operator.LoadObjectives,
@@ -17,9 +17,10 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
import bonsai.tool as tool
from ifcopenshell.util.doc import get_entity_doc from ifcopenshell.util.doc import get_entity_doc
import bonsai.tool as tool
def refresh(): def refresh():
ConstraintsData.is_loaded = False ConstraintsData.is_loaded = False
@@ -16,12 +16,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING
import bpy import bpy
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.constraint import ifcopenshell.api.constraint
import bonsai.bim.helper import bonsai.bim.helper
import bonsai.tool as tool import bonsai.tool as tool
from typing import TYPE_CHECKING
def get_active_object(context: bpy.types.Context, obj_name: str) -> bpy.types.Object: def get_active_object(context: bpy.types.Context, obj_name: str) -> bpy.types.Object:
+13 -11
View File
@@ -16,23 +16,25 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING, Literal
import bpy import bpy
from ifcopenshell.util.doc import get_entity_doc
import bonsai.tool as tool
from bonsai.bim.prop import Attribute
from bonsai.bim.module.constraint.data import ConstraintsData
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from typing import TYPE_CHECKING, Literal from bpy.types import PropertyGroup
from ifcopenshell.util.doc import get_entity_doc
import bonsai.tool as tool
from bonsai.bim.module.constraint.data import ConstraintsData
from bonsai.bim.prop import Attribute
def get_available_constraint_types(self, context): def get_available_constraint_types(self, context):
+12 -5
View File
@@ -17,14 +17,21 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import bonsai.tool as tool
from bpy.types import Panel, UIList
from bonsai.bim.helper import draw_attributes
from bonsai.bim.module.constraint.data import ConstraintsData, ObjectConstraintsData
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from bpy.types import Panel, UIList
import bonsai.tool as tool
from bonsai.bim.helper import draw_attributes
from bonsai.bim.module.constraint.data import ConstraintsData, ObjectConstraintsData
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.constraint.prop import BIMConstraintProperties, BIMObjectConstraintProperties, Constraint from bonsai.bim.module.constraint.prop import (
BIMConstraintProperties,
BIMObjectConstraintProperties,
Constraint,
)
class BIM_PT_constraints(Panel): class BIM_PT_constraints(Panel):
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from . import ui, prop, operator
from . import operator, prop, ui
classes = ( classes = (
operator.AddContext, operator.AddContext,
+5 -3
View File
@@ -16,11 +16,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import bonsai.tool as tool
import ifcopenshell
from typing import Any from typing import Any
import bpy
import ifcopenshell
import bonsai.tool as tool
def refresh(): def refresh():
ContextData.is_loaded = False ContextData.is_loaded = False
@@ -17,8 +17,9 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
import bonsai.tool as tool
import bonsai.core.context as core import bonsai.core.context as core
import bonsai.tool as tool
class AddContext(bpy.types.Operator, tool.Ifc.Operator): class AddContext(bpy.types.Operator, tool.Ifc.Operator):
+11 -9
View File
@@ -16,21 +16,23 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from typing import TYPE_CHECKING
import bpy import bpy
from bonsai.bim.prop import StrProperty, Attribute
from bonsai.bim.module.context.data import ContextData
from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty, BoolProperty,
IntProperty, CollectionProperty,
EnumProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, IntProperty,
PointerProperty,
StringProperty,
) )
from typing import TYPE_CHECKING from bpy.types import PropertyGroup
from bonsai.bim.module.context.data import ContextData
from bonsai.bim.prop import Attribute, StrProperty
class BIMContextProperties(PropertyGroup): class BIMContextProperties(PropertyGroup):
@@ -17,6 +17,7 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
import bonsai.bim.helper import bonsai.bim.helper
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.module.context.data import ContextData from bonsai.bim.module.context.data import ContextData

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