mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
Handle IfcCompositeProfileDef in derive_from_slab
When a slab consists of multiple separate closed loops, the swept area is IfcCompositeProfileDef which has a Profiles attribute rather than OuterCurve. Iterate over each profile and generate walls for all loops. Generated with the assistance of an AI coding tool.
This commit is contained in:
committed by
GitHub
parent
bcaf64eda0
commit
97c2d112cd
@@ -1398,7 +1398,14 @@ class DumbWallGenerator:
|
|||||||
elevation = self.container_obj.location.z
|
elevation = self.container_obj.location.z
|
||||||
representation = ifcopenshell.util.representation.get_representation(slab, "Model", "Body", "MODEL_VIEW")
|
representation = ifcopenshell.util.representation.get_representation(slab, "Model", "Body", "MODEL_VIEW")
|
||||||
extrusion = tool.Model.get_extrusion(representation)
|
extrusion = tool.Model.get_extrusion(representation)
|
||||||
outer_curve = extrusion.SweptArea.OuterCurve
|
swept_area = extrusion.SweptArea
|
||||||
|
if swept_area.is_a("IfcCompositeProfileDef"):
|
||||||
|
profiles = swept_area.Profiles
|
||||||
|
else:
|
||||||
|
profiles = [swept_area]
|
||||||
|
walls = []
|
||||||
|
for profile in profiles:
|
||||||
|
outer_curve = profile.OuterCurve
|
||||||
if self._curve_has_arc_segments(outer_curve):
|
if self._curve_has_arc_segments(outer_curve):
|
||||||
polyline_points = self._derive_points_from_arc_segments(slab_obj, elevation, outer_curve)
|
polyline_points = self._derive_points_from_arc_segments(slab_obj, elevation, outer_curve)
|
||||||
elif outer_curve.is_a("IfcCircle"):
|
elif outer_curve.is_a("IfcCircle"):
|
||||||
@@ -1410,10 +1417,9 @@ class DumbWallGenerator:
|
|||||||
polyline_points = [slab_obj.matrix_world @ Vector((p[0], p[1], elevation)) for p in polyline_points]
|
polyline_points = [slab_obj.matrix_world @ Vector((p[0], p[1], elevation)) for p in polyline_points]
|
||||||
|
|
||||||
if len(polyline_points) < 3:
|
if len(polyline_points) < 3:
|
||||||
return []
|
continue
|
||||||
if not tool.Cad.is_counter_clockwise_order(polyline_points[0], polyline_points[1], polyline_points[2]):
|
if not tool.Cad.is_counter_clockwise_order(polyline_points[0], polyline_points[1], polyline_points[2]):
|
||||||
polyline_points = polyline_points[::-1]
|
polyline_points = polyline_points[::-1]
|
||||||
walls = []
|
|
||||||
for i in range(len(polyline_points) - 1):
|
for i in range(len(polyline_points) - 1):
|
||||||
vec1 = polyline_points[i]
|
vec1 = polyline_points[i]
|
||||||
vec2 = polyline_points[i + 1]
|
vec2 = polyline_points[i + 1]
|
||||||
|
|||||||
Reference in New Issue
Block a user