Skip to main content
Version: 14

viktor.external.autodesk

AutodeskFile

class viktor.external.autodesk.AutodeskFile(url)

New in v14.25.0

Represents a file stored on Autodesk cloud storage (https://aps.autodesk.com/)

Example:

import viktor as vkt

# Set up OAuth2 integration to get access token
integration = vkt.external.OAuth2Integration("autodesk-integration")
token = integration.get_access_token()

# Get the AutodeskFile from a parametrization field
autodesk_file = params.autodesk_file  # value of AutodeskFileField

# Get the AEC Data Model element group ID (requires API call)
element_group_id = autodesk_file.get_aec_data_model_element_group_id(token)
print(f"The element group id is: {element_group_id}")

# Access file properties and metadata:
project_id = autodesk_file.project_id        # Can be extracted from URL
urn = autodesk_file.urn                      # Get the unique resource name
hub_id = autodesk_file.get_hub_id(token)     # Requires API call
region = autodesk_file.get_region(token)     # Requires API call
get_aec_data_model_element_group_id(access_token)

New in v14.26.0

Get the AEC Data Model ElementGroup ID associated with this file.

Return type:

str

get_hub_id(access_token)

New in v14.26.0

Get the id of the hub this file belongs to.

Return type:

str

get_latest_version(access_token)

Get the latest version of the file on Autodesk cloud storage.

Parameters:

access_token (str) – Autodesk Platform Services token to access the file.

Return type:

AutodeskFileVersion

get_region(access_token)

New in v14.26.0

Get the region of the hub this file belongs to.

Return type:

str

property project_id: str

New in v14.26.0

Get the id of the project this file belongs to.

property url: str

URL of the file on Autodesk cloud storage.

property urn: str

New in v14.26.0

Get the unique resource name (also called “id”) of this file on Autodesk cloud storage.

AutodeskFileVersion

class viktor.external.autodesk.AutodeskFileVersion(_access_token, _data)

New in v14.25.0

Warning

Do not instantiate this class directly, it is created from AutodeskFile.

property attributes: dict

Get the attributes of this version of the file on Autodesk cloud storage.

get_file()

Download the content of this version of the file from Autodesk cloud storage.

Return type:

File

property storage_url: str | None

New in v14.26.0

Get the storage URL of this version of the file.

property urn: str

Get the unique resource name (also called “id”) of this version of the file on Autodesk cloud storage.