<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Implementing SearchCondition Not Equal in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773429#M8225</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17612619"&gt;@niels_deboer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="69" data-end="369"&gt;According to the engineering team, in 2026, the entire &lt;STRONG data-start="124" data-end="138"&gt;Find Items&lt;/STRONG&gt; functionality is implemented using the .NET API, and it appears that no API extensions were required to achieve this. Could you please confirm whether your&amp;nbsp;&lt;STRONG data-start="296" data-end="310"&gt;Find Items&lt;/STRONG&gt; query produces consistent results in both 2025 and 2026?&lt;/P&gt;
&lt;P data-start="69" data-end="369"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="371" data-end="475"&gt;Furthermore, could you clarify the purpose of &lt;STRONG data-start="417" data-end="429"&gt;NotEqual&lt;/STRONG&gt; and explain why it is considered incorrect?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Aug 2025 08:34:08 GMT</pubDate>
    <dc:creator>naveen.kumar.t</dc:creator>
    <dc:date>2025-08-19T08:34:08Z</dc:date>
    <item>
      <title>Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13772504#M8223</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;FONT size="5"&gt;Tl;dr&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;We are trying to find the “ModelItems” in our document that do not equal a certain property value using a plugin for Navisworks 2025. In our implementation we filter items from our model and create a selection. We hide or unhide items from this selection and then save it to a viewpoint (using COM). This way we can also validate if our&amp;nbsp;not equal filter solution works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Contrast this to the Navisworks GUI where we go about this by applying a search set, selecting a category, property, condition and value.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="niels_deboer_0-1755534716664.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1562191i3750B9B47AB724FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="niels_deboer_0-1755534716664.png" alt="niels_deboer_0-1755534716664.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Seems simple, but there is no “not equals” condition in the API. We’ve tried and found various solutions and leads, but nothing works so far. Has anyone been successful in implementing a not equal filter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="6"&gt;What we’ve tried so far&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1. Documentation&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;First solution is found in the documentation where it is mentioned that you can use the “Negate” method or “NotEqual” under SearchConditionComparison Enumeration. However, this does not work. We decompiled the .dll and NotEqual doesn’t exist. Attempting to use negate in this fashion will result in an empty ModelSelection. We know this, because our script saves it to a viewpoint, and contrary to s1, the s2 viewpoint is completely empty. Here is the example from the documentation example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//set a search condition

SearchCondition s1 = SearchCondition.HasCategoryByName(PropertyCategoryNames.Transform);

//invert the search, i.e. NOT Has Category By Name

