Reference downloading
Design Automation is able to follow and download references embedded in design files. Client applications can trigger this function by using the refget
verb instead of get
in an argument inside a workitem.
The refget
verb also causes the downloading of support files that are configured using AutoCAD Web.
Consider the following workitem payload:
{
"activityId": "AutoCAD.PlotToPDF+prod",
"arguments": {
"HostDwg": {
"url": "https://developer.api.autodesk.com/data/v1/projects/b.25b50afe-1892-46b0-8ae6-be035605fd51/items/urn:adsk.wipprod:dm.lineage:CC-mn_2VQYunOdGi1cVdlQ",
"verb": "refget",
"headers" : {
"Authorization": "Bearer <A TOKEN>"
}
},
"Result": {
"url": "urn:adsk.objects:os.object:<YOUR_BUCKET_KEY>/<OBJECT_KEY>",
"verb": "put",
"headers": {
"Authorization": "Bearer <A TOKEN>"
}
}
}
}
Note the refget
verb and Data Management API URL for the “HostDwg” argument. After processing the workitem Design Automation shows the following in the workitem report (elided for clarity):
...
[03/09/2024 20:21:08] Start downloading input: verb - 'RefGet', url - 'https://developer.api.autodesk.com/data/v1/projects/b.25b50afe-1892-46b0-8ae6-be035605fd51/items/urn:adsk.wipprod:dm.lineage:CC-mn_2VQYunOdGi1cVdlQ'
[03/09/2024 20:21:11] RefGet report:
{
"Roots": [
{
"OriginalReference": "https://developer.api.autodesk.com/data/v1/projects/b.25b50afe-1892-46b0-8ae6-be035605fd51/items/urn:adsk.wipprod:dm.lineage:CC-mn_2VQYunOdGi1cVdlQ",
"LocalPath": "T:\\Aces\\Jobs\\eb8048d00d664259b036666c8d0713ee\\adskFiles/b.25b50afe-1892-46b0-8ae6-be035605fd51/Project Files/Project1/XrefTest/a.dwg",
"Nested": [
{
"OriginalReference": ".\\a.jpg",
"LocalPath": "T:\\Aces\\Jobs\\eb8048d00d664259b036666c8d0713ee\\adskFiles/b.25b50afe-1892-46b0-8ae6-be035605fd51/Project Files/Project1/XrefTest/a.jpg",
},
{
"OriginalReference": ".\\b.dwg",
"LocalPath": "T:\\Aces\\Jobs\\eb8048d00d664259b036666c8d0713ee\\adskFiles/b.25b50afe-1892-46b0-8ae6-be035605fd51/Project Files/Project1/XrefTest/b.dwg",
},
]
}
]
}
[03/09/2024 20:21:11] End downloading file. Source=https://developer.api.autodesk.com/data/v1/projects/b.25b50afe-1892-46b0-8ae6-be035605fd51/items/urn:adsk.wipprod:dm.lineage:CC-mn_2VQYunOdGi1cVdlQ,LocalFile=T:\Aces\Jobs\eb8048d00d664259b036666c8d0713ee\adskFiles/b.25b50afe-1892-46b0-8ae6-be035605fd51/Project Files/Project1/XrefTest/a.dwg,BytesDownloaded=305234,Duration=3384ms
[03/09/2024 20:21:11] End download phase successfully.
...
You can see that the URL points to a dwg file called “a.dwg” that references “a.jpg” and “b.dwg” and both of these are successfully downloaded.
NOTE: All files are downloaded to a folder called “adskFiles”. Avoid using this name for other purposes since this may lead to unexpected failure.
Limitations
The refget
verb currently only works for DWG/DXF/DST files when using the AutoCAD
engine. The files must be accessible via the Data Management API . Other file types (e.g. .rvt) and storage types (e.g. OneDrive) may be supported in the future.
Note that refget
requires a filesystem-like data source that allows navigation and thus the resolution of relative paths. Therefore blob storage services like Amazon AWS S3 or Azure Blob Storage cannot be supported.