mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 14:22:33 +00:00
New barebones presentation style manager to see the styles in your project.
This commit is contained in:
@@ -195,7 +195,7 @@ Scenario: Update representation - updating a layered extrusion
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
@@ -222,7 +222,7 @@ Scenario: Update representation - updating a profiled extrusion
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
@@ -357,7 +357,7 @@ Scenario: Override duplicate move - copying a layered extrusion
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
@@ -386,7 +386,7 @@ Scenario: Override duplicate move - copying a profiled extrusion
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
|
||||
@@ -79,7 +79,7 @@ Scenario: Animate the construction of a wall
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
When I am on frame "7"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
|
||||
Scenario: Animate the demolition of a wall
|
||||
@@ -116,7 +116,7 @@ Scenario: Animate the demolition of a wall
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 0.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
When I am on frame "7"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
@@ -151,7 +151,7 @@ Scenario: Animate the operation of a wall
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 1.0, 1]"
|
||||
When I am on frame "6"
|
||||
When I am on frame "7"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
|
||||
Scenario: Animate the movement of a wall
|
||||
@@ -200,7 +200,7 @@ Scenario: Animate the movement of a wall
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
When I am on frame "7"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_render" is "True"
|
||||
@@ -239,7 +239,7 @@ Scenario: Animate the consumption of a wall
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
When I am on frame "7"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
|
||||
@@ -57,3 +57,20 @@ Scenario: Edit style
|
||||
And I press "bim.enable_editing_style"
|
||||
When I press "bim.edit_style"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Load styles
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And I add a material
|
||||
And I press "bim.add_style"
|
||||
When I press "bim.load_styles(style_type='IfcSurfaceStyle')"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Disable editing styles
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And I add a material
|
||||
And I press "bim.add_style"
|
||||
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
|
||||
When I press "bim.disable_editing_style"
|
||||
Then nothing happens
|
||||
|
||||
@@ -42,7 +42,7 @@ Scenario: Assign type - assign to a type with a material layer set
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
@@ -68,7 +68,7 @@ Scenario: Assign type - assign to a type with a material profile set
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.add_default_material"
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
|
||||
@@ -174,3 +174,16 @@ class TestEditStyle:
|
||||
ifc.run("style.edit_presentation_style", style="style", attributes="attributes").should_be_called()
|
||||
style.disable_editing("obj").should_be_called()
|
||||
subject.edit_style(ifc, style, obj="obj")
|
||||
|
||||
|
||||
class TestLoadStyles:
|
||||
def test_run(self, style):
|
||||
style.import_presentation_styles("style_type").should_be_called()
|
||||
style.enable_editing_styles().should_be_called()
|
||||
subject.load_styles(style, style_type="style_type")
|
||||
|
||||
|
||||
class TestDisableEditingStyles:
|
||||
def test_run(self, style):
|
||||
style.disable_editing_styles().should_be_called()
|
||||
subject.disable_editing_styles(style)
|
||||
|
||||
@@ -50,6 +50,13 @@ class TestDisableEditing(NewFile):
|
||||
assert obj.BIMStyleProperties.is_editing is False
|
||||
|
||||
|
||||
class TestDisableEditingStyles(NewFile):
|
||||
def test_run(self):
|
||||
bpy.context.scene.BIMStylesProperties.is_editing = True
|
||||
subject.disable_editing_styles()
|
||||
assert bpy.context.scene.BIMStylesProperties.is_editing is False
|
||||
|
||||
|
||||
class TestEnableEditing(NewFile):
|
||||
def test_run(self):
|
||||
obj = bpy.data.materials.new("Material")
|
||||
@@ -57,6 +64,13 @@ class TestEnableEditing(NewFile):
|
||||
assert obj.BIMStyleProperties.is_editing is True
|
||||
|
||||
|
||||
class TestEnableEditingStyles(NewFile):
|
||||
def test_run(self):
|
||||
bpy.context.scene.BIMStylesProperties.is_editing = False
|
||||
subject.enable_editing_styles()
|
||||
assert bpy.context.scene.BIMStylesProperties.is_editing is True
|
||||
|
||||
|
||||
class TestExportSurfaceAttributes(NewFile):
|
||||
def test_run(self):
|
||||
TestImportSurfaceAttributes().test_run()
|
||||
@@ -352,3 +366,45 @@ class TestImportSurfaceAttributes(NewFile):
|
||||
assert len(obj.BIMStyleProperties.attributes) == 2
|
||||
assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name"
|
||||
assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH"
|
||||
|
||||
|
||||
class TestImportPresentationStyles(NewFile):
|
||||
def test_import_curve_styles(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcCurveStyle(Name="Name")
|
||||
subject.import_presentation_styles("IfcCurveStyle")
|
||||
props = bpy.context.scene.BIMStylesProperties
|
||||
assert props.styles[0].ifc_definition_id == style.id()
|
||||
assert props.styles[0].name == "Name"
|
||||
assert props.styles[0].total_elements == 0
|
||||
|
||||
def test_import_fillarea_styles(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcFillAreaStyle(Name="Name")
|
||||
subject.import_presentation_styles("IfcFillAreaStyle")
|
||||
props = bpy.context.scene.BIMStylesProperties
|
||||
assert props.styles[0].ifc_definition_id == style.id()
|
||||
assert props.styles[0].name == "Name"
|
||||
assert props.styles[0].total_elements == 0
|
||||
|
||||
def test_import_surface_styles(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcSurfaceStyle(Name="Name")
|
||||
subject.import_presentation_styles("IfcSurfaceStyle")
|
||||
props = bpy.context.scene.BIMStylesProperties
|
||||
assert props.styles[0].ifc_definition_id == style.id()
|
||||
assert props.styles[0].name == "Name"
|
||||
assert props.styles[0].total_elements == 0
|
||||
|
||||
def test_import_text_styles(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcTextStyle(Name="Name")
|
||||
subject.import_presentation_styles("IfcTextStyle")
|
||||
props = bpy.context.scene.BIMStylesProperties
|
||||
assert props.styles[0].ifc_definition_id == style.id()
|
||||
assert props.styles[0].name == "Name"
|
||||
assert props.styles[0].total_elements == 0
|
||||
|
||||
Reference in New Issue
Block a user