mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +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"
|
||||
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
|
||||
Given an empty IFC project
|
||||
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')"
|
||||
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
|
||||
And I add a cube
|
||||
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')"
|
||||
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" 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
|
||||
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')"
|
||||
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" 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')"
|
||||
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
|
||||
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[1]), np.array(points[0])]
|
||||
elif extrusions := ifcopenshell.util.shape.get_base_extrusions(wall):
|
||||
for item in extrusions:
|
||||
if item.is_a("IfcPolyline"):
|
||||
x = [p[0][0] for p in item.Points]
|
||||
elif item.is_a("IfcIndexedPolyCurve"):
|
||||
x = [p[0] for p in item.Points.CoordList]
|
||||
for extrusion in extrusions:
|
||||
profile = extrusion.SweptArea
|
||||
curve = getattr(profile, "OuterCurve", None)
|
||||
if not curve:
|
||||
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:
|
||||
continue
|
||||
return [np.array((min(x), 0.0)), np.array((max(x), 0.0))]
|
||||
|
||||
Reference in New Issue
Block a user