Request

Response

    Core

    Autodesk.Viewing.ViewingApplication

    new ViewingApplication(containerId,options)

    Wrapper application for the viewer component.

    Attaches ViewingApplication to a div by ID and initializes common properties of the viewing application.

    Parameters

    Expand all
    containerId*
    string
    The ID of the main container.
    options
    object
    An optional dictionary of options.
    disableBrowserContextMenu
    boolean
    Disables the browser’s default context menu.
    * Required

    Methods

    addItemSelectedObserver(observer)

    Adds objects to be notified when a new item is selected in the browser tree.

    Parameters

    observer*
    object
    Should implement function onItemSelected(viewer).
    * Required

    finish()

    Performs any necessary cleanup to allow the object to be garbage collected.

    getCurrentViewer()

    Returns the currently set Viewer.

    Returns

    TypeDescription
    Viewer3D

    getDefaultGeometry(geometryItems)

    Given a list of geometry items, possibly fetched through Autodesk.Viewing.Document.getSubItemsWithProperties, it will return 1 single item from the list that should be the first one to be loaded. The method will attempt to find the item marked with attribute ‘useAsDefault’ with true. When none is found, it will return the first element from the list.

    Parameters

    geometryItems*
    array
    * Required

    Returns

    TypeDescription
    object Item element contained in geometryItems.

    getNamedViews(item)

    Returns a list of named views for the Viewer. It will use getSelectedItem() or the item parameter, if available.

    Users may call into setlectItem() with a value of the returned array.

    Available from version 2.15

    Parameters

    item
    object
    The item for which you want to get named views

    Returns

    TypeDescription
    array
    • All named views, returns empty array if no named views are found.

    getSelectedItem()

    Returns the node object containing metadata associated to the model currently loaded in the viewer.

    Returns

    TypeDescription
    null|object

    getViewer(config)

    Returns a new instance of a Viewer of requested type.

    Parameters

    config*
    object
    Viewer configuration override.
    * Required

    Returns

    TypeDescription
    Viewer3D Viewer instance or null.

    getViewerContainer()

    Returns the container that will be used by the viewer. By default uses the same container as the appContainer. This method can be overridden to specify a different sub container for the viewer.

    Returns

    TypeDescription
    MemberExpression

    loadDocument(documentId,onDocumentLoad,onLoadFailed,accessControlProperties)

    Asynchronously loads a document (BubbleNode) given its ID. You can initialize a ViewingApplication with an already downloaded document using setDocument().

    Parameters

    documentId*
    *
    Viewable document ID.
    onDocumentLoad
    function
    Called on success.
    onLoadFailed
    function
    Called on error.
    accessControlProperties
    object
    An optional list of key value pairs as access control properties, which includes a list of access control header name and values, and an OAuth 2.0 access token.
    * Required

    onDocumentFailedToLoad(errorCode,errorMsg,errors)

    Default success callback for documentFailedToLoad. Logs the document that was loaded on console.

    Parameters

    errorCode*
    string
    Globalized error code.
    errorMsg*
    string
    Error message to display.
    errors*
    array
    List of errors that come from other clients (translators).
    * Required

    onDocumentLoaded(document)

    Default success callback for loadDocument. Logs the document that was loaded on console.

    Parameters

    document*
    *
    * Required

    onItemSelected(item,viewGeometryItem)

    Called when selectItem successfully loads an item.

    Parameters

    item*
    object
    Can be either type ‘view’ or ‘geometry’.
    viewGeometryItem*
    object
    Can only be type ‘geometry’. Will be the same as item if item is type ‘geometry’.
    * Required

    registerViewer(viewableType,viewerClass,config)

    Register a Viewer to be used with this ViewingApplication.

    Parameters

    viewableType*
    number
    Currently must be ViewingApplication.k3D.
    viewerClass*
    *
    config*
    *
    * Required

    selectItem(item,onSuccessCallback,onErrorCallback)

    Asynchronously loads an individual item from a document into the correct viewer.

    As of version version 2.15, parameter item may be a BubbleNode instead of a raw JavaScript object.

    Parameters

    item*
    *
    onSuccessCallback*
    function
    This call back is called when the item is selected.
    onErrorCallback*
    function
    This call back is called when the item fails to select.
    * Required

    Returns

    TypeDescription
    boolean

    selectItemById(itemId,onItemSelectedCallback,onItemFailedToSelectCallback)

    Finds the item within the current document and calls selectItem.

    Parameters

    itemId*
    number
    onItemSelectedCallback
    function
    This call back is called when the item is selected.
    onItemFailedToSelectCallback
    function
    This call back is called when the item fails to select.
    * Required

    Returns

    TypeDescription
    boolean

    setCurrentViewer(viewer)

    Sets this ViewingApplication’s viewer to the provided viewer.

    Parameters

    viewer*
    * Required

    setDocument(docManifest)

    Initializes the ViewingApplication with an already downloaded manifest that is Forge hosted. There is no need to call loadDocument() when this function is used.

    Available from version 2.15

    Parameters

    docManifest*
    object
    A JavaScript object for the hosted manifest.
    * Required

    Returns

    TypeDescription
    boolean true if the document was successfully initialized, false if the document was not successfully initialized.
     
    ______
    icon-svg-close-thick

    Cookie preferences

    Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

    May we collect and use your data?

    Learn more about the Third Party Services we use and our Privacy Statement.

    Strictly necessary – required for our site to work and to provide services to you

    These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

    Improve your experience – allows us to show you what is relevant to you

    These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

    Customize your advertising – permits us to offer targeted advertising to you

    These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

    icon-svg-close-thick

    THIRD PARTY SERVICES

    Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

    icon-svg-hide-thick

    icon-svg-show-thick

    Strictly necessary – required for our site to work and to provide services to you

    Qualtrics
    W
    Akamai mPulse
    W
    Digital River
    W
    Dynatrace
    W
    Khoros
    W
    Launch Darkly
    W
    New Relic
    W
    Salesforce Live Agent
    W
    Wistia
    W
    Tealium
    W
    Upsellit
    W
    CJ Affiliates
    W
    Commission Factory
    W
    Google Analytics (Strictly Necessary)
    W
    Typepad Stats
    W
    Geo Targetly
    W
    SpeedCurve
    W
    Qualified
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Improve your experience – allows us to show you what is relevant to you

    Google Optimize
    W
    ClickTale
    W
    OneSignal
    W
    Optimizely
    W
    Amplitude
    W
    Snowplow
    W
    UserVoice
    W
    Clearbit
    #
    YouTube
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Customize your advertising – permits us to offer targeted advertising to you

    Adobe Analytics
    W
    Google Analytics (Web Analytics)
    W
    AdWords
    W
    Marketo
    W
    Doubleclick
    W
    HubSpot
    W
    Twitter
    W
    Facebook
    W
    LinkedIn
    W
    Yahoo! Japan
    W
    Naver
    W
    Quantcast
    W
    Call Tracking
    W
    Wunderkind
    W
    ADC Media
    W
    AgrantSEM
    W
    Bidtellect
    W
    Bing
    W
    G2Crowd
    W
    NMPI Display
    W
    VK
    W
    Adobe Target
    W
    Google Analytics (Advertising)
    W
    Trendkite
    W
    Hotjar
    W
    6 Sense
    W
    Terminus
    W
    StackAdapt
    W
    The Trade Desk
    W
    RollWorks
    W

    Are you sure you want a less customized experience?

    We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

    Your experience. Your choice.

    We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

    May we collect and use your data to tailor your experience?

    Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.
    Version 4