Reference Guide
.NET SDK Reference
Resource Information
Namespace: | Autodesk.ModelDerivativeApi |
Assembly: | Autodesk.ModelDerivativeApi.dll |
Version: | 1.0.0 |
Installing this Library
The recommended way of installing this library to your .NET project is to use the NuGet Package Manager.
- Within the NuGet Package Manager locate the Autodesk.ModelDerivative library.
- Follow the instructions on the NuGet documentation site to install the library.
Alternatively, from Visual Studio IDE or CLI tools:
dotnet add package Autodesk.ModelDerivative
Learning Resources
Source Code
The source code for this library is available at https://github.com/autodesk-platform-services/aps-sdk-net.
Tutorials
The Simple Viewer tutorial illustrates how to use this library to prepare a model for display in a browser.
Code Sample
class ModelDerivative
{
string? token = Environment.GetEnvironmentVariable("token");
string? urn = Environment.GetEnvironmentVariable("urn");
ModelDerivativeClient modelDerivativeClient = null!;
public void Initialise()
{
// Instantiate SDK manager as below.
// You can also optionally pass configurations, logger, etc.
SDKManager sdkManager = SdkManagerBuilder
.Create() // Creates SDK Manager Builder itself.
.Build();
// Instantiate ModelDerivativeClient using the created SDK manager
modelDerivativeClient = new ModelDerivativeClient(sdkManager);
}
#region Jobs
// Post Job
public async Task StartJobAsync()
{
// set output formats
List<IJobPayloadFormat> payloadFormats = new List<IJobPayloadFormat>()
{
// initialising an Svf2 output class will automatically set the type to Svf2.
new JobPayloadFormatSVF2()
{
Views = new List<View>()
{
View._2d,
View._3d
},
Advanced = new JobPayloadFormatSVF2AdvancedRVT()
{
GenerateMasterViews = true
}
},
// initialising a Thumbnail output class will automatically set the type to Thumbnail.
new JobPayloadFormatThumbnail()
{
Advanced = new JobPayloadFormatAdvancedThumbnail()
{
Width = Width.NUMBER_100, // enum changed to only 100
Height = Height.NUMBER_100
}
}
};
// specify Job details
JobPayload Job = new JobPayload()
{
Input = new JobPayloadInput()
{
Urn = urn,
CompressedUrn = false,
RootFilename = "<fileName>",
},
Output = new JobPayloadOutput()
{
Formats = payloadFormats,
// Destination is obsolete. Use the region header instead.
// Destination = new JobPayloadOutputDestination() { Region = Region.US } // This will call the respective endpoint - Either US or EMEA. Defaults to US.
},
};
// start the translation job
try
{
Job jobResponse = await modelDerivativeClient.StartJobAsync(jobPayload: Job, accessToken: token, region: Region.US);
// query for urn, result etc...
string jobUrn = jobResponse.Urn;
string jobResult = jobResponse.Result;
}
catch (ModelDerivativeApiException ex)
{
Console.WriteLine(ex.Message);
}
}
}
Show More
SDK to REST API Cross Reference
Operation Category | Operation | Method | HTTP Request |
---|---|---|---|
Derivatives |
Fetch Derivative Download URL | GetDerivativeUrlAsync | GET /{urn}/manifest/{derivativeUrn}/signedcookies |
Check Derivative Details | HeadCheckDerivativeAsync | HEAD /{urn}/manifest/{derivativeUrn} | |
Informational | List Supported Formats | GetFormatsAsync | GET /formats |
Jobs |
Start a Translation Job | StartJobAsync | POST /job |
Specify References | SpecifyReferencesAsync | POST /{urn}/references | |
Manifest |
Fetch Manifest | GetManifestAsync | GET /{urn}/manifest |
Delete Manifest | DeleteManifestAsync | DELETE /{urn}/manifest | |
Metadata |
List Model Views | GetModelViewsAsync | GET /{urn}/metadata |
Fetch Object Tree | GetObjectTreeAsync | GET /{urn}/metadata/{modelGuid} | |
Fetch All Properties | GetAllPropertiesAsync | GET /{urn}/metadata/{modelGuid}/properties | |
Fetch Specific Properties | FetchSpecificPropertiesAsync | POST /{urn}/metadata/{modelGuid}/properties:query | |
Thumbnails | Fetch Thumbnail | GetThumbnailAsync | GET /{urn}/thumbnail |