Documentation

Support

Asset Transformer SDK


User Manual

Python API

C# API

Changelog

Discussions

Asset Transformer SDK

View

Python API functions
Read time 28 minutesLast updated 19 hours ago

configureFunctionLogger

view.configureFunctionLogger(functionName, enableFunction, enableParameters, enableExecutionTime)
Parameters

Type

Name

Description

StringfunctionName
BooleanenableFunction
BooleanenableParameters
BooleanenableExecutionTime

destroyContext

Destroy the Vulkan instance. All existing viewers and gpuScenes will also be destroyed and all view module properties will be reset.
view.destroyContext()

suitableGPUAvailable

Returns true if a suitable device is found.
view.suitableGPUAvailable() -> core.Bool
Returns

Type

Name

Description

BoolfoundTrue if a suitable device was found.

Animation Player

applyPlayingAnimations

Apply the animations.
view.applyPlayingAnimations(time)
Parameters

Type

Name

Description

AnimationTimetimeCurrent time.
See also:

getAnimationPlayerInfo

Packs all AnimationPlayer-related info about an animation in an object.
view.getAnimationPlayerInfo(animation) -> view.AnimationPlayerInfo
Parameters

Type

Name

Description

AnimationanimationAnimation to get info of.
Returns

Type

Name

Description

AnimationPlayerInfoanimationPlayerInfo
See also:

isAnimationPlaying

Is this animation playing?.
view.isAnimationPlaying(animation) -> core.Bool
Parameters

Type

Name

Description

AnimationanimationAnimation to check.
Returns

Type

Name

Description

BoolplayingValue
See also:

pauseAllAnimation

Pauses all animations.
view.pauseAllAnimation()
See also:

pauseAnimation

Pauses an animation.
view.pauseAnimation(animation)
Parameters

Type

Name

Description

AnimationanimationAnimation to pause.
See also:

playAnimation

Plays an animation.
view.playAnimation(animation, speed=1, loop=False)
Parameters

Type

Name

Description

AnimationanimationAnimation to play.
DoublespeedSpeed.
BooleanloopShould the animation loop?.
See also:

resumeAllAnimation

Resumes all animations.
view.resumeAllAnimation()
See also:

resumeAnimation

Resumes an animation.
view.resumeAnimation(animation)
Parameters

Type

Name

Description

AnimationanimationAnimation to resume.
See also:

setAnimationFrame

Set animation's current frame.
view.setAnimationFrame(animation, frame)
Parameters

Type

Name

Description

AnimationanimationAnimation to set frame.
AnimationTimeframeFrame to set.
See also:

setAnimationLoop

Set animation's looping status.
view.setAnimationLoop(animation, loop)
Parameters

Type

Name

Description

AnimationanimationAnimation to set loop status.
BooleanloopShould the animation loop?.
See also:

setAnimationSpeed

Set animation's playing speed.
view.setAnimationSpeed(animation, speed)
Parameters

Type

Name

Description

AnimationanimationAnimation to set speed.
DoublespeedThe speed.
See also:

stopAllAnimation

Stops all animations.
view.stopAllAnimation(applyDefault=True)
Parameters

Type

Name

Description

BoolapplyDefaultShould the default position be applied.
See also:

stopAnimation

Stops an animation.
view.stopAnimation(animation, applyDefault=True)
Parameters

Type

Name

Description

AnimationanimationAnimation to stop.
BoolapplyDefaultShould the default position be applied.
See also:

D3D11 interop

getD3D11Texture

view.getD3D11Texture(renderMap, viewer=-1) -> view.D3D11Texture
Parameters

Type

Name

Description

RenderMaprenderMap
Viewerviewer
Returns

Type

Name

Description

D3D11Texturehandle

OpenGL interop

getGLTextureHandle

view.getGLTextureHandle(renderMap, viewer=-1) -> view.GLTextureHandle
Parameters

Type

Name

Description

RenderMaprenderMap
Viewerviewer
Returns

Type

Name

Description

GLTextureHandlehandle

Vulkan interop

getVulkanTexture

view.getVulkanTexture(renderMap, viewer=-1) -> view.VulkanTexture
Parameters

Type

Name

Description

RenderMaprenderMap
Viewerviewer
Returns

Type

Name

Description

VulkanTexturehandle

gpu scene

createGPUScene

view.createGPUScene(roots, constructEdges=False, useIsolate=True) -> view.GPUScene
Parameters

Type

Name

Description

OccurrenceListrootsRoots of the subtrees that will be uploaded to GPU.
BoolconstructEdgesConstruct buffer to render edges colored by topology (slower to construct).
BooluseIsolateIndicates if the isolate manager should be used for visibility.
Returns

Type

Name

Description

GPUScenesceneIdentifier of the newly created GPU Scene.
See also:

destroyGPUScene

