Documentation
¶
Overview ¶
Package md contains the Go wrappers for calls to Model Derivative API https://developer.autodesk.com/en/docs/model-derivative/v2/overview/
The API offers the following features:
- Translate designs into SVF format for rendering in the Forge Viewer.
- Extract design metadata and integrate it into your app. Including object hierarchy trees, model views, and object properties, - such as materials, density and volume, etc.
- Extract selected parts of a design and export the set of geometries in OBJ format.
- Create different-sized thumbnails from design files.
- Translate designs into different formats, such as STL and OBJ.
Index ¶
- Variables
- type Asset
- type Child
- type Derivative
- type DestSpec
- type FormatSpec
- type LMVManifest
- type Manifest
- type ModelDerivativeAPI
- func (a ModelDerivativeAPI) GetDerivative(urn, derivativeUrn string) (data []byte, err error)
- func (a ModelDerivativeAPI) GetManifest(urn string) (result Manifest, err error)
- func (a ModelDerivativeAPI) TranslateToSVF(objectID string) (result TranslationResult, err error)
- func (a ModelDerivativeAPI) TranslateWithParams(params TranslationParams) (result TranslationResult, err error)
- type OutputSpec
- type TranslationParams
- type TranslationResult
- type Type
- type Typeset
Constants ¶
This section is empty.
Variables ¶
var TranslationSVFPreset = TranslationParams{ Output: OutputSpec{ Destination: DestSpec{"us"}, Formats: []FormatSpec{ FormatSpec{ "svf", []string{"2d", "3d"}, }, }, }, }
TranslationSVFPreset specifies the minimum necessary for translating a generic (single file, uncompressed) model into svf.
Functions ¶
This section is empty.
Types ¶
type Child ¶
type Child struct {
GUID string `json:"guid"`
Type string `json:"type"`
Role string `json:"role"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Progress string `json:"progress,omitempty"`
Mime string `json:"mime,omitempty"`
HasThumbnail string `json:"hasThumbnail,omitempty"`
URN string `json:"urn,omitempty"`
ViewableID string `json:"viewableID,omitempty"`
PhaseNames string `json:"phaseNames,omitempty"`
Resolution []float32 `json:"resolution,omitempty"`
Children []Child `json:"children,omitempty"`
Camera []float32 `json:"camera,omitempty"`
Messages []struct {
Type string `json:"type"`
Message []string `json:"message"`
Code string `json:"code"`
} `json:"messages,omitempty"`
}
type Derivative ¶
type Derivative struct {
Name string `json:"name"`
HasThumbnail string `json:"hasThumbnail"`
Status string `json:"status"`
Progress string `json:"progress"`
Messages []struct {
Type string `json:"type"`
//Message string `json:"message"`
Code string `json:"code"`
} `json:"messages,omitempty"`
OutputType string `json:"outputType"`
Children []Child `json:"children"`
}
type DestSpec ¶
type DestSpec struct {
Region string `json:"region"`
}
DestSpec is used within OutputSpecs and is useful when specifying the region for translation results
type FormatSpec ¶
FormatSpec is used within OutputSpecs and should be used when specifying the expected format and views (2d or/and 3d)
type LMVManifest ¶
type LMVManifest struct {
Name string `json:"name"`
ToolkitVersion string `json:"toolkitversion"`
ADSKID struct {
SourceSystem string `json:"sourcesystem"`
Type string `json:"type"`
ID string `json:"id"`
Version string `json:"version"`
} `json:"adskID"`
Assets []Asset `json:"assets"`
Typesets []Typeset `json:"typesets"`
}
type ModelDerivativeAPI ¶
type ModelDerivativeAPI struct {
Authenticator oauth.ForgeAuthenticator
ModelDerivativePath string
}
API struct holds all paths necessary to access Model Derivative API
func NewMDAPI ¶ added in v0.2.0
func NewMDAPI(authenticator oauth.ForgeAuthenticator) ModelDerivativeAPI
NewMDAPI returns a Model Derivative API client with default configurations
func (ModelDerivativeAPI) GetDerivative ¶
func (a ModelDerivativeAPI) GetDerivative(urn, derivativeUrn string) (data []byte, err error)
GetDerivative downloads a selected derivative. To download the file, you need to specify the file’s URN, which you retrieve by calling the GET :urn/manifest endpoint.
func (ModelDerivativeAPI) GetManifest ¶
func (a ModelDerivativeAPI) GetManifest(urn string) (result Manifest, err error)
GetManifest returns information about derivatives that correspond to a specific source file, including derivative URNs and statuses.
func (ModelDerivativeAPI) TranslateToSVF ¶
func (a ModelDerivativeAPI) TranslateToSVF(objectID string) (result TranslationResult, err error)
TranslateToSVF is a helper function that will use the TranslationSVFPreset for translating into svf a given ObjectID. It will also take care of converting objectID into Base64 (URL Safe) encoded URN.
func (ModelDerivativeAPI) TranslateWithParams ¶
func (a ModelDerivativeAPI) TranslateWithParams(params TranslationParams) (result TranslationResult, err error)
TranslateWithParams triggers translation job with settings specified in given TranslationParams
type OutputSpec ¶
type OutputSpec struct {
Destination DestSpec `json:"destination,omitempty"`
Formats []FormatSpec `json:"formats"`
}
OutputSpec reflects data found upon creation translation job and receiving translation job status
type TranslationParams ¶
type TranslationParams struct {
Input struct {
URN string `json:"urn"`
CompressedURN *bool `json:"compressedUrn,omitempty"`
RootFileName *string `json:"rootFileName,omitempty"`
} `json:"input"`
Output OutputSpec `json:"output"`
}
TranslationParams is used when specifying the translation jobs
type TranslationResult ¶
type TranslationResult struct {
Result string `json:"result"`
URN string `json:"urn"`
AcceptedJobs struct {
Output OutputSpec `json:"output"`
}
}
TranslationResult reflects data received upon successful creation of translation job