ifcopenshell.api.geometry.validate_type
¶
Module Contents¶
- ifcopenshell.api.geometry.validate_type.validate_type(file: ifcopenshell.file, representation: ifcopenshell.entity_instance, preferred_item: ifcopenshell.entity_instance | None = None) bool ¶
Validates the RepresentationType of an IfcShapeRepresentation
A shape representation has to identify its geometry using the RepresentationType attribute. For example, if it holds tessellated geometry, it should store “Tessellation” as its RepresentationType.
This function checks whether or not the RepresentationType is valid. This is a wrapper around
ifcopenshell.util.representation.guess_type()
. It will then set RepresentationType to the most appropriate value, or return False otherwise. In addition, it also attempts to reconcile otherwise invalid CSG geometry by unioning all remaining top level items to existing boolean results.- Parameters:
representation – The IfcShapeRepresentation with Items
preferred_item – If the type is expected to be a CSG, this will be the preferred item to union all remaining items to. If no preferred item is provided, the first boolean result will be chosen.
- Returns:
True if the representation type was set and it is a valid combination, or False otherwise.