view.destroyGPUScene(scene)
Parameters

Type

Name

Description

GPUScenesceneGPU Scene to destroy (previously created by createGPUScene).
See also:

getGlobalGPUScene

Returns (and create if it does not exist) a global GPU scene (with the scene root) to be used commonly by several clients.
view.getGlobalGPUScene() -> view.GPUScene
Returns

Type

Name

Description

GPUScenesceneIdentifier of the global GPU Scene.
See also:

getLastAABB

Return the lastAABB computed during a frame drawing, requires the viewer property ComputeLastAABB to be True.
view.getLastAABB(scene, viewer) -> geom.AABB
Parameters

Type

Name

Description

GPUScenesceneIdentifier of the GPU scene to get the last AABB from.
Viewerviewer
Returns

Type

Name

Description

AABBaabbThe last scene AABB computed during the last frame.
See also:

getOccurrenceIndex

Returns the occurrence index in the viewer buffers. Can be used for mapping an index retrieved in a GLTextureHandle id map.
view.getOccurrenceIndex(occurrence, scene) -> core.UInt
Parameters

Type

Name

Description

OccurrenceoccurrenceOccurrence identifier.
GPUScenesceneScene identifier.
Returns

Type

Name

Description

UIntindexOccurrence index.
See also:

getSceneIndex

Returns the GPU scene index in the viewer buffers. Can be used for mapping an index retrieved in a GLTextureHandle id map.
view.getSceneIndex(scene, viewer) -> core.UInt
Parameters

Type

Name

Description

GPUScenesceneGPU scene identifier.
ViewerviewerViewer identifier.
Returns

Type

Name

Description

UIntindexGPU scene index.
See also:

lockGPUSceneUpdate

Lock the mutex that ensure no update of the gpu scene is done between lock/unlock.
view.lockGPUSceneUpdate(scene)
Parameters

Type

Name

Description

GPUScenesceneIdentifier of the GPU scene to lock update for.
See also:

lockGPUScenesUpdate

Lock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock.
view.lockGPUScenesUpdate(scenes)
Parameters

Type

Name

Description

GPUSceneListscenesIdentifiers of the GPU scenes to lock update for.
See also:

tryLockGPUSceneUpdate

Try to lock the mutex that ensure no update of the gpu scene is done between lock/unlock, returns true if the mutex has been locked, false if it was already locked.
view.tryLockGPUSceneUpdate(scene) -> core.Bool
Parameters

Type

Name

Description

GPUScenesceneIdentifier of the GPU scene to try to lock update for.
Returns

Type

Name

Description

BoollockedTrue if the mutex has been successfully locked.
See also:

tryLockGPUScenesUpdate

Try to lock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock, returns true if the mutex has been locked, false if it was already locked.
view.tryLockGPUScenesUpdate(scenes) -> core.BoolList
Parameters

Type

Name

Description

GPUSceneListscenesIdentifiers of the GPU scenes to try to lock update for.
Returns

Type

Name

Description

BoolListlockedFor each scene, true if the mutex has been successfully locked.
See also:

unlockGPUSceneUpdate

Unlock the mutex that ensure no update of the gpu scene is done between lock/unlock.
view.unlockGPUSceneUpdate(scene)
Parameters

Type

Name

Description

GPUScenesceneIdentifier of the GPU scene to unlock update for.
See also:

unlockGPUScenesUpdate

Unlock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock.
view.unlockGPUScenesUpdate(scenes)
Parameters

Type

Name

Description

GPUSceneListscenesIdentifiers of the GPU scenes to unlock update for.
See also:

offscreen

addGPUScene

Add a GPU scene to a viewer.
view.addGPUScene(scene, viewer=-1)
Parameters

Type

Name

Description

GPUScenesceneGPU Scene to render in the viewer.
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
See also:

createViewer

Create a new viewer.
view.createViewer(width, height, sharedContext=view.GraphicsContext(), nbViews=1) -> view.Viewer
Parameters

Type

Name

Description

IntwidthWidth of the viewer framebuffer.
IntheightHeight of the viewer framebuffer.
GraphicsContextsharedContextInterop context handle.
IntnbViewsNb views.
Returns

Type

Name

Description

Viewerviewer
See also:

destroyViewer

view.destroyViewer(viewer)
Parameters

Type

Name

Description

ViewerviewerViewer to destroy.
See also:

drawCappingPlane

Create an occurrence that holds the mesh of the surfaces that have been cut by the cutting plane.
view.drawCappingPlane(cuttingPlane) -> scene.Occurrence
Parameters

Type

Name

Description

ComponentcuttingPlaneCutting plane component for which we create the capping plane.
Returns

Type

Name

Description

OccurrencerootThe created occurrence.
See also:

getAutoClipping

