ifcpatch.recipes.OffsetObjectPlacements

Module Contents

class ifcpatch.recipes.OffsetObjectPlacements.Patcher(src, file, logger, x=None, y=None, z=None, should_rotate_first=True, ax=None, ay=None, az=None)

Offset and rotate all object placements in a model

Every physical object in an IFC model has an object placement, a matrix dictating where it is in XYZ space and its rotation.

Sometimes, models will have their models offset incorrectly into map coordinates (i.e. very large coordinates) when they should be using local coordinates, or vice versa, or simply be using wrong coordinates.

In some cases, models will even be rotated, especially with mixups where Y is up instead of Z, coming from low quality BIM software.

This patch lets you translate, and optionally rotate (either rotate 2D in plan view along the Z axis, or rotate in 3D across any axis) the entire IFC model.

Parameters:
  • x (float) – The X coordinate to offset by in project length units.

  • y (float) – The Y coordinate to offset by in project length units.

  • z (float) – The Z coordinate to offset by in project length units.

  • should_rotate_first (bool) – Whether or not to rotate first and then translate, or to first translate and rotate afterwards. Defaults to rotate first then translate.

  • ax (float,optional) – An optional angle to rotate by. If only this angle is specified, it is treated as the angle to rotate in plan view (i.e. around the Z axis). If all angle parameters are specified, then it is treated as the angle to rotate around the X axis. Angles are in decimal degrees and positive is anticlockwise.

  • ay (float,optional) – An optional angle to rotate by for 3D rotations along the Y axis. Angles are in decimal degrees and positive is anticlockwise.

  • az (float,optional) – An optional angle to rotate by for 3D rotations along the Z axis. Angles are in decimal degrees and positive is anticlockwise.

Example:

# Offset a model by 100 units in both the X and Y axis.
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [100,100,0]})

# Rotate by 90 degrees, but don't do any offset
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [0,0,0,True,90]})

# Some crazy 3D rotation and offset
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "OffsetObjectPlacements", "arguments": [12.5,5,2,False,90,90,45]})
create_ifc_axis_2_placement_3d(point, up, forward)
get_absolute_placement(object_placement)
get_relative_placement(m)
identity_matrix()
patch()
x_rotation_matrix(angle, transformation)
y_rotation_matrix(angle, transformation)
z_rotation_matrix(angle, transformation)