Skip to content

Drawing ID

Together with the owner, the drawing ID is the single most important feature to identify the drawing.

Requesting the Drawing ID

from werk24 import Hook, W24AskTitleBlock
from werk24.models.techread import W24TechreadMessage
from werk24.utils import w24_read_sync

# define a function to read a file and return it as bytes
from . import get_drawing_bytes


def recv_title_block(message: W24TechreadMessage) -> None:
    """ print the Drawing ID when we received it
    """
    if message.is_successful:
        print(message.payload_dict.get('drawing_id'))
    else:
        print("Exceptions occurred: {message.exceptions}")


if __name__ == "__main__":

    # get your drawing bytes from a file or buffer
    drawing_bytes = get_drawing_bytes()

    # define what information you want to receive from the API
    # and what shall be done when the info is available.
    hooks = [Hook(ask=W24AskTitleBlock(), function=recv_title_block)]

    # submit the request to the Werk24 API
    w24_read_sync(drawing_bytes, hooks)

Example Response

"drawing_id": {
    "blurb": "Drawing ID / Zeichnungs Nr.: 037999-001-01",
    "names": [
        {
            "language": "eng",
            "text": "Drawing ID"
        },
        {
            "language": "deu",
            "text": "Zeichnungs Nr."
        }
    ],
    "value": "037999-001-01"
}

Error Handling

Things do not always run smoothly. When you request the Drawing ID, the following exceptions might be triggered.

Exception Type Level Description
DRAWING_FILE_FORMAT_UNSUPPORTED ERROR The drawing could not be read in any of the supported file formats. Refer to Limitations/DrawingFileFormats for details.
DRAWING_FILE_SIZE_TOO_LARGE ERROR The drawing exceeded the file size limit. Refer to Limitations/DrawingFileSize for details.
DRAWING_RESOLUTION_TOO_LOW ERROR The drawing has a low resolution and could not be read. Refer to Limitations/DrawngResolution for details.
DRAWING_CONTENT_NOT_UNDERSTOOD ERROR The file could not be interpreted as Technical Drawing or does not contain a TitleBlock.

Model

Refer to W24CaptionValuePair