## SetSelFilter

### Introduced

v1.0

### Description

Sets the selection filter and activates the selection tool.

### Scripting Syntax

    SetSelFilter( [SelFilter] );

### Parameters

Parameter | Type | Description
--- | --- | ---
SelFilter | FilterConstant | Selection filter that specifies what type of elements to select. Default Value: Current selection filter

### Examples

#### 1. VBScript Example

    '

    ' This example demonstrates how to set the Edge filter

    ' with the SetSelFilter command using the string value.

    '

    SetSelFilter "Edge"

    ' Alternatively you could use the matching string constant:

    SetSelFilter siEdgeFilter

#### 2. JScript Example

    //

    // This example demonstrates how to set the Polygon filter

    // with the SetSelFilter command using the string constant.

    //

    SetSelFilter(siPolygonFilter);

    // Alternatively you could use the matching string value:

    SetSelFilter("Polygon");

#### 3. Python Example

    #

    # This example demonstrates how to set the Polygon filter

    # with the SetSelFilter command using the string constant.

    #

    from win32com.client import constants

    Application.SetSelFilter(constants.siCameraFilter)

    # Alternatively you could use the matching string value:

    Application.SetSelFilter("Camera")

#### 4. C# Example

    //

    // This example demonstrates how to use the SetSelFilter command in C# to change

    // the selection filter to limit selection to scene objects. Depending on the

    // value of the inUseString input argument, either the string itself (true) or

    // the string constant representing the string (false) will be used to call SetSelFilter.

    //

    // Tip: You need to compile the generated code before you can load the plug-in.

    // After you compile the plug-in, you can load it by clicking Update All in the Plugin Manager.

    //

    using System;

    using Softimage.XSIOM; // Softimage object model

    using Softimage.XSIMath;

    using Softimage.XSIUtil;

    public class Base

    {

    	CXSIApplicationClass m_xsi;

    	CXSIFactoryClass m_fact;

    	CXSIUtilsClass m_utils;

    	protected Base()

    	{

    		m_xsi = new CXSIApplicationClass();

    		m_fact = new CXSIFactoryClass();

    		m_utils = new CXSIUtilsClass();

    	}

    	protected XSIApplication GetXSI()

    	{

    		return m_xsi;

    	}

    }

    public class XSIPlugin : Base

    {

    	public bool Load( PluginRegistrar in_reg )

    	{

    		in_reg.Author = "SDK Documentation";

    		in_reg.Name = "SetSceneObjectSelFilterPlugin";

    		in_reg.Major = 1;

    		in_reg.Minor = 0;

    		in_reg.RegisterCommand("SetSceneObjectSelFilter", "SetSceneObjectSelFilter");

    		return true;

    	}

    	public bool Unload( PluginRegistrar in_reg )

    	{

    		String strPluginName = null;

    		strPluginName = in_reg.Name;

    		return true;

    	}

    }

    public class SetSceneObjectSelFilter : Base

    {

    	public bool Init( Context in_ctxt )

    	{

    		Command oCmd = null;

    		oCmd = (Command)in_ctxt.Source;

    		oCmd.Description = "Demonstrates how to set the Selection Filter in Softimage to Scene Object";

    		oCmd.Tooltip = "Set Selection Filter to SceneObject";

    		oCmd.SetFlag((int)siCommandCapabilities.siCannotBeUsedInBatch, true);

    		oCmd.ReturnValue = false;

    		ArgumentCollection oArgs = oCmd.Arguments;

    		oArgs.Add("inUseString", siArgumentFlags.siArgumentInput, false, siVariantType.siBool);

    		return true;

    	}

    	// In C# you have to use the XSIApplication.ExecuteCommand method to invoke

    	// a command, so we are just implementing a command stub to simplify the call

    	// in the Execute function.

    	public void SetSelFilter(String SelFilter)

    	{

    		XSIApplication app = this.GetXSI();

    		// The SetSelFilter command takes only one argument: 'SelFilter', which

    		// can be either the siObjectFilter string constant or the string to

    		// which it refers: 'sceneobject'

    		object[] oCmdArgs = new object[1];

    		oCmdArgs[0] = SelFilter;

    		app.ExecuteCommand("SetSelFilter", oCmdArgs);

    	}

    	public bool Execute(Context in_ctxt)

    	{

    		Command oCmd = null;

    		oCmd = (Command)in_ctxt.Source;

    		// Set the selection filter to scene object. Whether we use the string

    		// constant or the actual string depends on the value of inUseString.

    		ArgumentCollection oArgs = oCmd.Arguments;

    		if ((bool)oArgs[0].Value == true)

    		{

    			SetSelFilter("SceneObject");

    		}

    		else

    		{

    			// All string constants are members of the StringModule

    			SetSelFilter(StringModule.siObjectFilter);

    		}

    		return true;

    	}

    }

### See Also

ActivatePolygonSelTool ActivatePolygonSelToolWithNoObjStateChange ActivateVertexSelTool ActivateVertexSelToolWithNoObjStateChange ActivateSampledPointSelTool ActivateSampledPointSelToolWithNoObjStateChange ActivateObjectSelTool ActivateObjectSelToolWithNoObjStateChange SelectObjectFilter SelectVertexFilter SelectSampledPointFilter SelectPolygonFilter SelectEdgeFilter