md

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 9 Imported by: 0

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

This section is empty.

Variables

View Source
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 Asset

type Asset struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	URI   string `json:"URI"`
	Size  uint64 `json:"size"`
	USize uint64 `json:"usize"`
}

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"`
	Resolution   []float32 `json:"resolution,omitempty"`
	Children     []Child   `json:"children,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

type FormatSpec struct {
	Type  string   `json:"type"`
	Views []string `json:"views"`
}

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 Manifest

type Manifest struct {
	Type         string       `json:"type"`
	HasThumbnail string       `json:"hasThumbnail"`
	Status       string       `json:"status"`
	Progress     string       `json:"progress"`
	Region       string       `json:"region"`
	URN          string       `json:"urn"`
	Derivatives  []Derivative `json:"derivatives"`
}

type ModelDerivativeAPI

type ModelDerivativeAPI struct {
	oauth.TwoLeggedAuth
	ModelDerivativePath string
}

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) 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

type Type

type Type struct {
	Class   string `json:"class"`
	Type    string `json:"type"`
	Version uint   `json:"version"`
}

type Typeset

type Typeset struct {
	ID    string `json:"id"`
	Types []Type `json:"types"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL