Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

deletenode

  • Last UpdatedFeb 21, 2024
  • 2 minute read

The deletenode statement can be used inside Command node or Coroutine node to delete a node instance. Even though it can be used to delete both loading defined and runtime instantiated nodes this statement is the natural counterpart of the createnode and generally used to remove what previously created.

Note: Deleting a node linked with something in the scene does not mean deleting the object in the scene, but just removing the reference to it in the logic.

Platform support

This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Effect on routes

Deleting a node will automatically trigger the deletion of all its related routes. This affects both routes where the node is involved into the from clause and those where is involved into the to one.

Remember that deleting a node does not affect any place in the code where the same node is referenced, so if a wrong node is removed there can be lot of errors coming out.

Modifying and deleting a node

It’s not possible to assign any value to a node field in the same frame in which the node is deleted.

So in those cases where there’s the need to restore some default state before to remove the node, it’s needed to separate the two activities.

Code example

<Command name="apm_cmd_resetHotspot">

<local name="idx" type="sint" value="0" />

<local name="hotspot" type="sstring" value="" />

<local name="toRemove" type="mstring" value="@apm_displayedHotspots.value@" />

<while condition="@%idx%@&lt;@%toRemove%.length@" >

<setlocal name="hotspot" value="[@%toRemove%.elementAt([@%idx%])]" />

<!-- removing material from list -->

<setfield name="apm_displayedHotspots.value" value="[@apm_displayedHotspots.value.rem([@%hotspot%])]" />

<!-- deleting the material node -->

<deletenode name="[@%hotspot%]"/>

<setlocal name="idx" value="#@%idx%@+1#" />

</while>

</Command>

Fields

These are the fields for deletenode statement.

Fields

Type

Use

Default value

Description

name

sstring

Mandatory

Not set

Name assigned to the node instance.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in