Automatically compute the near and far planes depending on the scene.
view.getAutoClipping(viewer=-1, cameraPos) -> geom.Vector2
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Vector3cameraPos
Returns

Type

Name

Description

Vector2clipping
See also:

getCameraFrontAxis

Get the front axis of the nth view matrix of a given viewer.
view.getCameraFrontAxis(viewer=-1, matrixIndex=0) -> geom.Vector3
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
UIntmatrixIndexIndex of the view matrix to use.
Returns

Type

Name

Description

Vector3axis
See also:

getCameraPosition

Get the position of the nth view matrix of a given viewer.
view.getCameraPosition(viewer=-1, matrixIndex=0) -> geom.Vector3
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
UIntmatrixIndexIndex of the view matrix to use.
Returns

Type

Name

Description

Vector3position
See also:

getCameraRightAxis

Get the right axis of the nth view matrix of a given viewer.
view.getCameraRightAxis(viewer=-1, matrixIndex=0) -> geom.Vector3
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
UIntmatrixIndexIndex of the view matrix to use.
Returns

Type

Name

Description

Vector3axis
See also:

getCameraUpAxis

Get the up axis of the nth view matrix of a given viewer.
view.getCameraUpAxis(viewer=-1, matrixIndex=0) -> geom.Vector3
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
UIntmatrixIndexIndex of the view matrix to use.
Returns

Type

Name

Description

Vector3axis
See also:

getViewerProperty

Get a viewer property value.
view.getViewerProperty(propertyName, viewer=-1) -> core.String
Parameters

Type

Name

Description

StringpropertyName
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

StringpropertyValue
See also:

getViewerPropertyInfo

Get a viewer property info.
view.getViewerPropertyInfo(propertyName, viewer=-1) -> core.PropertyInfo
Parameters

Type

Name

Description

StringpropertyName
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

PropertyInfopropertyInfo
See also:

getViewerSize

Retrieve the viewport size of a viewer.
view.getViewerSize(viewer=-1) -> core.Int, core.Int
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

Intwidth
Intheight
See also:

getViewerStats

Returns the number of rendered occurrences and triangles. (Warning: this function does not handle isolate nor invertVisibility viewer property).
view.getViewerStats(viewer=-1) -> core.Int, core.Int
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

IntrenderedOccurrencesNumber of rendered occurrences.
IntrenderedTrianglesNumber of rendered triangles.
See also:

identifySelectedEdges

Identify selected edges.
view.identifySelectedEdges(scene)
Parameters

Type

Name

Description

GPUScenesceneIdentifier of the GPU scene to identify the edges from.
See also:

invertSelectPrimitives

Invert the selection of the primitives (polygons, surfaces) contained in the given rectangle.
view.invertSelectPrimitives(xMin, xMax, yMin, yMax, primitiveType, viewer=-1)
Parameters

Type

Name

Description

IntxMin
IntxMax
IntyMin
IntyMax
PrimitiveSelectionTypeprimitiveType
Viewerviewer
See also:

listViewerProperties

Get the list of viewer properties.
view.listViewerProperties(viewer=-1) -> core.PropertyInfoList
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

PropertyInfoListproperties
See also:

pick

view.pick(x, y, viewer=-1) -> scene.Occurrence, geom.Point3, core.Ident
Parameters

Type

Name

Description

Intx
Inty
Viewerviewer
Returns

Type

Name

Description

OccurrenceoccurrencePicked occurrence, 0 if not occurrence picked.
Point3positionWorld space position of the picking point.
IdentprimitiveIdDepending of the Part shape representation, it can be a triangle/quadrangle index (Mesh) or a Face identifier (BRep).
See also:

pickRectangle

view.pickRectangle(xMin, xMax, yMin, yMax, viewer=-1, inDepth=False) -> scene.OccurrenceList
Parameters

Type

Name

Description

IntxMin
IntxMax
IntyMin
IntyMax
Viewerviewer
BoolinDepth
Returns

Type

Name

Description

OccurrenceListoccurrencesList of picked occurrences.
See also:

refreshViewer

Refresh the viewer.
view.refreshViewer(viewer=-1)
Parameters

Type

Name

Description

ViewerviewerViewer to refresh.
See also:

removeGPUScene

Remove a viewer root.
view.removeGPUScene(scene, viewer=-1)
Parameters

Type

Name

Description

GPUScenesceneGPU Scene to remove from the viewer.
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
See also:

resizeViewer

view.resizeViewer(width, height, viewer=-1)
Parameters

Type

Name

Description

IntwidthWidth of the viewer framebuffer.
IntheightHeight of the viewer framebuffer.
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
See also:

selectPrimitives

Select the primitives (polygons, surfaces) contained in the given rectangle.
view.selectPrimitives(xMin, xMax, yMin, yMax, primitiveType, viewer=-1)
Parameters

Type

Name

Description

