mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
ShapeBuilder: added support for IndexedPolygonalFaceWithVoids, fixed winding order when mirroring on an even number of axes
This commit is contained in:
committed by
Ryan Schultz
parent
21d1d014e3
commit
adac547222
@@ -927,6 +927,8 @@ class ShapeBuilder:
|
|||||||
processed_objects: list[ifcopenshell.entity_instance] = []
|
processed_objects: list[ifcopenshell.entity_instance] = []
|
||||||
for curve_or_item_el in curve_or_item:
|
for curve_or_item_el in curve_or_item:
|
||||||
for mirror_axes in mirror_axes_data:
|
for mirror_axes in mirror_axes_data:
|
||||||
|
axis_flip_count = sum([a > 0.0 for a in mirror_axes])
|
||||||
|
|
||||||
c = (
|
c = (
|
||||||
ifcopenshell.util.element.copy_deep(self.file, curve_or_item_el)
|
ifcopenshell.util.element.copy_deep(self.file, curve_or_item_el)
|
||||||
if create_copy
|
if create_copy
|
||||||
@@ -1015,12 +1017,23 @@ class ShapeBuilder:
|
|||||||
new_coords.append([float(new_coord_2d[0]), float(new_coord_2d[1]), float(coord[2])])
|
new_coords.append([float(new_coord_2d[0]), float(new_coord_2d[1]), float(coord[2])])
|
||||||
c.Coordinates.CoordList = new_coords
|
c.Coordinates.CoordList = new_coords
|
||||||
|
|
||||||
for face in c.Faces:
|
if (axis_flip_count % 2) != 0:
|
||||||
new_indices = []
|
for face in c.Faces:
|
||||||
for index in face.CoordIndex:
|
new_indices = []
|
||||||
new_indices.append(int(index))
|
for index in face.CoordIndex:
|
||||||
new_indices.reverse()
|
new_indices.append(int(index))
|
||||||
face.CoordIndex = new_indices
|
new_indices.reverse()
|
||||||
|
face.CoordIndex = new_indices
|
||||||
|
|
||||||
|
if face.is_a("IfcIndexedPolygonalFaceWithVoids"):
|
||||||
|
new_inner_indices = []
|
||||||
|
for inner_loop in face.InnerCoordIndices:
|
||||||
|
new_indices = []
|
||||||
|
for index in inner_loop:
|
||||||
|
new_indices.append(index)
|
||||||
|
new_indices.reverse()
|
||||||
|
new_inner_indices.append(new_indices)
|
||||||
|
face.InnerCoordIndices = new_inner_indices
|
||||||
elif c.is_a("IfcGeometricSet"):
|
elif c.is_a("IfcGeometricSet"):
|
||||||
self.mirror(c.Elements, mirror_axes, mirror_point)
|
self.mirror(c.Elements, mirror_axes, mirror_point)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user