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 ¶
- Constants
- Variables
- type ChildrenSpec
- type DerivativeSpec
- type DestSpec
- type FormatSpec
- type ManifestResult
- type MetadataResult
- type MetadataSpec
- type ModelDerivativeAPI
- func (api ModelDerivativeAPI) GetManifest(urn string) (result ManifestResult, err error)
- func (api ModelDerivativeAPI) GetMetadata(urn string) (result MetadataResult, err error)
- func (api ModelDerivativeAPI) GetObjectTree(urn string, viewID string) (status int, result TreeResult, err error)
- func (api ModelDerivativeAPI) GetPropertiesObject(urn string, viewID string) (result PropertiesResult, err error)
- func (api ModelDerivativeAPI) GetPropertiesStream(urn string, viewID string) (status int, result io.ReadCloser, err error)
- func (api ModelDerivativeAPI) GetThumbnail(urn string) (reader io.ReadCloser, err error)
- func (api ModelDerivativeAPI) TranslateToSVF(objectID string) (result TranslationResult, err error)
- func (api ModelDerivativeAPI) TranslateWithParams(params TranslationParams) (result TranslationResult, err error)
- type ObjectSpec
- type OutputSpec
- type PropertiesResult
- type PropertiesSpec
- type TranslationInput
- type TranslationParams
- type TranslationResult
- type TreeNodeSpec
- type TreeResult
- type TreeSpec
- type ViewSpec
Constants ¶
const (
DefaultModelDerivativePath = "/modelderivative/v2/designdata"
)
Variables ¶
var ( // TranslationSVFPreset specifies the minimum necessary for translating a generic (single file, uncompressed) // model into svf. TranslationSVFPreset = TranslationParams{ Output: OutputSpec{ Destination: DestSpec{"us"}, Formats: []FormatSpec{ FormatSpec{ "svf", []string{"2d", "3d"}, }, }, }, } )
Functions ¶
This section is empty.
Types ¶
type ChildrenSpec ¶
type DerivativeSpec ¶
type DestSpec ¶
type DestSpec struct {
Region string `json:"region,omitempty"`
}
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 ManifestResult ¶
type ManifestResult struct { Type string `json:"type,omitempty"` HasThumbnail bool `json:"hasThumbnail,string,omitempty"` Status string `json:"status,omitempty"` Progress string `json:"progress,omitempty"` Region string `json:"region,omitempty"` URN string `json:"urn,omitempty"` Derivatives []DerivativeSpec `json:"derivatives,omitempty"` }
type MetadataResult ¶
type MetadataResult struct {
Data MetadataSpec `json:"data",omitempty`
}
type MetadataSpec ¶
type ModelDerivativeAPI ¶
API struct holds all paths necessary to access Model Derivative API
func NewAPIWithCredentials ¶
func NewAPIWithCredentials(ClientID string, ClientSecret string) ModelDerivativeAPI
NewAPIWithCredentials returns a Model Derivative API client with default configurations
func (ModelDerivativeAPI) GetManifest ¶
func (api ModelDerivativeAPI) GetManifest(urn string) (result ManifestResult, err error)
func (ModelDerivativeAPI) GetMetadata ¶
func (api ModelDerivativeAPI) GetMetadata(urn string) (result MetadataResult, err error)
func (ModelDerivativeAPI) GetObjectTree ¶
func (api ModelDerivativeAPI) GetObjectTree(urn string, viewID string) (status int, result TreeResult, err error)
func (ModelDerivativeAPI) GetPropertiesObject ¶
func (api ModelDerivativeAPI) GetPropertiesObject(urn string, viewID string) (result PropertiesResult, err error)
func (ModelDerivativeAPI) GetPropertiesStream ¶
func (api ModelDerivativeAPI) GetPropertiesStream(urn string, viewID string) (status int, result io.ReadCloser, err error)
func (ModelDerivativeAPI) GetThumbnail ¶
func (api ModelDerivativeAPI) GetThumbnail(urn string) (reader io.ReadCloser, err error)
func (ModelDerivativeAPI) TranslateToSVF ¶
func (api 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 (api ModelDerivativeAPI) TranslateWithParams(params TranslationParams) (result TranslationResult, err error)
TranslateWithParams triggers translation job with settings specified in given TranslationParams
type ObjectSpec ¶
type ObjectSpec struct { ObjectID int64 `json:"objectid"` Name string `json:"name"` ExternalID string `json:"externalId"` Properties json.RawMessage }
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 PropertiesResult ¶
type PropertiesResult struct { Data PropertiesSpec `json:"data",omitempty` Result string `json:"result",omitempty` }
type PropertiesSpec ¶
type PropertiesSpec struct { Type string `json:"type"` Collection []ObjectSpec `json:"collection"` }
type TranslationInput ¶
type TranslationParams ¶
type TranslationParams struct { Input TranslationInput `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
type TreeNodeSpec ¶
type TreeNodeSpec struct { ObjectID int64 `json:"objectid",omitempty` Name string `json:"name",omitempty` Objects []TreeNodeSpec `json:"objects",omitempty` }
type TreeResult ¶
type TreeResult struct {
Data TreeSpec `json:"data",omitempty`
}
type TreeSpec ¶
type TreeSpec struct { Type string `json:"type",omitempty` Objects []TreeNodeSpec `json:"objects",omitempty` }