IntxMin
IntxMax
IntyMin
IntyMax
PrimitiveSelectionTypeprimitiveType
Viewerviewer
See also:

setDefaultViewerId

Set default viewer id. This viewer will be used in other functions taking a Viewer as a parameter. Useful if a viewer needs to be shared across different contexts.
view.setDefaultViewerId(viewer)
Parameters

Type

Name

Description

Viewerviewer
See also:

setViewerProperty

Set a viewer property value.
view.setViewerProperty(propertyName, propertyValue, viewer=-1)
Parameters

Type

Name

Description

StringpropertyName
StringpropertyValue
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
See also:

unselectPrimitives

Unselect the primitives (polygons, surfaces) contained in the given rectangle.
view.unselectPrimitives(xMin, xMax, yMin, yMax, primitiveType, viewer=-1)
Parameters

Type

Name

Description

IntxMin
IntxMax
IntyMin
IntyMax
PrimitiveSelectionTypeprimitiveType
Viewerviewer
See also:

raw images

getCompositedImage

view.getCompositedImage(viewer) -> material.ImageDefinition
Parameters

Type

Name

Description

Viewerviewer
Returns

Type

Name

Description

ImageDefinitionimageReturned composited image.
See also:

getRenderMapImage

view.getRenderMapImage(viewer, renderMap) -> material.ImageDefinition
Parameters

Type

Name

Description

Viewerviewer
RenderMaprenderMap
Returns

Type

Name

Description

ImageDefinitionimageReturned composited image.
See also:

takeScreenshot

view.takeScreenshot(fileName, viewer)
Parameters

Type

Name

Description

OutputFilePathfileNamePath where to save the screenshot.
Viewerviewer
See also:

streaming

createStreamedViewer

Create a viewer for streaming.
view.createStreamedViewer(width, height, encoderSettings=None, useWebRTC=False, webRTCInfo=None) -> view.StreamedViewerInfo
Parameters

Type

Name

Description

IntwidthWidth of the viewer framebuffer.
IntheightHeight of the viewer framebuffer.
EncoderSettingsencoderSettingsSettings used for the encoder.
BooleanuseWebRTCSwitch between raw websockets and webRTC.
WebRTCInfowebRTCInfoInfo for web rtc signaling connection.
Returns

Type

Name

Description

StreamedViewerInfostreamedViewerInfoPort and host for stream connection.
See also:

resizeStreamedViewer

view.resizeStreamedViewer(width, height, viewer=-1, encoderSettings=None)
Parameters

Type

Name

Description

IntwidthWidth of the viewer framebuffer.
IntheightHeight of the viewer framebuffer.
Viewerviewer
EncoderSettingsencoderSettingsSettings used for the encoder.
See also:

startRecording

Record viewer in a file.
view.startRecording(filePath, viewer, encoderSettings=None)
Parameters

Type

Name

Description

StringfilePathFile in which video while be saved.
ViewerviewerViewer to use for recording video.
EncoderSettingsencoderSettingsSettings used for the encoder.
See also:

stopRecording

Stop recording video.
view.stopRecording(viewer)
Parameters

Type

Name

Description

ViewerviewerViewer to use for recording video.
See also:

viewer matrices

fitCamera

Set the viewer matrices to adjust the camera to the scene.
view.fitCamera(direction, cameraType=1, fov=90, viewer=-1, fitToOccurrences=[])
Parameters

Type

Name

Description

Vector3directionCamera direction.
CameraTypecameraTypeCamera type, Orthographic or Perspective.
AnglefovField of view (perspective mode only).
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
OccurrenceListfitToOccurrences
See also:

getViewerMatrices

view.getViewerMatrices(viewer=-1) -> geom.Matrix4List, geom.Matrix4List, geom.Vector2
Parameters

Type

Name

Description

ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns

Type

Name

Description

Matrix4Listviews
Matrix4Listprojs
Vector2clipping
See also:

setViewerMatrices

view.setViewerMatrices(views, projs, clipping, viewer=-1)
Parameters

Type

Name

Description

Matrix4Listviews
Matrix4Listprojs
Vector2clipping
ViewerviewerViewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
See also:

visibility

visibilityShoot

Render one frame of the visibility session.
view.visibilityShoot(viewer=-1, parts=True, patches=True, polygons=True, countOnce=False) -> scene.OccurrenceList
Parameters

Type

Name

Description

ViewerviewerViewer to use for the visibility shoot.
BoolpartsIf false, optimize when parts seen are not wanted.
BoolpatchesIf false, optimize when patches seen are not wanted.
BoolpolygonsIf false, optimize when polygons seen are not wanted.
BoolcountOnceOptimize when it is not needed to count the numbers of pixels seen during the session.
Returns

Type

Name

Description

OccurrenceListsceneOccurrencesThe list of scene paths seen from this shoot.