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. |
Methods
isOtg()
Returns
type | description |
---|---|
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
type | description |
---|---|
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
type | description |
---|---|
string | Shared property DB path, or null. |
name()
Returns
type | description |
---|---|
string | Node name. |
guid()
Returns
type | description |
---|---|
string | Node GUID. |
type()
Returns
type | description |
---|---|
string | Node type. |
extensions()
Returns
type | description |
---|---|
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. |
Returns
type | description |
---|---|
string | Viewable URN. |
isGeomLeaf()
Returns
type | description |
---|---|
boolean | Is this a geometry leaf node. |
isViewable()
Returns
type | description |
---|---|
boolean | Is this a viewable node. |
getLodNode()
Returns
type | description |
---|---|
boolean | Is this an LOD node. |
isGeometry()
Returns
type | description |
---|---|
boolean | Is this a geometry node. |
isViewPreset()
Returns
type | description |
---|---|
boolean | Is this a view preset/camera definition node. |
is2D()
Returns
type | description |
---|---|
boolean | Is this a 2D node. |
is3D()
Returns
type | description |
---|---|
boolean | Is this a 3D node. |
is2DGeom()
Returns
type | description |
---|---|
boolean | Is this a 2D geometry node. |
is3DGeom()
Returns
type | description |
---|---|
boolean | Is this a 3D geometry node. |
useAsDefault()
Returns
type | description |
---|---|
boolean | true if the node is meant to be loaded initially. |
getPlacementTransform()
Returns
type | description |
---|---|
object | Placement transform of the node. |
isMetadata()
Returns
type | description |
---|---|
boolean | Is this a metadata node. |
findViewableParent()
Returns
type | description |
---|---|
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
options object | Advance usage options |
fallbackParent Autodesk.Viewing.BubbleNode | Gets returned when no geometry node is available after iterating through the parent chain. |
Returns
type | description |
---|---|
Autodesk.Viewing.BubbleNode | First parent in the hierarchy that is a 2D or 3D geometry. |
findAllViewables()
Returns
type | description |
---|---|
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. |
Returns
type | description |
---|---|
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
type | description |
---|---|
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. |
Returns
type | description |
---|---|
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.) |
Returns
type | description |
---|---|
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. |
Returns
type | description |
---|---|
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.