bonsai bim module imports #5178

This commit is contained in:
Andrej730
2024-08-14 14:10:36 +05:00
committed by Andrej
parent c03777cfe6
commit 485643863f
246 changed files with 1010 additions and 1110 deletions
+7 -7
View File
@@ -22,11 +22,11 @@ import re
import bpy
import pytest
import webbrowser
import blenderbim
import bonsai.bim.handler
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.representation
from blenderbim.bim.ifc import IfcStore
from bonsai.bim.ifc import IfcStore
from mathutils import Vector
# Monkey-patch webbrowser opening since we want to test headlessly
@@ -44,7 +44,7 @@ class NewFile:
if bpy.data.objects:
bpy.data.batch_remove(bpy.data.objects)
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
blenderbim.bim.handler.load_post(None)
bonsai.bim.handler.load_post(None)
class NewIfc:
@@ -54,7 +54,7 @@ class NewIfc:
bpy.ops.wm.read_homefile(app_template="")
bpy.data.batch_remove(bpy.data.objects)
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
blenderbim.bim.handler.load_post(None)
bonsai.bim.handler.load_post(None)
bpy.ops.bim.create_project()
@@ -65,7 +65,7 @@ class NewIfc4X3:
bpy.ops.wm.read_homefile(app_template="")
bpy.data.batch_remove(bpy.data.objects)
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
blenderbim.bim.handler.load_post(None)
bonsai.bim.handler.load_post(None)
bpy.context.scene.BIMProjectProperties.export_schema = "IFC4X3_ADD2"
bpy.ops.bim.create_project()
@@ -245,12 +245,12 @@ def the_object_name_is_contained_in_container_name(name, container_name):
def i_duplicate_the_selected_objects():
bpy.ops.object.duplicate_move()
blenderbim.bim.handler.active_object_callback()
bonsai.bim.handler.active_object_callback()
def i_delete_the_selected_objects():
bpy.ops.object.delete()
blenderbim.bim.handler.active_object_callback()
bonsai.bim.handler.active_object_callback()
def the_object_name1_and_name2_are_different_elements(name1, name2):
+1 -1
View File
@@ -1,6 +1,6 @@
# ############################################################################ #
# Hey there! Welcome to the BlenderBIM Add-on code. Please feel free to reach
# Hey there! Welcome to the Bonsai code. Please feel free to reach
# out if you have any questions or need further guidance. Happy hacking!
# ############################################################################ #
@@ -18,7 +18,7 @@
import pytest
from mathutils import Vector
from blenderbim.bim.module.drawing.helper import clip_segment
from bonsai.bim.module.drawing.helper import clip_segment
BOUNDS = (10, 30, 10, 30, None, None)
+9 -9
View File
@@ -24,11 +24,11 @@ import numpy as np
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.representation
import blenderbim.tool as tool
import blenderbim.bim
from blenderbim.bim.ifc import IfcStore
from blenderbim.tool.brick import BrickStore
from blenderbim.bim.module.model.data import AuthoringData
import bonsai.tool as tool
import bonsai.bim.handler
from bonsai.bim.ifc import IfcStore
from bonsai.tool.brick import BrickStore
from bonsai.bim.module.model.data import AuthoringData
from pytest_bdd import scenarios, given, when, then, parsers
from mathutils import Vector
from math import radians
@@ -390,19 +390,19 @@ def i_evaluate_expression(expression):
@when("I duplicate the selected objects")
def i_duplicate_the_selected_objects():
bpy.ops.bim.override_object_duplicate_move()
blenderbim.bim.handler.active_object_callback()
bonsai.bim.handler.active_object_callback()
@when("I duplicate linked aggregate the selected objects")
def i_duplicate_linked_aggregate_the_selected_objects():
bpy.ops.bim.object_duplicate_move_linked_aggregate()
blenderbim.bim.handler.active_object_callback()
bonsai.bim.handler.active_object_callback()
@when("I refresh linked aggregate the selected object")
def i_refresh_the_selected_objects():
bpy.ops.bim.refresh_linked_aggregate()
blenderbim.bim.handler.active_object_callback()
bonsai.bim.handler.active_object_callback()
@when("I deselect all objects")
@@ -1075,7 +1075,7 @@ def i_load_the_ifc_test_file(filepath):
@given("I load the demo construction library")
@when("I load the demo construction library")
def i_add_a_construction_library():
lib_path = "./blenderbim/bim/data/libraries/IFC4 Demo Library.ifc"
lib_path = "./bonsai/bim/data/libraries/IFC4 Demo Library.ifc"
bpy.ops.bim.select_library_file(filepath=lib_path, append_all=True)
+4 -5
View File
@@ -22,16 +22,15 @@ import ifcopenshell.api
import ifcopenshell.util.pset
import test.bim.bootstrap
import bonsai.core.tool
import blenderbim.core.root
import bonsai.core.root
import bonsai.tool as tool
import blenderbim.bim.import_ifc as import_ifc
import blenderbim.bim.module.qto.calculator as calculator
import bonsai.bim.import_ifc as import_ifc
from bonsai.tool.qto import Qto as subject
class TestImplementsTool(test.bim.bootstrap.NewFile):
def test_run(self):
assert isinstance(subject(), blenderbim.core.tool.Qto)
assert isinstance(subject(), bonsai.core.tool.Qto)
class TestGetRadiusOfSelectedVertices(test.bim.bootstrap.NewFile):
@@ -75,7 +74,7 @@ class TestGetCalculatedObjectQuantities(test.bim.bootstrap.NewFile):
context = ifcopenshell.api.run("context.add_context", self.ifc, context_type="Model")
bpy.ops.mesh.primitive_cube_add(location=(0.0, 0.0, 0.0), size=2)
obj = bpy.context.active_object
element = blenderbim.core.root.assign_class(
element = bonsai.core.root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,