Skip to content

compas_timber.errors ¤

Classes¤

BTLxParsingError ¤

BTLxParsingError(message, part_id=None, processing_type=None)

Raised when a non-fatal error occurs while parsing a BTLx file.

These errors are collected during parsing and do not abort the process. Inspect BTLxReader.errors after reading to retrieve them.

Attributes:

  • message (str) –

    The error message.

  • part_id ((str, optional)) –

    The annotation or name of the BTLx Part in which the error occurred.

  • processing_type ((str, optional)) –

    The processing type name (e.g. JackRafterCut) that caused the error, if applicable.

Source code in src/compas_timber/errors.py
def __init__(self, message, part_id=None, processing_type=None):
    super(BTLxParsingError, self).__init__(message)
    self.message = message
    self.part_id = part_id
    self.processing_type = processing_type

BTLxProcessingError ¤

BTLxProcessingError(message, part, failed_processing)

Error which occurred while writing a Processing to a BTLx file.

This error is not raised but rather collected by BTLxWriter and exposed via its errors property.

Todo

some work here to figure out the different types of feature/processing related errors. TODO: this one is somewhat similar to FeatureApplicationError, but only relevant when processing is created from its proxy. TODO: also BTLxProcessingError is never throws but rather collected to form some sort of a report for the user.

Parameters:

  • message (str) –

    The error message.

  • part (:class:`BTLxPart`) –

    The part that caused the error.

  • failed_processing (:class:`BTLxProcessing`) –

    The processing that caused the error.

Attributes:

  • message (str) –

    The error message.

  • part (:class:`BTLxPart`) –

    The part that caused the error.

  • failed_processing (:class:`BTLxProcessing`) –

    The processing that caused the error.

Source code in src/compas_timber/errors.py
def __init__(self, message, part, failed_processing):
    super(BTLxProcessingError, self).__init__(message)
    self.message = message
    self.part = part
    self.failed_processing = failed_processing

BeamJoiningError ¤

BeamJoiningError(beams, joint, debug_info=None, debug_geometries=None)

Indicates that an error has occurred while trying to join two or more beams.

This error should indicate that an error has occurred while calculating the features which should be applied by this joint.

debug_geometries is always expected to be in the model's global coordinate system, e.g. the planes/boxes involved are typically taken directly from beam properties such as ref_sides or blank, which are already expressed in model space.

Attributes:

  • beams (list(:class:`~compas_timber.parts.Beam`)) –

    The beams that were supposed to be joined.

  • debug_geometries (list(:class:`~compas.geometry.Geometry`)) –

    A list of geometries, in model space, that can be used to visualize the error.

  • debug_info (str) –

    A string containing debug information about the error.

  • joint (:class:`~compas_timber.connections.Joint`) –

    The joint that was supposed to join the beams.

Source code in src/compas_timber/errors.py
def __init__(self, beams, joint, debug_info=None, debug_geometries=None):
    super(BeamJoiningError, self).__init__(debug_info)
    self.beams = beams
    self.joint = joint
    self.debug_info = debug_info
    if debug_geometries and not isinstance(debug_geometries, list):
        debug_geometries = [debug_geometries]
    self.debug_geometries = debug_geometries or []

FastenerApplicationError ¤

FastenerApplicationError(elements, fastener, message)

Raised when a fastener cannot be applied to a joint.

Attributes:

  • elements (list of : class:`~compas_timber.elements.TimberElement`) –

    The elements of the Joint to which the fastener could not be applied.

  • fastener (:class:`~compas_timber.elements.Fastener`) –

    The fastener that could not be applied.

  • message (str) –

    The error message.

Source code in src/compas_timber/errors.py
def __init__(self, elements, fastener, message):
    super(FastenerApplicationError, self).__init__(message)
    self.elements = elements
    self.fastener = fastener
    self.message = message

FeatureApplicationError ¤

FeatureApplicationError(feature_geometry, element_geometry, message)

Raised when a feature cannot be applied to an element geometry.

Todo

perhaps should be renamed to ProcessingVisualizationError or something similar.

feature_geometry and element_geometry are always expected to be in the model's global coordinate system, regardless of the coordinate system the failure was detected in. Callers raising this error from a context where the geometry is in local/element space (e.g. inside BTLxProcessing.apply()) are responsible for transforming the geometry to model space themselves (e.g. via geometry.transformed(beam.modeltransformation)) before passing it in.

Attributes:

  • feature_geometry (:class:`~compas.geometry.Geometry`) –

    The geometry of the feature that could not be applied, in model space.

  • element_geometry (:class:`~compas.geometry.Geometry`) –

    The geometry of the element that could not be modified, in model space.

  • message (str) –

    The error message.

Source code in src/compas_timber/errors.py
def __init__(self, feature_geometry, element_geometry, message):
    super(FeatureApplicationError, self).__init__(message)
    self.feature_geometry = feature_geometry
    self.element_geometry = element_geometry
    self.message = message