ifcopenshell.api.geometry.add_topology_representation

Module Contents

ifcopenshell.api.geometry.add_topology_representation.add_topology_representation(file: ifcopenshell.file, context: ifcopenshell.entity_instance, item: ifcopenshell.entity_instance, representation_identifier: str | None = None, representation_type: str | None = None) ifcopenshell.entity_instance

Adds an IfcTopologyRepresentation for a structural element

Structural analysis elements (IfcStructuralSurfaceMember, IfcStructuralCurveMember) use topology representations rather than solid geometry. This is analogous to add_axis_representation() and add_profile_representation() but produces an IfcTopologyRepresentation instead of an IfcShapeRepresentation.

The representation type (“Face”, “Edge”, “Vertex”) is inferred from the item’s IFC class if not provided explicitly.

Parameters:
  • context – The IfcGeometricRepresentationContext for the representation, typically a Reference context.

  • item – The IfcTopologicalRepresentationItem (e.g. IfcFaceSurface, IfcEdge) to include in the representation.

  • representation_identifier – The RepresentationIdentifier string. Defaults to the context’s ContextIdentifier.

  • representation_type – The RepresentationType string (“Face”, “Edge”, “Vertex”). Inferred from item class if not given.

Returns:

The newly created IfcTopologyRepresentation entity.

Example:

context = ifcopenshell.util.representation.get_context(
    model, "Model", "Reference", "GRAPH_VIEW")
face = model.createIfcFaceSurface(bounds, surface, True)
rep = ifcopenshell.api.geometry.add_topology_representation(
    model, context=context, item=face)
ifcopenshell.api.geometry.assign_representation(
    model, product=member, representation=rep)