md

package
v0.0.0-...-e20fb56 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 11 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 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 ChildrenSpec struct {
	GUID     string         `json:"guid,omitempty"`
	Role     string         `json:"role,omitempty"`
	MIME     string         `json:"mime,omitempty"`
	Name     string         `json:"name,omitempty"`
	URN      string         `json:"urn,omitempty"`
	Progress string         `json:"progress,omitempty"`
	Status   string         `json:"status,omitempty"`
	Type     string         `json:"type,omitempty"`
	Children []ChildrenSpec `json:"children,omitempty"`
}

type DerivativeSpec

type DerivativeSpec struct {
	Name         string         `json:"name,omitempty"`
	HasThumbnail bool           `json:"hasThumbnail,string,omitempty"`
	Role         string         `json:"role,omitempty"`
	Status       string         `json:"status,omitempty"`
	Progress     string         `json:"progress,omitempty"`
	Children     []ChildrenSpec `json:"children,omitempty"`
}

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 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 MetadataSpec struct {
	Type     string     `json:"type",omitempty`
	Metadata []ViewSpec `json:"metadata",omitempty`
}

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 string, derivativeUrn string) (reader io.ReadCloser, err error)

func (ModelDerivativeAPI) GetManifest

func (a ModelDerivativeAPI) GetManifest(urn string) (result ManifestResult, err error)

func (ModelDerivativeAPI) GetMetadata

func (a ModelDerivativeAPI) GetMetadata(urn string) (result MetadataResult, err error)

func (ModelDerivativeAPI) GetPropertiesObject

func (a ModelDerivativeAPI) GetPropertiesObject(urn string, viewId string) (result PropertiesResult, err error)

func (ModelDerivativeAPI) GetPropertiesStream

func (a ModelDerivativeAPI) GetPropertiesStream(urn string, viewId string) (status int,
	result io.ReadCloser, err error)

func (ModelDerivativeAPI) GetThumbnail

func (a ModelDerivativeAPI) GetThumbnail(urn string) (reader io.ReadCloser, err error)

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

type ViewSpec struct {
	Name string `json:"name",omitempty`
	Role string `json:"role",omitempty`
	Guid string `json:"guid",omitempty`
}

Jump to

Keyboard shortcuts

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