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. |
Methods
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 |
---|---|
BubbleNode | Matching bubble node, or null. |
findParentGeom2Dor3D()
Returns
Type | Description |
---|---|
BubbleNode | First parent in the hierarchy that is a 2D or 3D geometry. |
findPropertyDbPath()
Finds shared property DB if there is one.
Returns
Type | Description |
---|---|
string | Shared property DB path, or null. |
findViewableParent()
Returns
Type | Description |
---|---|
BubbleNode | First parent in the hierarchy that is a viewable. |
getLodNode()
Returns
Type | Description |
---|---|
boolean | Is this an LOD node. |
getNamedViews()
Returns all the named views in the viewable. Named views are obtained from the document’s manifest which contains camera information and a string identifier.
Available from version 2.15
Returns
Type | Description |
---|---|
array | All named views. Returns empty array if none are found. |
getPlacementTransform()
Returns
Type | Description |
---|---|
object | Placement transform of the node. |
getRootNode()
Returns
Type | Description |
---|---|
BubbleNode | Top-most bubble node. |
getTag(tag)
Retrieves value of a node tag.
Parameters
tag* string | Tag name. |
Returns
Type | Description |
---|---|
* | Tag value. |
getViewableRootPath()
Looks for the viewable root path in this node and all its children.
Returns
Type | Description |
---|---|
string | Viewable root path, or null. |
guid()
Returns
Type | Description |
---|---|
string | Node GUID. |
is2D()
Returns
Type | Description |
---|---|
boolean | Is this a 2D node. |
is2DGeom()
Returns
Type | Description |
---|---|
boolean | Is this a 2D geometry node. |
is3D()
Returns
Type | Description |
---|---|
boolean | Is this a 3D node. |
is3DGeom()
Returns
Type | Description |
---|---|
boolean | Is this a 3D geometry node. |
isGeometry()
Returns
Type | Description |
---|---|
boolean | Is this a geometry node. |
isGeomLeaf()
Returns
Type | Description |
---|---|
boolean | Is this a geometry leaf node. |
isMetadata()
Returns
Type | Description |
---|---|
boolean | Is this a metadata node. |
isViewable()
Returns
Type | Description |
---|---|
boolean | Is this a viewable node. |
name()
Returns
Type | Description |
---|---|
string | Node name. |
search(propsToMatch)
Finds nodes from the bubble matching one or more properties.
Parameters
propsToMatch* object | Filter criteria - matching nodes must have the same properties and values. |
Returns
Type | Description |
---|---|
Array.<BubbleNode> | Matching nodes, or null. |
setTag(tag,value)
Sets node tag value.
Parameters
tag* string | Tag name. |
value* * | Tag value. |
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. |
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. |