Request

Response

    Autodesk.Viewing

    BubbleNode

    new BubbleNode(rawNode, parent)

    Wrapper and helper for "bubble" data.

    Bubble is a container of various 2D or 3D viewables (and additional data) that may be generated from a single seed file. The bubble is a JSON structure of nodes that have different roles, for example, they may represent sheets, nested 2D/3D geometry, etc.

    This class wraps the internal representation of the bubble and adds a couple of helper methods.

    Parameters

    rawNode*
    object
    Raw node from the bubble JSON.
    parent
    object
    Parent node from the bubble JSON.
    * Required

    Methods

    isOtg()

    Returns

    typedescription
    bool true if the bubble hierarchy contains an embedded otg manifest.

    getOtgGraphicsNode()

    Returns the OTG viewable from an otg manifest (if available, otherwise undefined)

    Returns

    getPropertyDbManifest()

    Returns a list of property database files. Previously, for v1, this list was hardcoded in PropWorker/ This function knows about v2 and cross-version sharing of OTG property databases

    getRootNode()

    Returns

    typedescription
    Autodesk.Viewing.BubbleNode Top-most bubble node.

    isForgeManifest()

    Whether the manifest comes form Forge (modelDerivativeV2) or not (derivativeV2). Applies only to the root node. Used internally.

    findPropertyDbPath()

    Finds shared property DB if there is one.

    Returns

    typedescription
    string Shared property DB path, or null.

    name()

    Returns

    typedescription
    string Node name.

    guid()

    Returns

    typedescription
    string Node GUID.

    type()

    Returns

    typedescription
    string Node type.

    extensions()

    Returns

    typedescription
    Array.<string> Either an Array of extension ids, or undefined.

    urn(searchParent)

    Retrieves the URN of the node or its closest ancestor.

    Parameters

    searchParent*
    boolean
    If URN is not available for this node,search through its ancestors, too.
    * Required

    Returns

    typedescription
    string Viewable URN.

    isGeomLeaf()

    Returns

    typedescription
    boolean Is this a geometry leaf node.

    isViewable()

    Returns

    typedescription
    boolean Is this a viewable node.

    getLodNode()

    Returns

    typedescription
    boolean Is this an LOD node.

    isGeometry()

    Returns

    typedescription
    boolean Is this a geometry node.

    isViewPreset()

    Returns

    typedescription
    boolean Is this a view preset/camera definition node.

    is2D()

    Returns

    typedescription
    boolean Is this a 2D node.

    is3D()

    Returns

    typedescription
    boolean Is this a 3D node.

    is2DGeom()

    Returns

    typedescription
    boolean Is this a 2D geometry node.

    is3DGeom()

    Returns

    typedescription
    boolean Is this a 3D geometry node.

    useAsDefault()

    Returns

    typedescription
    boolean true if the node is meant to be loaded initially.

    getPlacementTransform()

    Returns

    typedescription
    object Placement transform of the node.

    isMetadata()

    Returns

    typedescription
    boolean Is this a metadata node.

    findViewableParent()

    Returns

    typedescription
    Autodesk.Viewing.BubbleNode First parent in the hierarchy that is a viewable. If calledon the top level design node, returns the first child of the design node that is a viewable.

    findParentGeom2Dor3D(options)

    Parameters

    Expand all
    options
    object
    Advance usage options
    fallbackParent
    Autodesk.Viewing.BubbleNode
    Gets returned when no geometry node is available after iterating through the parent chain.

    Returns

    typedescription
    Autodesk.Viewing.BubbleNode First parent in the hierarchy that is a 2D or 3D geometry.

    findAllViewables()

    Returns

    typedescription
    Array.<Autodesk.Viewing.BubbleNode> Array with all of the viewables under this node.

    getViewableRootPath(ignoreLeaflet)

    Looks for the viewable root path in this node and all its children.

    Parameters

    ignoreLeaflet*
    Boolean
    If set, it will skip any image pyramid sub-nodes and return a path to F2D file if available.
    * Required

    Returns

    typedescription
    string Viewable root path, or null.

    getNamedViews()

    Returns all the named view in the viewable. Named views are obtained from the document’s manifest which contains camera information and a string identifier.

    Returns

    typedescription
    array All named views. Returns empty array if none are found.

    findByGuid(guid)

    Returns first node from the bubble matching a GUID.

    Note that some GUIDs in the bubble are not unique, you have to be sure you are looking for a GUID that is unique if you want correct result from this function. Otherwise use the generic search.

    Parameters

    guid*
    string
    Node GUID.
    * Required

    Returns

    typedescription
    Autodesk.Viewing.BubbleNode Matching bubble node, or null.

    search(propsToMatch)

    Finds nodes from the bubble matching one or more properties.

    Parameters

    propsToMatch*
    object
    Filter criteria:To match, nodes must have the specified properties and values.Use comma-separated property:value pairs or named preset object.(See comments in examples below.)
    * Required

    Returns

    typedescription
    Array.<BubbleNode> Matching nodes, or null.

    Examples

    // Filter criteria syntax:
    

    // { “property”:”value” [, “property”:”value”, …] } // or use named preset objects: // BubbleNode.MODEL_NODE { “role”:”3d”, “type”:”geometry” } // BubbleNode.GEOMETRY_SVF_NODE { “role”:”graphics”, “mime”: “application/autodesk-svf” } // BubbleNode.SHEET_NODE { “role”:”2d”, “type”:”geometry” } // BubbleNode.LEAFLET_NODE { “role”:”leaflet” } // BubbleNode.IMAGE_NODE { “role”:”image” } // BubbleNode.GEOMETRY_F2D_NODE { “role”:”graphics”, “mime”: “application/autodesk-f2d” } // BubbleNode.VIEWABLE_NODE { “role”:”viewable” } // BubbleNode.AEC_MODEL_DATA { “role”:”Autodesk.AEC.ModelData”}

    var singleProps = myBubbleNode.search({ “type”:”geometry” }); var multiProps = myBubbleNode.search({ “role”:”3d”, “type”:”geometry” }); var presetProps = myBubbleNode.search( myBubbleNode.SHEET_NODE );


    traverse(cb)

    Recursively traverses the bubble, calling a callback function for each node, for as long as the callback function keeps returning false.

    Parameters

    cb*
    function
    Callback function, accepts a bubble node as an argument,and returns true if the traversal should be terminated.
    * Required

    Returns

    typedescription
    boolean Result of the last callback invokation.

    getLevel()

    Returns the Revit Level/Floor of this bubble node. Only relevant for 2d sheets coming from Revit at the moment.

    getLevelName()

    Returns the Revit Level/Floor name of this bubble node. Only relevant for 2d sheets coming from Revit at the moment.