ifcopenshell.api.style.add_style

Module Contents

ifcopenshell.api.style.add_style.add_style(file: ifcopenshell.file, name: str | None = None, ifc_class='IfcSurfaceStyle') ifcopenshell.entity_instance

Add a new presentation style

A presentation style is a container of visual settings (called presentation items) that affect the appearance of objects. There are four types of style:

  • Surface styles, which give 3D objects (which have surfaces / faces) their colours and textures. This is the most common type of style.

  • Curve styles, which give 2D and 3D curves, lines, polylines, their stroke thickness and colour.

  • Fill area styles, which gives 2D polygons and flat 3D planes their colours, hatch patterns, tiled patterns, and pattern scales.

  • Text styles, which gives text their font family, weight, variant, size, indentation, alignment, decoration, spacing, and transformation.

Once you have created a presentation style object, you can further define the properties of your style using other API functions by adding presentation items, such as ifcopenshell.api.style.add_surface_style.

Parameters:
  • name (str,optional) – The name of the style. Used to easily identify it using a style library.

  • ifc_class (str) – Choose from IfcSurfaceStyle, IfcCurveStyle, IfcFillAreaStyle, or IfcTextStyle.

Returns:

The newly created style element, based on the provided ifc_class.

Return type:

ifcopenshell.entity_instance

Example:

# Create a new surface style
style = ifcopenshell.api.style.add_style(model)