Filename Drawing¶
For migrations it can sometimes be helpful to know the filename that a drawing indicates in the title block. Note that this is not equivalent to the filename that a file has when you upload it, but rather it extracts this information from the Title Block. If the title block does not contain the information, it will be None
.
Attributes¶
Even though the filename is a simple string, it contains a lot of useful information that is returned through the API.
Blurb¶
Simple string representation that follows the exact information that was found on the title block.
Filename¶
Filename without the "path prefix". This is relevant if you are looking just for a specific filename, but are not concerned about the absolute location of the file.
Extension¶
The extension give you additional information about the file type. WERK24 is returning the full suffix of the filename. The extension for double-extension files will be included. The filename archive.tar.gz
will have the extension .tar.gz
Extension Types¶
For many commonly used extensions in the CAD-world, we are able to determine from the extension whether the file is a Drawing of a Model. This information is available in the field extension_type
Path Type¶
The use of forward or backward slashes give an indication on the operating system that is being used. Windows is indicated as WINDOWS
, Linux/Unix is indicated as POSIX
. When the operating system cannot be determined, we return UNKNOWN
.
Requesting the Filename of the Drawing¶
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_filename_drawing(message: W24TechreadMessage) -> None:
""" Print the Filename of the Drawing
"""
if message.is_successful:
print(message.payload_dict.get('filename_drawing'))
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_filename_drawing)]
# submit the request to the Werk24 API
w24_read_sync(drawing_bytes, hooks)
Example Response¶
"filename_drawing": {
"blurb": "F:\\drawings\\A003.pdf",
"filename": "A003.pdf",
"extension": ".pdf",
"extension_type": "DRAWING",
"path_type": "WINDOWS",
}
Model¶
Refer to W24CaptionValuePair