Softimage SDK Programmer's Guide > Plug-in Development > Selection > Manipulating the Selection >

# Deselecting Specific Items (Removing from the Selection)

- Use Selection.Remove or Selection::Remove which takes an object pointer as input:

    // C++ API
    Application app;
    Model root = app.GetActiveSceneRoot();
    X3DObject myGrid;
    root.AddGeometry( L"Grid", L"NurbsSurface", L"myGrid", myGrid );
    X3DObject myCylinder;
    root.AddGeometry( L"Cylinder", L"MeshSurface", L"myCylinder", myCylinder );
    Selection sel( app.GetSelection() );
    sel.SetAsText( L"myGrid,myCylinder" );
    sel.Remove( myGrid );// leaves only 'myCylinder' selected

    // C#
    CXSIApplication app = new CXSIApplication();
    Model root = app.ActiveSceneRoot;
    X3DObject myGrid = root.AddGeometry("Grid", "NurbsSurface", "myGrid");
    X3DObject myCylinder = root.AddGeometry("Cylinder", "MeshSurface", "myCylinder");
    Selection sel = app.Selection;
    sel.SetAsText(myGrid.Name + "," + myCylinder.Name);
    sel.Remove(myGrid, siSelectMode.siSelectDefault);	// leaves only 'myCylinder' selected

    // JScript
    var myGrid = ActiveSceneRoot.AddGeometry( "Grid", "NurbsSurface" );
    var myCylinder = ActiveSceneRoot.AddGeometry( "Cylinder", "MeshSurface" );
    Selection.SetAsText( myGrid + "," + myCylinder );
    Selection.Remove( myGrid );// leaves only 'myCylinder' selected

    ' VBScript
    set myGrid = ActiveSceneRoot.AddGeometry( "Grid", "NurbsSurface" )
    set myCylinder = ActiveSceneRoot.AddGeometry( "Cylinder", "MeshSurface" )
    Selection.SetAsText myGrid & "," & myCylinder
    Selection.Remove myGrid' leaves only 'myCylinder' selected

    # Python
    app = Application
    myGrid = app.ActiveSceneRoot.AddGeometry( "Grid", "NurbsSurface" )
    myCylinder = app.ActiveSceneRoot.AddGeometry( "Cylinder", "MeshSurface" )
    app.Selection.SetAsText( "%s,%s" %(myGrid.Name,myCylinder.Name) )
    app.Selection.Remove( myGrid )# leaves only 'myCylinder' selected

    # Perl
    my $app = $Application;
    my $myGrid = $app->ActiveSceneRoot->AddGeometry( "Grid", "NurbsSurface" );
    my $myCylinder = $app->ActiveSceneRoot->AddGeometry( "Cylinder", "MeshSurface" );
    $app->Selection->SetAsText( $myGrid->Name.",".$myCylinder->Name );

    $app->Selection->Remove( $myGrid )# leaves only 'myCylinder' selected

Related Scripting Commands

- RemoveFromSelection

- ShrinkSelection, InvertSelection

- DeactivateElements, ToggleActiveElements, SetAndToggleActiveElements