ifcpatch.recipes.MergeDuplicateTypes

Module Contents

class ifcpatch.recipes.MergeDuplicateTypes.Patcher(src: str, file: ifcopenshell.file, logger: logging.Logger, attribute: str = 'Tag')

Merge duplicate element types via the Tag or another attribute

Revit is notorious for creating many duplicate element types. Element types may be duplicated by being mirrored, such as doors, columns, etc, or being certain MEP equipment. This means that even though you think you might have only 3 door families and 3 door types in your door schedule, your IFC might actually incorrectly store 6 or more door types.

Revit stores the Revit Element ID in the “Tag” attribute of all IFC elements, so we can deduce that multiple IFC elements with the same Tag attribute have been duplicated in IFC. This patch will merge them into a single element type.

You may optionally specify your own attribute if you want to merge using different criteria, such as “Name”. For example, may Revit users incorrectly have multiple types with the same name as workarounds to overcome various Revit limitations. This is incorrect and this patch will merge the types into a single type.

Occurrences of the type will be remapped to the merged type.

Parameters:

attribute (str) – The name of the attribute to merge element types based on. Typically this will be “Tag” as it stores the unique ID from the proprietary BIM software.

Example:

# Default behaviour of merging by Tag attribute
ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": []})

# Explicitly say we want to merge based on the Name attribute
ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]})
assign_type(related_objects: list[ifcopenshell.entity_instance], relating_type: ifcopenshell.entity_instance) None
patch()