mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
Modeling dimensions now have sensible defaults depending on units and show prior to element creation
This commit is contained in:
@@ -77,6 +77,10 @@ class TestCreateProject:
|
||||
project.set_context("body").should_be_called()
|
||||
project.set_active_spatial_element("storey").should_be_called()
|
||||
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
|
||||
subject.create_project(ifc, project, schema="IFC4", template=None)
|
||||
|
||||
def test_appending_project_template_types_if_specified(self, ifc, project):
|
||||
@@ -132,6 +136,10 @@ class TestCreateProject:
|
||||
|
||||
project.append_all_types_from_template("template").should_be_called()
|
||||
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
|
||||
subject.create_project(ifc, project, schema="IFC4", template="template")
|
||||
|
||||
def test_create_an_ifc2x3_project_with_owner_defaults(self, ifc, project):
|
||||
@@ -192,4 +200,8 @@ class TestCreateProject:
|
||||
project.set_context("body").should_be_called()
|
||||
project.set_active_spatial_element("storey").should_be_called()
|
||||
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
|
||||
subject.create_project(ifc, project, schema="IFC2X3", template=None)
|
||||
|
||||
@@ -42,6 +42,11 @@ class TestCreateEmpty(NewFile):
|
||||
assert not bpy.data.objects.get("Foobar").data
|
||||
|
||||
|
||||
class TestLoadDefaultThumbnails(NewFile):
|
||||
def test_nothing(self):
|
||||
pass # Not possible to test this headlessly
|
||||
|
||||
|
||||
class TestRunAggregateAssignObject(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
@@ -101,3 +106,30 @@ class TestSetContext(NewFile):
|
||||
context = ifc.createIfcGeometricRepresentationContext()
|
||||
subject.set_context(context)
|
||||
assert bpy.context.scene.BIMRootProperties.contexts == str(context.id())
|
||||
|
||||
|
||||
class TestSetDefaultContext(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
ifc.createIfcProject()
|
||||
model = ifcopenshell.api.run("context.add_context", ifc, context_type="Model")
|
||||
body = ifcopenshell.api.run("context.add_context", ifc, parent=model, context_type="Model", context_identifier="Body", target_view="MODEL_VIEW")
|
||||
subject.set_default_context()
|
||||
assert bpy.context.scene.BIMRootProperties.contexts == str(body.id())
|
||||
|
||||
|
||||
class TestSetDefaultModelingDimensions(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
ifc.createIfcProject()
|
||||
ifcopenshell.api.run("unit.assign_unit", ifc)
|
||||
subject.set_default_modeling_dimensions()
|
||||
props = bpy.context.scene.BIMModelProperties
|
||||
assert props.extrusion_depth == 3000
|
||||
assert props.length == 1000
|
||||
assert props.rl == 1000
|
||||
assert props.x == 500
|
||||
assert props.y == 500
|
||||
assert props.z == 500
|
||||
|
||||
Reference in New Issue
Block a user