|
![]() |
When value is true, search ignores descendants of any matching model items. Default is true.
Namespace: Autodesk.Navisworks.Api
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
Examples

using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows.Forms; using System.Text; using Autodesk.Navisworks.Api.Controls; //This sample should be tried with the GateHouse sample drawing, public static void NamedConstantSearch() { //Create a new search object Search s = new Search(); //Add our search condition s.SearchConditions.Add( new SearchCondition( new NamedConstant("LcOaNode", "Item"), new NamedConstant("LcOaNodeHidden", "Hidden"), SearchConditionOptions.StartGroup, SearchConditionComparison.Equal, VariantData.FromBoolean(false) ) ); //Note, this particular search would be better acheived using other methods than NamedConstant //and is purely to demonstrate NamedConstant usage. //for example a better form of the same query would be: //s.SearchConditions.Add( // SearchCondition.HasPropertyByName(PropertyCategoryNames.Item, DataPropertyNames.ItemHidden) // .EqualValue(VariantData.FromBoolean(false))); // // //Set the selection which we wish to search s.Selection.SelectAll(); s.Locations = SearchLocations.DescendantsAndSelf; //halt searching below ModelItems which match this s.PruneBelowMatch = true; //get the resulting collection by applying this search ModelItemCollection searchResults = s.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false); StringBuilder output = new StringBuilder(); output.AppendLine("Found the following:"); //show the results foreach (ModelItem mi in searchResults) { output.AppendLine(mi.ToString()); } MessageBox.Show(output.ToString()); }
Exceptions
Exception | Condition |
---|---|
System..::..ObjectDisposedException | Object has been Disposed |
System..::..NotSupportedException | Object is Read-Only |