ifcopenshell.api.profile

Handles the definition of cross sectional profiles

Maintaining a clean profile library is important for structural simulations and identification of standardised profiles for fabrication and carbon counting.

Submodules

Package Contents

ifcopenshell.api.profile.add_arbitrary_profile(file: ifcopenshell.file, profile: list[tuple[float, float]], name: str | None = None) ifcopenshell.entity_instance

Adds a new arbitrary polyline-based profile

The profile is represented as a polyline defined by a list of coordinates. Only straight segments are allowed. Coordinates must be provided in SI meters.

To represent a closed curve, the first and last coordinate must be identical.

Parameters:
  • profile (list[tuple[float, float]]) – A list of coordinates

  • name (str, optional) – If the profile is semantically significant (i.e. to be managed and reused by the user) then it must be named. Otherwise, this may be left as none.

Returns:

The newly created IfcArbitraryClosedProfileDef

Return type:

ifcopenshell.entity_instance

Example:

# A 10mm by 100mm rectangle, such that might be used as a wooden
# skirting board or kick plate.
square = ifcopenshell.api.profile.add_arbitrary_profile(model,
    profile=[(0., 0.), (.01, 0.), (.01, .1), (0., .1), (0., 0.)],
    name="SK01 Profile")
ifcopenshell.api.profile.add_arbitrary_profile_with_voids(file: ifcopenshell.file, outer_profile: list[tuple[float, float]], inner_profiles: list[list[tuple[float, float]]], name: str | None = None) ifcopenshell.entity_instance

Adds a new arbitrary polyline-based profile with voids

The outer profile is represented as a polyline defined by a list of coordinates. Only straight segments are allowed. Coordinates must be provided in SI meters.

To represent a closed curve, the first and last coordinate must be identical.

The inner profiles are represented as a list of polylines. Every polyline in defined by a list of coordinates. Only straight segments are allowed. Coordinates must be provided in SI meters.

Parameters:
  • outer_profile – A list of coordinates

  • inner_profiles – A list of polylines

  • name (str, optional) – If the profile is semantically significant (i.e. to be managed and reused by the user) then it must be named. Otherwise, this may be left as none.

Returns:

The newly created IfcArbitraryProfileDefWithVoids

Return type:

ifcopenshell.entity_instance

Example:

# A 400mm by 400mm square with a 200mm by 200mm hole in it.
square_with_hole = ifcopenshell.api.profile.add_arbitrary_profile_with_voids(model,
    outer_profile=[(0., 0.), (.4, 0.), (.4, .4), (0., .4), (0., 0.)],
    inner_profiles=[[(0.1, 0.1), (0.3, 0.1), (0.3, 0.3), (0.1, 0.3), (0.1, 0.1)]],
    name="SK01 Hole Profile")
ifcopenshell.api.profile.add_parameterized_profile(file: ifcopenshell.file, ifc_class: str) ifcopenshell.entity_instance

Adds a new parameterised profile

IFC offers parameterised profiles for common standardised hot roll steel sections and common concrete forms. A full list is available on the IFC documentation as subclasses of IfcParameterizedProfileDef.

Currently, this API has no benefit over directly calling ifcopenshell.file.create_entity.

Parameters:

ifc_class (str) – The subclass of IfcParameterizedProfileDef that you’d like to create.

Returns:

The newly created element depending on the specified ifc_class.

Return type:

ifcopenshell.entity_instance

Example:

circle = ifcopenshell.api.profile.add_parameterized_profile(model,
    ifc_class="IfcCircleProfileDef")
circle.Radius = 1.
ifcopenshell.api.profile.edit_profile(file: ifcopenshell.file, profile: ifcopenshell.entity_instance, attributes: dict[str, Any]) None

Edits the attributes of an IfcProfileDef

For more information about the attributes and data types of an IfcProfileDef, consult the IFC documentation.

Parameters:
  • profile (ifcopenshell.entity_instance) – The IfcProfileDef entity you want to edit

  • attributes (dict) – a dictionary of attribute names and values.

Returns:

None

Return type:

None

Example:

circle = ifcopenshell.api.profile.add_parameterized_profile(model,
    ifc_class="IfcCircleProfileDef")
circle = 1.

ifcopenshell.api.profile.edit_profile(model,
    profile=circle, attributes={"ProfileName": "1000mm Dia"})
ifcopenshell.api.profile.remove_profile(file: ifcopenshell.file, profile: ifcopenshell.entity_instance) None

Removes a profile

Parameters:

profile (ifcopenshell.entity_instance) – The IfcProfileDef to remove.

Returns:

None

Return type:

None

Example:

circle = ifcopenshell.api.profile.add_parameterized_profile(model,
    ifc_class="IfcCircleProfileDef")
circle = 1.
ifcopenshell.api.profile.remove_profile(model, profile=circle)