mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-01 09:26:26 +00:00
Add regression tests for sloped slab, curved wall
Cover a curved vertical wall (EXTRUDE_CLIP strategy) in test_space.py and a sloped slab (clipped extrusion) in test_spatial.py. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -22,6 +22,7 @@ import ifcopenshell.geom
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.shape
|
||||
import ifcopenshell.util.space as subject
|
||||
import math
|
||||
import numpy as np
|
||||
import pytest
|
||||
import shapely
|
||||
@@ -266,6 +267,23 @@ class TestDetectSpaceVolumeStrategy(test.bootstrap.IFC4):
|
||||
)
|
||||
assert strategy == "BREP"
|
||||
|
||||
def test_curved_vertical_wall_returns_extrude_clip(self):
|
||||
wall = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
|
||||
pts = []
|
||||
for i in range(9):
|
||||
angle = -math.pi / 2.0 + math.pi * i / 8.0
|
||||
pts.append((5.0 * math.cos(angle), 5.0 * math.sin(angle)))
|
||||
_add_extruded_body(self.file, wall, pts, 6.0)
|
||||
shapes = _build_shapes_dict(self.file, [wall])
|
||||
tree = ifcopenshell.geom.tree(self.file)
|
||||
tree.add_file(self.file, ifcopenshell.geom.settings())
|
||||
strategy, top, bottom = subject.detect_space_volume_strategy(
|
||||
self.file, shapes, tree, shapely.box(-4, -4, 4, 4), 0.0, [wall]
|
||||
)
|
||||
assert strategy == "EXTRUDE_CLIP"
|
||||
assert len(top) == 1
|
||||
assert len(bottom) == 0
|
||||
|
||||
|
||||
class TestBuildExtrudedClippedSpace(test.bootstrap.IFC4):
|
||||
def test_shed_roof_clips_to_sloped_plane(self):
|
||||
|
||||
Reference in New Issue
Block a user