Reference Guide
TypeScript SDK Reference
Resource Information
Package Name: | @aps_sdk/model-derivative |
Version: | 1.0.0 |
Installing this Library
npm i @aps_sdk/model-derivative
Learning Resources
Source Code
The source code for this library is available at https://github.com/autodesk-platform-services/aps-sdk-node.
Tutorials
The Simple Viewer tutorial on the https://tutorials.autodesk.io/ site illustrates how to use this library to prepare a model for display in a browser.
Code Sample
import { ModelDerivativeClient, JobPayload, OutputType, View } from "@aps_sdk/model-derivative";
// Access token for authentication
const ACCESS_TOKEN = "...";
// Unique Resource Name (URN) for the model to be translated
const MODEL_URN = "...";
// Initialize the Model Derivative Client
const modelDerivativeClient = new ModelDerivativeClient();
// Define the job payload with input URN and output formats
const payload: JobPayload = {
input: {
urn: MODEL_URN, // URN of the model to be translated
compressedUrn: false // Indicates that the model is not compressed
},
output: {
formats: [{
type: OutputType.Svf2, // Output format set to SVF2
views: [View._2d, View._3d] // Include both 2D and 3D views in the output
}, {
type: OutputType.Thumbnail // Output format set to Thumbnail
}],
}
};
// Start the translation job with the specified payload and access token
const job = await modelDerivativeClient.startJob(payload, { accessToken: ACCESS_TOKEN });
// Log the job result to the console
console.log(job);
Show More
See https://github.com/autodesk-platform-services/aps-sdk-node/blob/main/samples/modelderivative.ts for a complete code sample.
SDK to REST API Cross Reference
Operation Category | Operation | Method | HTTP Request |
---|---|---|---|
Derivatives |
Fetch Derivative Download URL | getDerivativeUrl | GET /{urn}/manifest/{derivativeUrn}/signedcookies |
Check Derivative Details | headCheckDerivative | HEAD /{urn}/manifest/{derivativeUrn} | |
Informational | List Supported Formats | getFormats | GET /formats |
Jobs |
Create Translation Job | startJob | POST /job |
Specify References | specifyReferences | POST /{urn}/references | |
Manifest |
Fetch Manifest | getManifest | GET /{urn}/manifest |
Delete Manifest | deleteManifest | DELETE /{urn}/manifest | |
Metadata |
List Model Views | getModelViews | GET /{urn}/metadata |
Fetch Object Tree | getObjectTree | GET /{urn}/metadata/{modelGuid} | |
Fetch All Properties | getAllProperties | GET /{urn}/metadata/{modelGuid}/properties | |
Fetch Specific Properties | fetchSpecificProperties | POST /{urn}/metadata/{modelGuid}/properties:query | |
Thumbnails | Fetch Thumbnail | getThumbnail | GET /{urn}/thumbnail |