Fix validate_type corruption; remove debug prints

When validate_type selected a preferred_item from remaining_items
(e.g. the sole IfcBooleanResult in a representation), it left that
item in the list. The subsequent Items filter removed every item,
leaving Items=[] and causing guess_type to return
"MappedRepresentation" — silently corrupting the representation.

Also removes temporary debug print statements added during
investigation of the wall-to-slab extension workflow.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Ryan Schultz
2026-04-18 11:57:28 -05:00
parent a9b6f02f02
commit 36372627db
4 changed files with 60 additions and 12 deletions
@@ -81,6 +81,13 @@ def validate_type(
if not preferred_item and remaining_items:
preferred_item = remaining_items[0]
# preferred_item must not appear in remaining_items — if it was selected from
# that list, leaving it in causes add_boolean to union it with itself, and the
# subsequent Items filter then removes ALL items (including preferred_item),
# leaving Items=[] which guess_type maps to "MappedRepresentation".
if preferred_item in remaining_items:
remaining_items = [i for i in remaining_items if i != preferred_item]
if remaining_items:
ifcopenshell.api.geometry.add_boolean(file, preferred_item, remaining_items, "UNION")
representation.Items = [i for i in representation.Items if i not in remaining_items]