DeleteObj

Introduced

v1.0

Description

Deletes the object(s) specified by name (SIObject.Name). There are special rules for deleting objects in hierarchy, such as parent nodes or models. To delete the entire hierarchy, you must use branch-deletion: either use the "B:" prefix in the InputObj argument or first branch-select the target and leave the InputObj argument empty. See the Python example for a demonstration of both of these methods.

Scripting Syntax

DeleteObj( [InputObj] );

Parameters

Parameter Type Description
InputObj String List of objects to delete.

Examples

1. VBScript Example

'

'	Simple example of how to delete a scene object.

'

GetPrim "Null"

DeleteObj "Null"

2. JScript Example

/*

	This example demonstrates how to delete a custom property from the scene.

*/

// Quick setup: custom property set on a torus

NewScene( null, false );

CreatePrim( "Torus", "MeshSurface", "InnerTube" );

AddProp( "Custom_parameter_list", "", "", "Buoyancy" );

SIAddCustomParameter( "InnerTube.Buoyancy", "Sideways", siDouble, 0, 0, 1, null, 5, 0, 1 );

SIAddCustomParameter( "InnerTube.Buoyancy", "Active", siBool, 0, 0, 1, null, 5, 0, 1 );

// Inspect the property set modally, then delete it if the user presses Cancel

var canceled = false;

while ( !canceled ) {

	canceled = InspectObj( "InnerTube.Buoyancy", "", "Buoyancy Settings", siModal, false );

}

// Deleting the property set completely removes it from the scene

DeleteObj( "InnerTube.Buoyancy" );

3. Python Example

#

#  This example shows how to delete a model.

#

app = Application

from win32com.client import constants as cns

app.NewScene("", 0);

# First create 2 simple models containing a sphere and a disc (respectively)

sph = app.CreatePrim("Sphere", "MeshSurface")

mdl1 = app.CreateModel(sph, "MySphModel")(0)

sph = app.CreatePrim("Disc", "MeshSurface")

mdl2 = app.CreateModel(sph, "MyDscModel")(0)

app.LogMessage(app.ActiveSceneRoot.Models.GetAsText())

# INFO : MySphModel,MyDscModel

# Try deleting it without any special selection mode

app.SelectObj(mdl1.Name)

app.DeleteObj()

app.LogMessage(app.ActiveSceneRoot.Models.GetAsText())

# INFO : MySphModel,MyDscModel

# The command failed because it wasn't selected in branch

# Now delete it in branch. Models must be branch-selected when deleting

app.SelectObj(mdl1.Name, "BRANCH")

app.DeleteObj()

app.LogMessage(app.ActiveSceneRoot.Models.GetAsText())

# INFO : MyDscModel

# Try the "B:" prefix without any selection mode for the second model

app.DeselectAll()

app.DeleteObj("B:"+mdl2.Name)

app.LogMessage(app.ActiveSceneRoot.Models.GetAsText())

# INFO :

See Also

Dealing with Hierarchy SelectObj