ifcopenshell.api.style.add_style#

Module Contents#

class ifcopenshell.api.style.add_style.Usecase(file, name=None, ifc_class='IfcSurfaceStyle')#

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.entity_instance

Example:

# Create a new surface style
style = ifcopenshell.api.run("style.add_style", model)
execute(self)#