ifcpatch.recipes.ResetAbsoluteCoordinates

Module Contents

class ifcpatch.recipes.ResetAbsoluteCoordinates.Patcher(src, file, logger, mode='geometry', a=None, b=None, c=None, d=None)

Reset any large coordinates to smaller coordinates based on a threshold

If you find large coordinates in your model, the large coordinates may either by due to large coordinates in the object placement matrix of each object, or large coordinates in the geometry of each object.

If it is the former (preferred), consult the OffsetObjectPlacements recipe. If it is the latter, this indicates seriously incorrect coordinates in your IFC model.

This recipe finds any large coordinates (if either the X, Y, or Z ordinate is larger than a threshold) and offsets it back down to a small number.

You may either manually specify the offset to apply to any large coordinate, or an offset will be automatically determined arbitrarily based on the first large number we encounter.

Note that if your model inconsistently mixes coordinates between large and small (such as if your model mixes both local and map coordinates) then the results of this function may be poor. Provide a bug report back to your BIM application to get it fixed.

You may specify up to 4 arguments, a, b, c, and d.

If you specify no arguments, then the threshold is set to 1000000. The offset is auto detected.

If you only specify 1 parameter (i.e. a), then this is treated as the threshold beyond which an ordinate is considered to be large. The offset is auto detected.

If you specify 3 parameters, (i.e. a, b, c) then your three numbers are treated as the X, Y, Z offset to apply. Typically your numbers will be negative to bring the numbers smaller. The threshold is set to 1000000.

If you specify 4 parameters (i.e. a, b, c, d), then the first three numbers are treated as the X, Y, Z offset to apply (a, b, c). The fourth (d) will be treated as the threshold.

Parameters:
  • mode (str) – Choose from “geometry”, “placement”, or “both”. Choosing “geometry” will only replace cartesian points used in shape representations. Choosing “placement” will only replace cartesian points used in object placements. Choosing “both” will replace all cartesian points regardless of use (useful if the model has both large placement offsets and large geometry offsets).

  • a (float,optional) – The first parameter

  • b (float,optional) – The second parameter

  • c (float,optional) – The third parameter

  • d (float,optional) – The fourth parameter

Example:

# Reset all coordinates with an ordinate larger than 1000000 arbitrarily
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": []})

# Reset all coordinates with an ordinate larger than 1000 arbitrarily
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [1000]})

# Reset all coordinates with an ordinate larger than 1000000 by -50000,-20000,0
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-50000,-20000,0]})

# Reset all coordinates with an ordinate larger than 1000 by -500,-200,0
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ResetAbsoluteCoordinates", "arguments": [-500,-200,0,1000]})
is_point_far_away(point)
patch()