mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
See #1227. Fix regression where new wall system didn't preserve existing dimensions when regenerating geometry for an object that previously didn't have a layerset
This commit is contained in:
@@ -10,16 +10,6 @@ Scenario: Add type - adding via manual class assignment
|
|||||||
When I press "bim.assign_class"
|
When I press "bim.assign_class"
|
||||||
Then nothing happens
|
Then nothing happens
|
||||||
|
|
||||||
Scenario: Add type - add from empty template
|
|
||||||
Given an empty IFC project
|
|
||||||
And I press "bim.launch_type_manager"
|
|
||||||
And I set "scene.BIMModelProperties.type_class" to "IfcWallType"
|
|
||||||
And I set "scene.BIMModelProperties.type_predefined_type" to "SOLIDWALL"
|
|
||||||
And I set "scene.BIMModelProperties.type_template" to "EMPTY"
|
|
||||||
When I press "bim.add_type"
|
|
||||||
Then the object "IfcWallType/TYPEX" is an "IfcWallType"
|
|
||||||
And the object "IfcWallType/TYPEX" has no data
|
|
||||||
|
|
||||||
Scenario: Enable editing type
|
Scenario: Enable editing type
|
||||||
Given an empty IFC project
|
Given an empty IFC project
|
||||||
And I add a cube
|
And I add a cube
|
||||||
@@ -73,7 +63,7 @@ Scenario: Assign type - assign to a type with representation maps
|
|||||||
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
||||||
Then the object "IfcWall/Cube" has a "MappedRepresentation" representation of "Model/Body/MODEL_VIEW"
|
Then the object "IfcWall/Cube" has a "MappedRepresentation" representation of "Model/Body/MODEL_VIEW"
|
||||||
|
|
||||||
Scenario: Assign type - assign to a type with a material layer set, which automatically recreates the shape
|
Scenario: Assign type - assign to a type with a material layer set, which automatically recreates a mesh and resets dimensions
|
||||||
Given an empty IFC project
|
Given an empty IFC project
|
||||||
And I add a cube
|
And I add a cube
|
||||||
And the object "Cube" is selected
|
And the object "Cube" is selected
|
||||||
@@ -92,7 +82,28 @@ Scenario: Assign type - assign to a type with a material layer set, which automa
|
|||||||
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
||||||
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
||||||
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
|
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
|
||||||
And the object "IfcWall/Cube" dimensions are "2,.1,3"
|
And the object "IfcWall/Cube" dimensions are "1,.1,1"
|
||||||
|
|
||||||
|
Scenario: Assign type - assign to a type with a material layer set, which automatically recreates a solid (preserving parameters)
|
||||||
|
Given an empty IFC project
|
||||||
|
And I trigger "Add Element"
|
||||||
|
And I set the "Definition" property to "IfcElement"
|
||||||
|
And I set the "Class" property to "IfcWall"
|
||||||
|
And I set the "Representation" property to "Custom Extruded Solid"
|
||||||
|
And I click "OK"
|
||||||
|
And I add an empty
|
||||||
|
And the object "Empty" is selected
|
||||||
|
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_material()"
|
||||||
|
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||||
|
And I press "bim.assign_material"
|
||||||
|
When the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||||
|
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Unnamed')"
|
||||||
|
Then the object "IfcWall/Unnamed" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
||||||
|
And the object "IfcWall/Unnamed" has a "100" thick layered material containing the material "Default"
|
||||||
|
And the object "IfcWall/Unnamed" dimensions are ".5,.1,.5"
|
||||||
|
|
||||||
Scenario: Assign type - assign to a different type with a material layer set
|
Scenario: Assign type - assign to a different type with a material layer set
|
||||||
Given an empty IFC project
|
Given an empty IFC project
|
||||||
@@ -127,10 +138,10 @@ Scenario: Assign type - assign to a different type with a material layer set
|
|||||||
When I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
When I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
||||||
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
||||||
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
|
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
|
||||||
And the object "IfcWall/Cube" dimensions are "2,.1,3"
|
And the object "IfcWall/Cube" dimensions are "1,.1,1"
|
||||||
When I press "bim.assign_type(relating_type={type2}, related_object='IfcWall/Cube')"
|
When I press "bim.assign_type(relating_type={type2}, related_object='IfcWall/Cube')"
|
||||||
Then the object "IfcWall/Cube" has a "200" thick layered material containing the material "Default"
|
Then the object "IfcWall/Cube" has a "200" thick layered material containing the material "Default"
|
||||||
And the object "IfcWall/Cube" dimensions are "2,.2,3"
|
And the object "IfcWall/Cube" dimensions are "1,.2,1"
|
||||||
|
|
||||||
Scenario: Assign type - assign to a type with a material profile set
|
Scenario: Assign type - assign to a type with a material profile set
|
||||||
Given an empty IFC project
|
Given an empty IFC project
|
||||||
|
|||||||
@@ -490,11 +490,15 @@ def get_reference_line(wall: ifcopenshell.entity_instance, fallback_length: floa
|
|||||||
return [np.array(points[0]), np.array(points[1])]
|
return [np.array(points[0]), np.array(points[1])]
|
||||||
return [np.array(points[1]), np.array(points[0])]
|
return [np.array(points[1]), np.array(points[0])]
|
||||||
elif extrusions := ifcopenshell.util.shape.get_base_extrusions(wall):
|
elif extrusions := ifcopenshell.util.shape.get_base_extrusions(wall):
|
||||||
for item in extrusions:
|
for extrusion in extrusions:
|
||||||
if item.is_a("IfcPolyline"):
|
profile = extrusion.SweptArea
|
||||||
x = [p[0][0] for p in item.Points]
|
curve = getattr(profile, "OuterCurve", None)
|
||||||
elif item.is_a("IfcIndexedPolyCurve"):
|
if not curve:
|
||||||
x = [p[0] for p in item.Points.CoordList]
|
continue
|
||||||
|
elif curve.is_a("IfcPolyline"):
|
||||||
|
x = [p[0][0] for p in curve.Points]
|
||||||
|
elif curve.is_a("IfcIndexedPolyCurve"):
|
||||||
|
x = [p[0] for p in curve.Points.CoordList]
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
return [np.array((min(x), 0.0)), np.array((max(x), 0.0))]
|
return [np.array((min(x), 0.0)), np.array((max(x), 0.0))]
|
||||||
|
|||||||
Reference in New Issue
Block a user