Deselecting Specific Items (Removing from the Selection)

 
 
 
// 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

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License