Title: | An Interface to the 'AutoDesk' 'API' Platform |
---|---|
Description: | An interface to the 'AutoDesk' 'API' Platform including the Authentication 'API' for obtaining authentication to the 'AutoDesk' Forge Platform, Data Management 'API' for managing data across the platform's cloud services, Design Automation 'API' for performing automated tasks on design files in the cloud, Model Derivative 'API' for translating design files into different formats, sending them to the viewer app, and extracting design data, and Viewer for rendering 2D and 3D models. |
Authors: | Paul Govan [aut, cre, cph] |
Maintainer: | Paul Govan <[email protected]> |
License: | Apache License | file LICENSE |
Version: | 0.1.5 |
Built: | 2024-11-10 06:01:10 UTC |
Source: | https://github.com/paulgovan/autodeskr |
Check the status of a recently created app-managed bucket using the Data Management API.
checkBucket(token = NULL, bucket = "mybucket")
checkBucket(token = NULL, bucket = "mybucket")
token |
A string. Token generated with |
bucket |
A string. Name of the bucket. Defaults to |
An object containing the bucketKey
, bucketOwner
, and
createdDate
.
## Not run: # Check the status of a bucket with the name "mybucket" resp <- checkBucket(token = myToken, bucket = "mybucket") resp ## End(Not run)
## Not run: # Check the status of a bucket with the name "mybucket" resp <- checkBucket(token = myToken, bucket = "mybucket") resp ## End(Not run)
Check the status of a recently translated file using the Model Derivative API.
checkFile(urn = NULL, token = NULL)
checkFile(urn = NULL, token = NULL)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
## Not run: # Check the status of the translated "aerial.dwg" svf file resp <- checkFile(urn = myEncodedUrn, token = myToken) resp ## End(Not run)
## Not run: # Check the status of the translated "aerial.dwg" svf file resp <- checkFile(urn = myEncodedUrn, token = myToken) resp ## End(Not run)
Check the status of a recently created PDF file using the Design Automation API.
checkPdf(source = NULL, destination = NULL, token = NULL)
checkPdf(source = NULL, destination = NULL, token = NULL)
source |
A string. Publicly accessible web address of the input dwg file. |
destination |
A string. Publicly accessible web address for the output pdf file. |
token |
A string. Token generated with |
## Not run: mySource <- "http://download.autodesk.com/us/samplefiles/acad/visualization_-_aerial.dwg" myDestination <- "https://drive.google.com/folderview?id=0BygncDVHf60mTDZVNDltLThLNmM&usp=sharing" resp <- checkPdf(mySource, myDestination, token = myToken) resp ## End(Not run)
## Not run: mySource <- "http://download.autodesk.com/us/samplefiles/acad/visualization_-_aerial.dwg" myDestination <- "https://drive.google.com/folderview?id=0BygncDVHf60mTDZVNDltLThLNmM&usp=sharing" resp <- checkPdf(mySource, myDestination, token = myToken) resp ## End(Not run)
Download a file from the Forge Platform using the Model Derivative API.
downloadFile(urn = NULL, output_urn = NULL, token = NULL)
downloadFile(urn = NULL, output_urn = NULL, token = NULL)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
output_urn |
A string. Output_urn retrieved via
|
token |
A string. Token generated with |
An object containing the result
, urn
, and additional
activity information.
## Not run: # Download the "aerial.dwg" png file myEncodedOutputUrn <- jsonlite::base64_enc(myOutputUrn) resp <- downloadFile(urn <- myEncodedUrn, output_urn <- myEncodedOutputUrn, token = myToken) ## End(Not run)
## Not run: # Download the "aerial.dwg" png file myEncodedOutputUrn <- jsonlite::base64_enc(myOutputUrn) resp <- downloadFile(urn <- myEncodedUrn, output_urn <- myEncodedOutputUrn, token = myToken) ## End(Not run)
Get the geometry of an uploaded file using the Model Derivative API.
getData(guid = NULL, urn = NULL, token = NULL)
getData(guid = NULL, urn = NULL, token = NULL)
guid |
A string. GUID retrieved via the |
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the geometry data for the selected file.
## Not run: # Get the geometry data for the "aerial.dwg" svf file resp <- getData(guid <- myGuid, urn <- myEncodedUrn, token = myToken) ## End(Not run)
## Not run: # Get the geometry data for the "aerial.dwg" svf file resp <- getData(guid <- myGuid, urn <- myEncodedUrn, token = myToken) ## End(Not run)
Get the metadata of an uploaded file using the Model Derivative API.
getMetadata(urn = NULL, token = NULL)
getMetadata(urn = NULL, token = NULL)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the type
, name
, and guid
of
the file.
## Not run: # Get the metadata for the "aerial.dwg" svf file resp <- getMetadata(urn <- myEncodedUrn, token = myToken) myGuid <- resp$content$data$metadata[[1]]$guid ## End(Not run)
## Not run: # Get the metadata for the "aerial.dwg" svf file resp <- getMetadata(urn <- myEncodedUrn, token = myToken) myGuid <- resp$content$data$metadata[[1]]$guid ## End(Not run)
Get the object tree of an uploaded file using the Model Derivative API.
getObjectTree(guid = NULL, urn = NULL, token = NULL)
getObjectTree(guid = NULL, urn = NULL, token = NULL)
guid |
A string. GUID retrieved via the |
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the object tree for the selected file. the file.
## Not run: # Get the object tree for the "aerial.dwg" svf file resp <- getObjectTree(guid <- myGuid, urn <- myEncodedUrn, token = myToken) resp ## End(Not run)
## Not run: # Get the object tree for the "aerial.dwg" svf file resp <- getObjectTree(guid <- myGuid, urn <- myEncodedUrn, token = myToken) resp ## End(Not run)
Get the output urn of a translated file using the Model Derivative API.
getOutputUrn(urn, token)
getOutputUrn(urn, token)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the result
, urn
, and additional
activity information.
## Not run: # Get the output urn for the "aerial.dwg" obj file resp <- getOutputUrn(urn <- myUrn, token = Sys.getenv("token")) resp ## End(Not run)
## Not run: # Get the output urn for the "aerial.dwg" obj file resp <- getOutputUrn(urn <- myUrn, token = Sys.getenv("token")) resp ## End(Not run)
Get a 2-legged token for OAuth-based authentication to the AutoDesk Forge Platform.
getToken(id = NULL, secret = NULL, scope = "data:write data:read")
getToken(id = NULL, secret = NULL, scope = "data:write data:read")
id |
A string. Client ID for the app generated from the AutoDesk Dev Portal. |
secret |
A string. Client Secret for the app generated from the AutoDesk Dev Portal. |
scope |
A string. Space-separated list of required scopes. May be
|
An object containing the access_token
, code_type
, and
expires_in
milliseconds.
## Not run: # Get a 2-legged token with the "data:read" and "data:write" scopes resp <- getToken(id = Sys.getenv("client_id"), secret = Sys.getenv("client_secret"), scope = "data:write data:read") myToken <- resp$content$access_token ## End(Not run)
## Not run: # Get a 2-legged token with the "data:read" and "data:write" scopes resp <- getToken(id = Sys.getenv("client_id"), secret = Sys.getenv("client_secret"), scope = "data:write data:read") myToken <- resp$content$access_token ## End(Not run)
Make an app-based bucket for storage of design files using the Data Management API.
makeBucket(token = NULL, bucket = "mybucket", policy = "transient")
makeBucket(token = NULL, bucket = "mybucket", policy = "transient")
token |
A string. Token generated with |
bucket |
A string. Unique bucket name. Defaults to |
policy |
A string. May be |
An object containing the bucketKey
, bucketOwner
, and
createdDate
.
## Not run: # Make a transient bucket with the name "mybucket" resp <- makeBucket(token = myToken, bucket = "mybucket", policy = "transient") ## End(Not run)
## Not run: # Make a transient bucket with the name "mybucket" resp <- makeBucket(token = myToken, bucket = "mybucket", policy = "transient") ## End(Not run)
Convert a publicly accessible DWG file to a publicly accessible PDF using the Design Automation API.
makePdf(source = NULL, destination = NULL, token = NULL)
makePdf(source = NULL, destination = NULL, token = NULL)
source |
A string. Publicly accessible web address of the input dwg file. |
destination |
A string. Publicly accessible web address for the output pdf file. |
token |
A string. Token generated with |
## Not run: mySource <- "http://download.autodesk.com/us/samplefiles/acad/visualization_-_aerial.dwg" myDestination <- "https://drive.google.com/folderview?id=0BygncDVHf60mTDZVNDltLThLNmM&usp=sharing" resp <- makePdf(mySource, myDestination, token = myToken) ## End(Not run)
## Not run: mySource <- "http://download.autodesk.com/us/samplefiles/acad/visualization_-_aerial.dwg" myDestination <- "https://drive.google.com/folderview?id=0BygncDVHf60mTDZVNDltLThLNmM&usp=sharing" resp <- makePdf(mySource, myDestination, token = myToken) ## End(Not run)
Translate an uploaded file into OBJ format using the Model Derivative API.
translateObj(urn = NULL, token = NULL)
translateObj(urn = NULL, token = NULL)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the result
, urn
, and additional
activity information.
## Not run: # Translate the "aerial.dwg" file into a obj file resp <- translateObj(urn <- myEncodedUrn, token = myToken) ## End(Not run)
## Not run: # Translate the "aerial.dwg" file into a obj file resp <- translateObj(urn <- myEncodedUrn, token = myToken) ## End(Not run)
Translate an uploaded file into SVF format using the Model Derivative API.
translateSvf(urn = NULL, token = NULL)
translateSvf(urn = NULL, token = NULL)
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
An object containing the result
, urn
, and additional
activity information.
## Not run: # Translate the "aerial.dwg" file into a svf file myEncodedUrn <- jsonlite::base64_enc(myUrn) resp <- translateSvf(urn = myEncodedUrn, token = myToken) ## End(Not run)
## Not run: # Translate the "aerial.dwg" file into a svf file myEncodedUrn <- jsonlite::base64_enc(myUrn) resp <- translateSvf(urn = myEncodedUrn, token = myToken) ## End(Not run)
Upload a design file to an app-managed bucket using the Data Management API.
uploadFile(file = NULL, token = NULL, bucket = "mybucket")
uploadFile(file = NULL, token = NULL, bucket = "mybucket")
file |
A string. File path. |
token |
A string. Token generated with |
bucket |
A string. Unique bucket name. Defaults to |
An object containing the bucketKey
, objectId
(i.e.
urn), objectKey
(i.e. file name), size
, contentType
(i.e. "application/octet-stream"), location
. and other content
information.
## Not run: # Upload the "aerial.dwg" file to "mybucket" resp <- uploadFile(file = system.file("inst/samples/aerial.dwg", package = "AutoDeskR"), token = myToken, bucket = "mybucket") myUrn <- resp$content$objectId ## End(Not run)
## Not run: # Upload the "aerial.dwg" file to "mybucket" resp <- uploadFile(file = system.file("inst/samples/aerial.dwg", package = "AutoDeskR"), token = myToken, bucket = "mybucket") myUrn <- resp$content$objectId ## End(Not run)
Launch the Viewer.
viewer3D(urn = NULL, token = NULL, viewerType = "header")
viewer3D(urn = NULL, token = NULL, viewerType = "header")
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
viewerType |
A string. The type of viewer to instantiate. Either "header" for the default viewer, "headless" for a viewer without toolbar or panels, or "vr" to enter WebVR mode on a mobile device. |
## Not run: # View the "aerial.dwg" file in the AutoDesk viewer myEncodedUrn <- jsonlite::base64_enc(myUrn) viewer3D(urn <- myEncodedUrn, token = myToken) ## End(Not run)
## Not run: # View the "aerial.dwg" file in the AutoDesk viewer myEncodedUrn <- jsonlite::base64_enc(myUrn) viewer3D(urn <- myEncodedUrn, token = myToken) ## End(Not run)
UI Module Function.
viewerUI(id, urn = NULL, token = NULL, viewerType = "header")
viewerUI(id, urn = NULL, token = NULL, viewerType = "header")
id |
A string. A namespace for the module. |
urn |
A string. Source URN (objectId) for the file. Note the URN must be
Base64 encoded. To encode the URN, see, for example, the
|
token |
A string. Token generated with |
viewerType |
A string. The type of viewer to instantiate. Either "header" for the default viewer or "headless" for a viewer without toolbar or panels. |
## Not run: ui <- function(request) { shiny::fluidPage( viewerUI("pg", myEncodedUrn, myToken) ) } server <- function(input, output, session) { } shiny::shinyApp(ui, server) ## End(Not run)
## Not run: ui <- function(request) { shiny::fluidPage( viewerUI("pg", myEncodedUrn, myToken) ) } server <- function(input, output, session) { } shiny::shinyApp(ui, server) ## End(Not run)