SearchCondition s2 = s1.Negate();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;2. NET&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Next, we tried to make a custom filter using NET. A very basic not equal filter on the entire document could be made with a workaround. Consider three sets of model items. All the items in the model, set A. All the items in the model equal to phase created 1, set B. All the items in the model not equal to phase created B. We know that A = B + C. Therefore C = A -B. I made a script from this, since we already have the equal value, we call B as variable ”results”. We loop through all the items in the model, A, which we get from the variable “doc” and check if it is a member of B and then add it to C. Problem with this script is that it never finishes running, probably because something is wrong with it or my dataset is too large (we have more than 800 thousand items in the model) and the script is inefficient.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public static void NotEqualFilter(Document doc,ModelItemCollection results)
        {
            // Reference collection A. Get the itmes in the current model
            ModelItemCollection referenceItems = doc.Models.RootItem.DescendantsAndSelf;  // This SHOULD select all unhidden items.
            // Build HashSet of B for fast lookup
            HashSet&amp;lt;int&amp;gt; searchHashes = new HashSet&amp;lt;int&amp;gt;();
            foreach (ModelItem item in results)
            {
                searchHashes.Add(item.GetHashCode());
            }
            // Collection C: items in A,referenceItems, but not in B,results.
            ModelItemCollection filteredItems = new ModelItemCollection();
            foreach (ModelItem item in referenceItems)
            {
                if (!searchHashes.Contains(item.GetHashCode()))
                {
                    filteredItems.Add(item);
                }
            }
            // Optional: update current selection
            doc.CurrentSelection.CopyFrom(filteredItems);
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;3. Linq&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The third thing we’ve tried was using linq for finding items, filtering on item.HasGeometry and negating the search condition. See link below but couldn’t get that one to work. So, we quickly went on to try using COM.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/navisworks-api-forum/search-only-visible-items-and-exclude-items-that-has-a-hidden/td-p/7352047" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/navisworks-api-forum/search-only-visible-items-and-exclude-items-that-has-a-hidden/td-p/7352047&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;4. COM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The fourth thing we’ve tried was converting it to COM, which did work. We followed post 6 in &lt;A href="https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/td-p/3313411" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/td-p/3313411&lt;/A&gt; The script is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;doc.CurrentSelection.CopyFrom(results); //results is the ModelItemCollection “equal to”
                InwOpState10 myState = Autodesk.Navisworks.Api.ComApi.ComApiBridge.State;
                InwOpSelection2 myCurrentSelection = myState.CurrentSelection.Copy() as InwOpSelection2;     // Create a copy of current selection
                InwOpSelection2 myRestOfModel = myState.ObjectFactory(nwEObjectType.eObjectType_nwOpSelection, null, null) as InwOpSelection2;    // Create a new empty selection
                myRestOfModel.SelectAll();     // Get the new selection to contain the entire model
                myRestOfModel.SubtractContents(myCurrentSelection);    // Subtract the current selection, so it contains the unselected part of model
                ModelItemCollection netSelection = ComApiBridge.ToModelItemCollection(myRestOfModel);  // Convert back to .net api
                doc.CurrentSelection.CopyFrom(netSelection);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem with this method is that it didn’t produce the results as expected. It filtered parents and hid them (because we did not filter on HasGeometry), but more problematic, items that were supposed to be hidden or unhidden were not. This would also happen to sibling items under one parent. E.g. filter on phase created not equal to 1, then some phase created 61 items would be hidden and others unhidden with the same parent, same phase creation and with no other explanation. See picture. This indicated to me that something went wrong under the hood. We didn’t do any garbage collection, but we doubt this is the cause, since some items are selected and we use this function only once during the test. At this point we decided it was time to ask for help given the brittle and opaque nature of it all.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="niels_deboer_1-1755534928695.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1562193i042410D3580F0157/image-size/medium?v=v2&amp;amp;px=400" role="button" title="niels_deboer_1-1755534928695.png" alt="niels_deboer_1-1755534928695.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="6"&gt;In conclusion&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;At this point we found that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Solutions in the documentation don’t work (negate() or NotEqual)&lt;/LI&gt;&lt;LI&gt;Using COM API seems the best path&lt;/LI&gt;&lt;LI&gt;COM is opaque and we found little documentation, but the API reference manual and the 2016 NavisWorks labs&lt;/LI&gt;&lt;LI&gt;We don’t know about memory limitations, and it could just stop adding items to the collection because I try to select more than 700k items.&lt;/LI&gt;&lt;LI&gt;Need to filter out items with no geometry, but this impedes performance.&lt;/LI&gt;&lt;LI&gt;It should also ignore any items that don't have this category instead of selecting them by the not equal filter.&lt;/LI&gt;&lt;LI&gt;We need to implement garbage collection, although we doubt this is the root cause of the issue&lt;/LI&gt;&lt;LI&gt;We believe we overcomplicated things and that there should be an easy way to implement this&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 16:58:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13772504#M8223</guid>
      <dc:creator>niels_deboer</dc:creator>
      <dc:date>2025-08-18T16:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773429#M8225</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17612619"&gt;@niels_deboer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="69" data-end="369"&gt;According to the engineering team, in 2026, the entire &lt;STRONG data-start="124" data-end="138"&gt;Find Items&lt;/STRONG&gt; functionality is implemented using the .NET API, and it appears that no API extensions were required to achieve this. Could you please confirm whether your&amp;nbsp;&lt;STRONG data-start="296" data-end="310"&gt;Find Items&lt;/STRONG&gt; query produces consistent results in both 2025 and 2026?&lt;/P&gt;
&lt;P data-start="69" data-end="369"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="371" data-end="475"&gt;Furthermore, could you clarify the purpose of &lt;STRONG data-start="417" data-end="429"&gt;NotEqual&lt;/STRONG&gt; and explain why it is considered incorrect?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 08:34:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773429#M8225</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2025-08-19T08:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773511#M8226</link>
      <description>&lt;P&gt;Thanks for your quck reply Naveen!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find items in NET using SearchCondition constructor with their given methods. See code, this works completely fine. I also did this for contains and other conditions all present under the search condition methods.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="csharp"&gt;condition = SearchCondition.HasPropertyByDisplayName(Category, Property).EqualValue(VariantData.FromDisplayString(Value.tostring()));
Search search = new Search();
search.Selection.SelectAll();
search.SearchConditions.Add(condition);
ModelItemCollection results = search.FindAll(doc, false);&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Unlike in the Navisworks GUI as seen in the first image, there is no "not equal" method under the SearchCondition constructor. Did this change in the 2026 version? Trying to make a not euqal filter didn't&amp;nbsp;&lt;SPAN&gt;work because:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;There is no "Not Equal" method under&amp;nbsp;SearchCondition constructor.&lt;/LI&gt;&lt;LI&gt;The solution I found to this is appending .Negate() to the condition object. However, this yields an empty ModelItemCollection under the results object when I tried this&lt;/LI&gt;&lt;LI&gt;I coudln't get NotEqual from&amp;nbsp;SearchConditionComparison Enumeration to work and I coudln't find it in the autodesk.navisworks.api namespace where it was supposed to be according to the NET API reference manual.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I tried the three workarounds and that didn't work. COM was most successful, but:&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;This started to go wrong when testing on larger models.&lt;/LI&gt;&lt;LI&gt;Selects items if they do not have "Category" present in the item. It also seems to not consequently do this.&lt;/LI&gt;&lt;LI&gt;Validation shows that items that should pass the filter didn't. Some items with phasing not equal 1 are passed, others are not. SearchCondition logic seems to be lost in the process or could it be a memory issue?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Why we need not Equal? Phase 1 in our model is the starting phase. Filtering on not equal phase 1 selects all the items that we construct or demolish. By hiding these items we make our reference point for other phasings.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 09:48:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773511#M8226</guid>
      <dc:creator>niels_deboer</dc:creator>
      <dc:date>2025-08-19T09:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773631#M8227</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17612619"&gt;@niels_deboer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="p-rich_text_section"&gt;Looks like, FindItems uses&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;public SearchCondition( NamedConstant categoryCombinedName, NamedConstant propertyCombinedName, SearchConditionOptions options, SearchConditionComparison comparison, VariantData value)&lt;/PRE&gt;
&lt;DIV class="p-rich_text_section"&gt;to create the SearchCondition with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="c-mrkdwn__code" data-stringify-type="code"&gt;SearchConditionComparison.NotEqual&lt;/CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 Aug 2025 11:14:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773631#M8227</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2025-08-19T11:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773922#M8228</link>
      <description>&lt;P&gt;Thanks Naveen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried several things as you suggested, I feel that we are getting closer. Here some code excerpts. I ommit everything, but the filtering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I tried setting the&amp;nbsp;&lt;SPAN&gt;SearchConditionComparison to NotEqual, but it's ready only. I then tried to use SerachCondition as a method, but I wasn't allowed to use it as a method. Comparewith addresses the&amp;nbsp;SearchConditionComparison property, but I couldn't get it to work.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To change the property of the constructor I found&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;C# 
public SearchConditionComparison Comparison { get; }
 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. When trying to build the following it returns that Comparison is read-only, becuase it's {get;}. I did not find a metehod to set Comparison to NotEqual&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;condition = SearchCondition.HasPropertyByDisplayName(propertyDisplayName, propertyName)
                                .EqualValue(VariantData.FromDisplayString(targetValue.ToString()));
condition.Comparison = NotEqual;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;I tried this, but I cannot use SearchCondition as a method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static void FilterItems(string propertyDisplayName, string propertyName, string FilterCondition, object targetValue, string filterType) 
{ ...
SearchConditionOptions options = SearchConditionOptions.None;
SearchConditionComparison NotEqual = SearchConditionComparison.NotEqual; 
condition = SearchCondition(propertyDisplayName, propertyName, options, NotEqual, targetValue.ToString());
... }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. This builds, but it crashes when running:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void FilterItems(string propertyDisplayName, string propertyName, string FilterCondition, object targetValue, string filterType) 
{ ...
SearchCondition.HasPropertyByDisplayName(propertyDisplayName, propertyName).EqualValue(VariantData.FromDisplayString(targetValue.ToString()));
condition.CompareWith(NotEqual, VariantData.FromDisplayString(targetValue.ToString()));
...}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. And the best for last &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt; This builds, I tested it, but it doesn't select anything&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void FilterItems(string propertyDisplayName, string propertyName, string FilterCondition, object targetValue, string filterType) 
{ ...
SearchCondition propertyCondition = SearchCondition.HasPropertyByName(propertyDisplayName, propertyName);
                            condition = propertyCondition.CompareWith(
                            SearchConditionComparison.NotEqual,
VariantData.FromDisplayString(targetValue.ToString()));
...}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5. Edit. Also tried Relfection, but that didn't work. Just behaves as a normal equal filter&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System.Reflection;
public static void FilterItems(string propertyDisplayName, string propertyName, string FilterCondition, object targetValue, string filterType)
{...
condition = SearchCondition.HasPropertyByDisplayName(propertyDisplayName, propertyName).EqualValue(VariantData.FromDisplayString(targetValue.ToString()));
var field = typeof(SearchCondition).GetField("&amp;lt;Comparison&amp;gt;k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic);

if (field != null)
{
field.SetValue(condition, SearchConditionComparison.NotEqual);
}
...}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 14:58:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13773922#M8228</guid>
      <dc:creator>niels_deboer</dc:creator>
      <dc:date>2025-08-19T14:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13774186#M8230</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17612619"&gt;@niels_deboer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="65" data-end="193"&gt;I recommend using the &lt;STRONG data-start="87" data-end="102"&gt;NavisLookup&lt;/STRONG&gt; tool(&lt;A href="https://github.com/chuongmep/NavisLookup" target="_blank"&gt;https://github.com/chuongmep/NavisLookup&lt;/A&gt;) to identify the correct values to use in your code. &lt;BR /&gt;&lt;BR /&gt;Below are the steps I followed:&lt;/P&gt;
&lt;OL data-start="195" data-end="830"&gt;
&lt;LI data-start="195" data-end="279"&gt;
&lt;P data-start="198" data-end="279"&gt;Create the desired &lt;STRONG data-start="217" data-end="238"&gt;Search Conditions&lt;/STRONG&gt; in &lt;EM data-start="242" data-end="254"&gt;Find Items&lt;/EM&gt; via the Navisworks UI.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="280" data-end="407"&gt;
&lt;P data-start="283" data-end="407"&gt;Go to&amp;nbsp;&lt;STRONG data-start="288" data-end="303"&gt;NavisLookup&lt;/STRONG&gt; → &lt;EM data-start="306" data-end="329"&gt;Snoop Active Document&lt;/EM&gt; → &lt;EM data-start="332" data-end="348"&gt;Current Search&lt;/EM&gt; → &lt;EM data-start="351" data-end="358"&gt;Value&lt;/EM&gt; → &lt;EM data-start="361" data-end="380"&gt;Search Conditions&lt;/EM&gt; → &lt;EM data-start="383" data-end="404"&gt;Search Condition[0]&lt;/EM&gt;.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="408" data-end="478"&gt;
&lt;P data-start="411" data-end="478"&gt;You will now see the values, as shown in the attached screenshot. Please see the attached screenshot&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="479" data-end="540"&gt;
&lt;P data-start="482" data-end="540"&gt;Use these same values in the sample code as shown below.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="541" data-end="706"&gt;
&lt;P data-start="544" data-end="706"&gt;Ensure you are passing the correct data type into &lt;CODE data-start="594" data-end="613"&gt;VariantData value&lt;/CODE&gt;. For example, if the value is a string, pass a string; if it is a boolean, pass a boolean.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="707" data-end="830"&gt;
&lt;P data-start="710" data-end="830"&gt;With this search condition, run a search on your document. It should return the same results as the &lt;EM data-start="810" data-end="822"&gt;Find Items.&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;EM data-start="810" data-end="822"&gt;Sample Code:&lt;/EM&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Document doc = Autodesk.Navisworks.Api.Application.ActiveDocument;
           
NamedConstant categoryCombinedName = null;
NamedConstant propertyCombinedName = new NamedConstant(DataPropertyNames.ItemHidden);
SearchConditionOptions options = SearchConditionOptions.IgnoreNames;
SearchConditionComparison comparison = SearchConditionComparison.NotEqual;
VariantData value = new VariantData(false);
SearchCondition searchCondition = new SearchCondition(categoryCombinedName,propertyCombinedName,options,comparison,value);

Search serach = new Search();
serach.Locations = SearchLocations.Descendants; 
serach.SearchConditions.Add(searchCondition);
serach.Selection.SelectAll();              

ModelItemCollection items = serach.FindAll(doc, true);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Search Condition.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1562611i70AA703B3F8869F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Search Condition.png" alt="Search Condition.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 17:10:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13774186#M8230</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2025-08-19T17:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Implementing SearchCondition Not Equal</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13775898#M8231</link>
      <description>&lt;P&gt;Amazing this works! Thanks Naveen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I finally managed to make the NotEqual filter and tested it on a small test sample, which seems to behave correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've installed Navislookup and found the properties and the following code works for a not equal condition.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="niels_deboer_0-1755693621579.png" style="width: 968px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1562952iA40427D7F0FC90F5/image-dimensions/968x468?v=v2" width="968" height="468" role="button" title="niels_deboer_0-1755693621579.png" alt="niels_deboer_0-1755693621579.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for the making the condition for a not equal filter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;NamedConstant category = new NamedConstant("LcSvF_Phasing", "Phasing");
NamedConstant property = new NamedConstant("Phase Created", "Phase Created");

SearchConditionOptions options = SearchConditionOptions.None;
SearchConditionComparison NotEqual = SearchConditionComparison.NotEqual;
VariantData target = new VariantData(targetValue.ToString()); // VariantData.FromDisplayString(targetValue.ToString());
condition = new SearchCondition(category, property, options, NotEqual, target)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found another solution to the problem that doesn't require Navislookup. It is very useful for if you want to automatically apply search sets and expand its capabilities. All you need is the propertyName variable. This is equal to the string shown in the GUI. In Naveen's screenshot case it would be "hidden". This script retrieves the information to create the condition. No need for navislookup. You can use this script. Just make sure to have a selection of items as input, add some code to apply the search condition and clean the code &lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void FilterItems(string propertyDisplayName, string propertyName, string FilterCondition, object targetValue, string filterType)
{   
    var doc = Autodesk.Navisworks.Api.Application.ActiveDocument;
    SearchCondition condition = null;
        // Apppend your own filter conditions, this everything below is only for NotEqual 
    PropertyCategory searchCategory = null;
    DataProperty searchProperty = null;
    string categoryName = null;
    string categoryDisplayName = null;
    string dataPropertyName = null;
    string dataPropertyDisplayName = null;
    
    ModelItem firstItem = null;
    bool found = false;
    foreach (ModelItem item in Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.SelectedItems)
    {
        firstItem = item; 
        // break; }                                 
        if (firstItem != null)
        {
            foreach (PropertyCategory category in firstItem.PropertyCategories)
            {
                foreach (DataProperty dataProperty in category.Properties)
                {
                    if (dataProperty.DisplayName == propertyName)
                    {
                        categoryName = category.Name;
                        categoryDisplayName = category.DisplayName;
                        dataPropertyName = dataProperty.Name;
                        dataPropertyDisplayName = dataProperty.DisplayName;

                        string logPath = @"C:\Data\Navisworks Plugin\navisworks_properties_log.txt";
                        using (StreamWriter writer = new StreamWriter(logPath, true))
                        {
                            writer.WriteLine($"Category name:displayname: {category.Name} : {category.DisplayName}");
                            writer.WriteLine($"Property name:displayname: {dataProperty.Name}: {dataProperty.DisplayName}");
                            
                        }
                        found = true; // Just need the first category and property from the first item
                        goto Done;
                    }
                }
            }
        }
    }
Done:
    if (!found)
    {
        // Log error and Raise exception if we don't find our target value
        File.AppendAllText("navisworks_property_log.txt", "Error! Property not found.\n");
        throw new Exception("Target DataProperty.DisplayName not found in first ModelItem.");
    }
        
    Application.ActiveDocument.CurrentSelection.Clear();
    // Execute not equal search
    NamedConstant search_category = new NamedConstant(categoryName, categoryDisplayName); // see named constant in the documentation
    NamedConstant search_property = new NamedConstant(dataPropertyName, dataPropertyDisplayName);
    SearchConditionOptions options = SearchConditionOptions.None;
    SearchConditionComparison NotEqual = SearchConditionComparison.NotEqual;
    VariantData target = new VariantData(targetValue.ToString()); 
    condition = new SearchCondition(search_category, search_property, options, NotEqual, target);
// Then add your script to apply the condition to select the items. 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 16:22:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/implementing-searchcondition-not-equal/m-p/13775898#M8231</guid>
      <dc:creator>niels_deboer</dc:creator>
      <dc:date>2025-08-20T16:22:05Z</dc:date>
    </item>
  </channel>
</rss>

