Designation¶
The designation on a Technical Drawing gives relevant clues on what geometry to expect on the drawing. It is one of the easiest ways of finding the drawing in a big database.
Requesting the Designation¶
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 Designation when we received it
"""
if message.is_successful:
print(message.payload_dict.get('designation'))
else:
print("Exceptions occured: {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¶
"designation": {
"names": [
{
"blurb": "",
"language": "und",
"text": ""
}
],
"value": "Screw M8 x 400"
}
Error Handling¶
Things do not always run smoothly. When you request the Designation, 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/limitations/drawing_file_size.html) 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