Navigation: Scripting Reference Manual > Functions & Subroutines > DeleteEntity

 

DeleteEntity

 

Contact Us: fredsupport@photonengr.com

 

Description

Deletes a specified entity and all of its descendants.  Note that calling DeleteEntity on a folder (Optical Sources, Geometry or Analysis Surface(s)) will remove all descendants of the folders from the model without removing the folder itself.

 

Syntax

success = DeleteEntity ( n )

 

Parameters

success (Boolean)

Indicates success (True) or failure (False) of the delete attempt.

 

n As Long

Node number of the entity that will be deleted (all descendants of this node will be deleted as well).

 

Example

The example below demonstrates how to use the FindText command to get a list of entities having the string description, "Delete Me", and then use the DeleteEntity in a loop to remove the found items from the document.

 

Sub Main

 

    'Search the Description field for entities having the

    'description string, "Delete Me"

    Dim items() As Long, nFound As Long

    nFound = FindText( "Delete Me", items() )

 

    'Loop over the entities we found and delete them from the tree

    Dim curEnt As Long

    For curEnt = UBound(items) To 0 Step -1

        DeleteEntity( items(curEnt) )

    Next

 

    'Update the document

    Update

 

End Sub

 

 

See Also

SysNew

SysReset

SysNewOrReset

FindText

 

 

 

 

 

 

Copyright © Photon Engineering, LLC