Reference IDs¶
Drawings can contain a wide range of IDs:
- Part Number
- Project Number
- Model Number
- Index Number
- Item Number
- Article Number, and many more.
These numbers are specific to the designing company and sometimes their individual departments. We extract all these IDs and make them available as caption-value pairs. This makes them searchable for you and ensures that you can find the drawing, even if your customer uses an internal reference.
Requesting the Reference IDs¶
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 Reference Ids when we received it
"""
if message.is_successful:
print(message.payload_dict.get('reference_ids'))
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¶
"reference_ids": [
{
"blurb": "Part No. / Teilenummer: 2-3229743",
"names": [
{
"language": "eng",
"text": "Part No."
}
{
"language": "deu",
"text": "Teilenummer"
}
],
"value": "2-3229743"
},
{
"blurb": "Item No. / Artikelnummer: 5901234123457",
"names": [
{
"language": "eng",
"text": "Item No."
}
{
"language": "deu",
"text": "Artikelnummer"
}
],
"value": "5901234123457"
}
]
Error Handling¶
Things do not always run smoothly. When you request the Reference IDs, 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 toLimitations/DrawingFileFormats for details. |
DRAWING_FILE_SIZE_TOO_LARGE | ERROR | The drawing exceeded the file size limit. Refer toLimitations/DrawingFileSize for details. |
DRAWING_RESOLUTION_TOO_LOW | ERROR | The drawing has a low resolution and could not be read. Refer toLimitations/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
.