mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-15 18:14:08 +00:00
Minor refactor add_constr_type_instance is now add_occurrence
This commit is contained in:
@@ -9,26 +9,27 @@ Scenario: Execute generate flooring coverings from walls
|
||||
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
|
||||
# 1st wall
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWall/Wall" is selected
|
||||
And I press "bim.change_layer_length(length=3.6)"
|
||||
# 2nd wall
|
||||
And the cursor is at "3.6,0.1,3"
|
||||
And I set "scene.BIMModelProperties.length" to "2.0"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
# 3rd wall
|
||||
And the cursor is at "3.5,2.1,3"
|
||||
And I set "scene.BIMModelProperties.length" to "3.5"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
# 4th wall
|
||||
And the cursor is at "0,2.0,0"
|
||||
And I set "scene.BIMModelProperties.length" to "1.9"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
# add_instance_flooring_coverings_from_walls is expecting FLOORING predefined type.
|
||||
And the object "IfcCoveringType/COV30" is selected
|
||||
And I press "bim.enable_editing_attributes(obj='IfcCoveringType/COV30')"
|
||||
And I set "active_object.BIMAttributeProperties.attributes[6].enum_value" to "FLOORING"
|
||||
And I press "bim.edit_attributes(obj='IfcCoveringType/COV30')"
|
||||
And I look at the "Attributes" panel
|
||||
And I click "Edit"
|
||||
And I set the "PredefinedType" property to "FLOORING"
|
||||
And I click "Save Attributes"
|
||||
# Run the operator.
|
||||
When the object "IfcWall/Wall" is selected
|
||||
And additionally the object "IfcWall/Wall.001" is selected
|
||||
|
||||
@@ -33,8 +33,8 @@ Scenario: Add representation - add a new representation to a typed instance
|
||||
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_constr_type_instance"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
And the object "IfcWall/Wall.001" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
When the object "IfcWall/Wall" is selected
|
||||
@@ -127,8 +127,8 @@ Scenario: Remove representation - remove an instanced representation from an act
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{cube}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWallType/Cube" is selected
|
||||
When the variable "representation_body" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[0].MappedRepresentation.id()"
|
||||
And I press "bim.remove_representation(representation_id={representation_body})"
|
||||
@@ -146,8 +146,8 @@ Scenario: Remove representation - remove an instanced representation from an act
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{cube}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWall/Wall" is selected
|
||||
When the variable "representation_body" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[0].id()"
|
||||
And I press "bim.remove_representation(representation_id={representation_body})"
|
||||
@@ -339,7 +339,7 @@ Scenario: Override duplicate move - copying a type instance with a representatio
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{cube}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWall/Wall" is selected
|
||||
When I duplicate the selected objects
|
||||
Then the object "IfcWall/Wall.001" exists
|
||||
@@ -425,14 +425,14 @@ Scenario: Override duplicate move - copying objects with connection
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" is an "IfcWall"
|
||||
And the object "IfcWall/Wall" dimensions are "1,0.1,3"
|
||||
And the object "IfcWall/Wall" bottom left corner is at "0,0,0"
|
||||
When I set "scene.BIMModelProperties.ifc_class" to "IfcSlabType"
|
||||
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcSlabType') if e.Name == 'FLR200'][0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcSlab/Slab" is an "IfcSlab"
|
||||
When the object "IfcSlab/Slab" is selected
|
||||
And the object "IfcSlab/Slab" is moved to "0,0,4"
|
||||
|
||||
@@ -11,7 +11,7 @@ Scenario: Add type instance - add from a mesh
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{cube}"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" exists
|
||||
|
||||
Scenario: Add type instance - add from an empty
|
||||
@@ -24,7 +24,7 @@ Scenario: Add type instance - add from an empty
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "empty" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{empty}"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" exists
|
||||
|
||||
Scenario: Add type instance - add a mesh where existing instances have changed context
|
||||
@@ -37,14 +37,14 @@ Scenario: Add type instance - add a mesh where existing instances have changed c
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{cube}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
And the object "IfcWall/Wall" is selected
|
||||
And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier == 'Body' and c.TargetView == 'PLAN_VIEW'][0].id()"
|
||||
And I set "active_object.BIMGeometryProperties.contexts" to "{context}"
|
||||
And I press "bim.add_representation"
|
||||
And the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
|
||||
And the object "IfcWall/Wall.001" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
|
||||
|
||||
@@ -72,7 +72,7 @@ Scenario: Add a wall
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
|
||||
When I press "bim.add_constr_type_instance"
|
||||
When I press "bim.add_occurrence"
|
||||
Then the object "IfcWall/Wall" is an "IfcWall"
|
||||
And the object "IfcWall/Wall" dimensions are "1,0.1,3"
|
||||
And the object "IfcWall/Wall" bottom left corner is at "0,0,0"
|
||||
@@ -525,11 +525,11 @@ Scenario: Create a MEP transition
|
||||
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/RectSegment"
|
||||
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[1]"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/CircleSegment"
|
||||
|
||||
And the object "IfcDuctSegment/RectSegment" is moved to "0,0,0"
|
||||
@@ -555,11 +555,11 @@ Scenario: Create a MEP bend between intersecting with different locations
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I set "scene.BIMModelProperties.extrusion_depth" to "5.0"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1"
|
||||
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2"
|
||||
And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg
|
||||
|
||||
@@ -585,11 +585,11 @@ Scenario: Create a MEP bend between intersecting segments at the same location
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I set "scene.BIMModelProperties.extrusion_depth" to "5.0"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1"
|
||||
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2"
|
||||
And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ Scenario: Execute generate spaces from walls
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
|
||||
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcWall/Wall" is selected
|
||||
When I press "bim.generate_spaces_from_walls"
|
||||
Then nothing happens
|
||||
|
||||
@@ -139,13 +139,13 @@ Scenario: Connect MEP elements
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I set "scene.BIMModelProperties.extrusion_depth" to "5.0"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1"
|
||||
|
||||
# actuator
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcActuatorType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{actuator_type_id}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcActuator/Actuator" is moved to "10,0,0"
|
||||
|
||||
# connect actuator
|
||||
@@ -169,12 +169,12 @@ Scenario: Connect MEP elements and regenerate
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I set "scene.BIMModelProperties.extrusion_depth" to "5.0"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1"
|
||||
|
||||
# segment2
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2"
|
||||
And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg
|
||||
|
||||
@@ -186,7 +186,7 @@ Scenario: Connect MEP elements and regenerate
|
||||
# actuator
|
||||
And I set "scene.BIMModelProperties.ifc_class" to "IfcActuatorType"
|
||||
And I set "scene.BIMModelProperties.relating_type_id" to "{actuator_type_id}"
|
||||
And I press "bim.add_constr_type_instance"
|
||||
And I press "bim.add_occurrence"
|
||||
And the object "IfcActuator/Actuator" is moved to "10,0,0"
|
||||
|
||||
# connect actuator
|
||||
|
||||
@@ -1248,7 +1248,7 @@ def i_display_the_construction_type_browser():
|
||||
@when("I add the construction type")
|
||||
def i_add_the_active_construction_type():
|
||||
props = tool.Model.get_model_props()
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=int(props.relating_type_id))
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=int(props.relating_type_id))
|
||||
|
||||
|
||||
@then(parsers.parse("construction type is {relating_type_name}"))
|
||||
|
||||
@@ -517,12 +517,12 @@ class TestApplyIfcMaterialChanges(NewFile):
|
||||
|
||||
# Setup occurrences.
|
||||
relating_type_id = element_type.id()
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
simple = bpy.context.active_object
|
||||
simple.name = "Simple"
|
||||
|
||||
# Occurrence with an opening.
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
with_opening = bpy.context.active_object
|
||||
with_opening.name = "With Opening"
|
||||
props = tool.Root.get_root_props()
|
||||
@@ -530,7 +530,7 @@ class TestApplyIfcMaterialChanges(NewFile):
|
||||
bpy.ops.bim.add_element(ifc_product="IfcFeatureElement", ifc_class="IfcOpeningElement")
|
||||
|
||||
# Occurrence with a material override.
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
with_material = bpy.context.active_object
|
||||
with_material.name = "With Material"
|
||||
tool.Blender.set_objects_selection(bpy.context, active_object=with_material, selected_objects=[with_material])
|
||||
|
||||
@@ -184,9 +184,9 @@ class TestReassignClass(NewFile):
|
||||
n_slab_types = len(ifc_file.by_type("IfcSlabType"))
|
||||
|
||||
# create 3 slabs
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id)
|
||||
|
||||
slabs = [tool.Ifc.get_object(e) for e in ifc_file.by_type("IfcSlab")]
|
||||
assert len(slabs) == 3
|
||||
|
||||
Reference in New Issue
Block a user