You can now split objects using a drawn edge, especially useful when creating slab pour breaks and fixing lazily modeled walls and columns. Thanks Gorgious56!

This commit is contained in:
Dion Moult
2021-10-27 12:06:12 +11:00
parent 04b3b9b60e
commit f69de3324a
12 changed files with 117 additions and 4 deletions
@@ -35,3 +35,16 @@ Scenario: Resize to storey
And I press "bim.assign_container(structure={storey})"
When I press "bim.resize_to_storey"
Then nothing happens
Scenario: Split along edge
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a plane of size "4" at "0,0,0"
And the object "IfcWall/Cube" is selected
And additionally the object "Plane" is selected
When I press "bim.split_along_edge"
Then the object "IfcWall/Cube" is an "IfcWall"
And the object "IfcWall/Cube.001" is an "IfcWall"
+6
View File
@@ -105,6 +105,12 @@ def i_add_a_cube_of_size_size_at_location(size, location):
bpy.ops.mesh.primitive_cube_add(size=float(size), location=[float(co) for co in location.split(",")])
@given(parsers.parse('I add a plane of size "{size}" at "{location}"'))
@when(parsers.parse('I add a plane of size "{size}" at "{location}"'))
def i_add_a_plane_of_size_size_at_location(size, location):
bpy.ops.mesh.primitive_plane_add(size=float(size), location=[float(co) for co in location.split(",")])
@given(parsers.parse('I press "{operator}"'))
@when(parsers.parse('I press "{operator}"'))
def i_press_operator(operator):
+8
View File
@@ -39,3 +39,11 @@ class TestResizeToStorey:
misc.get_object_storey("obj").should_be_called().will_return("storey")
misc.get_storey_height_in_si("storey").should_be_called().will_return(None)
subject.resize_to_storey(misc, obj="obj")
class TestSplitAlongEdge:
def test_run(self, misc):
misc.split_objects_with_cutter(["obj"], "cutter").should_be_called().will_return(["new_obj"])
misc.run_root_copy_class(obj="new_obj").should_be_called()
misc.mark_object_as_edited("obj").should_be_called()
subject.split_along_edge(misc, cutter="cutter", objs=["obj"])
+18
View File
@@ -134,6 +134,11 @@ class TestMoveObjectToElevation(test.bim.bootstrap.NewFile):
assert list(obj.matrix_world.translation) == [0.0, 0.0, 3.0]
class TestRunRootCopyClass(test.bim.bootstrap.NewFile):
def test_nothing(self):
pass
class TestScaleObjectToHeight(test.bim.bootstrap.NewFile):
def test_run(self):
bpy.ops.mesh.primitive_cube_add()
@@ -149,3 +154,16 @@ class TestMarkObjectAsEdited(test.bim.bootstrap.NewFile):
obj = bpy.data.objects.new("Cube", None)
subject.mark_object_as_edited(obj)
assert obj in IfcStore.edited_objs
class TestSplitObjectsWithCutter(test.bim.bootstrap.NewFile):
def test_run(self):
bpy.ops.mesh.primitive_cube_add()
bpy.ops.mesh.primitive_plane_add(size=4)
obj = bpy.data.objects.get("Cube")
cutter = bpy.data.objects.get("Plane")
assert obj.dimensions[2] == 2
new_objs = subject.split_objects_with_cutter([obj], cutter)
assert new_objs[0].name == "Cube.001"
assert obj.dimensions[2] == 1
assert new_objs[0].dimensions[2] == 1