|
![]() |
Defines a PropertyCategories based condition for use in searches. Immutable.
Namespace: Autodesk.Navisworks.Api
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
Visual Basic |
---|
Public Class SearchCondition _ Inherits NativeHandle |
C# |
---|
public class SearchCondition : NativeHandle |
Visual C++ |
---|
public ref class SearchCondition : public NativeHandle |
Remarks
When using the SearchCondition class it is important to use the returned SearchCondition object from any method called on a SearchCondition object. This is because the method is not applying a change to the current SearchCondition but in fact copying it and applying the method to the new object.
Examples

using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows.Forms; using System.Text; //set a search condition SearchCondition s1 = SearchCondition.HasCategoryByName(PropertyCategoryNames.Transform); //invert the search, i.e. NOT Has Category By Name SearchCondition s2 = s1.Negate(); //at this point s2 is not the same as s1

using Autodesk.Navisworks.Api.Controls; //Create a new search Search s = new Search(); //set the selection to everything s.Selection.SelectAll(); //Add a search condition s.SearchConditions.Add(SearchCondition.HasCategoryByName(PropertyCategoryNames.Geometry)); try { //get the resulting collection by applying this search ModelItemCollection searchResults = s.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, true); //Select the items in the model that are contained in the collection Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.CopyFrom(searchResults); } catch (CanceledOperationException) { //the user cancelled the search }
Inheritance Hierarchy
System..::..Object
Autodesk.Navisworks.Api..::..NativeHandle
Autodesk.Navisworks.Api..::..SearchCondition
Autodesk.Navisworks.Api..::..NativeHandle
Autodesk.Navisworks.Api..::..SearchCondition