<?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: Multiple conditions for search sets in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925249#M3208</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/656821"&gt;@ulski1&lt;/a&gt;&amp;nbsp; thanks for your response.&lt;/P&gt;&lt;P&gt;For you as information:&lt;/P&gt;&lt;P&gt;As input I get strings with 2 conditions like shown above in the picture.&lt;BR /&gt;As output I would like to save a SearchSet with 2 conditions in a subfolder.&lt;/P&gt;&lt;P&gt;So right now I do have the problem, that I can only save a searchset with one condition.&lt;/P&gt;&lt;P&gt;As suggested I tried to do it like the tutorial below said with groups. But can I do it as followed?&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2012/07/use-search-api.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://adndevblog.typepad.com/aec/2012/07/use-search-api.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Search s = new Search();
s.Selection.SelectAll();&lt;BR /&gt;
//SearchCondition1 of group1:the item is required
SearchCondition oGroup1_SC1 =SearchCondition.HasPropertyByDisplayName("Item", "Required");
oGroup1_SC1 = oGroup1_SC1.EqualValue(VariantData.FromBoolean(true));

//SearchCondition2 of group1:the item's DWG handle is 16C17
SearchCondition oGroup1_SC2 =SearchCondition.HasPropertyByDisplayName("Entity Handle", "Value");
oGroup1_SC2 = oGroup1_SC2.EqualValue(VariantData.FromDisplayString("16C17"));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;System.Collections.Generic.List&amp;lt;SearchCondition&amp;gt; oG1 =new System.Collections.Generic.List&amp;lt;SearchCondition&amp;gt;();
oG1.Add(oGroup1_SC1);
oG1.Add(oGroup1_SC2);
s.SearchConditions.AddGroup(oG1);

s.Selection.SelectAll();
s.Locations = SearchLocations.DescendantsAndSelf;
SavedItem newItem = new SelectionSet(s);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Jul 2019 11:37:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-23T11:37:51Z</dc:date>
    <item>
      <title>Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924852#M3203</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;is there a possibility to add more than one condition to a search sets via a plugin?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-07-23 10_13_54-C03 bis C09.dwg - Autodesk Navisworks Manage 2018.png" style="width: 448px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/660102i92DE831C9AF84CDF/image-dimensions/448x115?v=v2" width="448" height="115" role="button" title="2019-07-23 10_13_54-C03 bis C09.dwg - Autodesk Navisworks Manage 2018.png" alt="2019-07-23 10_13_54-C03 bis C09.dwg - Autodesk Navisworks Manage 2018.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Right now I only can add one condition with the following code:&lt;/P&gt;&lt;PRE&gt; public SavedItem create_search(string categorydisplayname, string propertydisplayname, string variantdata, string searchsetsname)
        {
            Search s = new Search();
            SearchCondition sc = SearchCondition.HasPropertyByDisplayName(categorydisplayname, propertydisplayname);
            s.SearchConditions.Add(sc.EqualValue(VariantData.FromDisplayString(variantdata)));

            ////set the selection to everything

            s.Selection.SelectAll();
            s.Locations = SearchLocations.DescendantsAndSelf;
            SavedItem newItem = new SelectionSet(s);
            newItem.DisplayName = searchsetsname;

            return newItem;
        }&lt;/PRE&gt;&lt;P&gt;Can anyone explain me how to add multiple conditions?&lt;/P&gt;&lt;P&gt;(Just for explanations: I will need to add the search set to a FolderItem, that's why I'm using SavedItem, but if there is a better solution, please explain me.)&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ramona&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 08:20:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924852#M3203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-23T08:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924933#M3204</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, you just need to add an other condition (or more) to the search you created. For example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Search s = new Search();
SearchCondition sc = SearchCondition.HasPropertyByDisplayName(categorydisplayname, propertydisplayname); // first SearchCondition
s.SearchConditions.Add(sc.EqualValue(VariantData.FromDisplayString(variantdata)));  // first SearchCondition added to the search conditions&lt;BR /&gt;&lt;BR /&gt;SearchCondition sc2 = SearchCondition.HasPropertyByDisplayName(categorydisplayname, propertydisplayname); // second SearchCondition &lt;BR /&gt;s.SearchConditions.Add(sc2.EqualValue(VariantData.FromDisplayString(variantdata2))); // second SearchCondition added to the search conditions&lt;BR /&gt;&lt;BR /&gt;etc ...&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;the rest of the code is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note : all these conditions are evaluated with an 'and' logic (cond1 &amp;amp; cond2 needs to be true to have a result) so in the above example variantdata needs to be the same as variantdata2 to have a result so you have to modify the second condition to your desired one (I used the same condition for demonstration purposes)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 08:51:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924933#M3204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-23T08:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924950#M3205</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;Thanks for your response. Do I need to create a new variable? or can I just do it in a for loop?&lt;/P&gt;&lt;PRE&gt;Search s = new Search();
foreach(condition)
{
SearchCondition sc = SearchCondition.HasPropertyByDisplayName(categorydisplayname, propertydisplayname); // first SearchCondition
s.SearchConditions.Add(sc.EqualValue(VariantData.FromDisplayString(variantdata)));  // first SearchCondition added to the search conditions
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 08:56:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924950#M3205</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-23T08:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924983#M3206</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp; , it's me the user&amp;nbsp;@Anonymous&amp;nbsp;(sorry posted with the wrong profile)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is possible but the code depends on what you want to do and what is your data input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, the 'Search s = new Search();' variable needs to be the same and the ' SearchCondition sc ' variable can be recreated or updated in your for loop.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 09:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8924983#M3206</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-23T09:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925002#M3207</link>
      <description>Hi,&lt;BR /&gt;You use SearchConditions.Add&lt;BR /&gt;See the article Xiaodong Liang wrote in 2012&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2012/07/use-search-api.html" target="_blank"&gt;https://adndevblog.typepad.com/aec/2012/07/use-search-api.html&lt;/A&gt;&lt;BR /&gt;or see the reply I wrote in 2015&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/navisworks-api/searchcondition-is-not-working/td-p/5818301" target="_blank"&gt;https://forums.autodesk.com/t5/navisworks-api/searchcondition-is-not-working/td-p/5818301&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;br&lt;BR /&gt;Ulrik&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Jul 2019 09:24:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925002#M3207</guid>
      <dc:creator>ulski1</dc:creator>
      <dc:date>2019-07-23T09:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925249#M3208</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/656821"&gt;@ulski1&lt;/a&gt;&amp;nbsp; thanks for your response.&lt;/P&gt;&lt;P&gt;For you as information:&lt;/P&gt;&lt;P&gt;As input I get strings with 2 conditions like shown above in the picture.&lt;BR /&gt;As output I would like to save a SearchSet with 2 conditions in a subfolder.&lt;/P&gt;&lt;P&gt;So right now I do have the problem, that I can only save a searchset with one condition.&lt;/P&gt;&lt;P&gt;As suggested I tried to do it like the tutorial below said with groups. But can I do it as followed?&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2012/07/use-search-api.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://adndevblog.typepad.com/aec/2012/07/use-search-api.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Search s = new Search();
s.Selection.SelectAll();&lt;BR /&gt;
//SearchCondition1 of group1:the item is required
SearchCondition oGroup1_SC1 =SearchCondition.HasPropertyByDisplayName("Item", "Required");
oGroup1_SC1 = oGroup1_SC1.EqualValue(VariantData.FromBoolean(true));

//SearchCondition2 of group1:the item's DWG handle is 16C17
SearchCondition oGroup1_SC2 =SearchCondition.HasPropertyByDisplayName("Entity Handle", "Value");
oGroup1_SC2 = oGroup1_SC2.EqualValue(VariantData.FromDisplayString("16C17"));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;System.Collections.Generic.List&amp;lt;SearchCondition&amp;gt; oG1 =new System.Collections.Generic.List&amp;lt;SearchCondition&amp;gt;();
oG1.Add(oGroup1_SC1);
oG1.Add(oGroup1_SC2);
s.SearchConditions.AddGroup(oG1);

s.Selection.SelectAll();
s.Locations = SearchLocations.DescendantsAndSelf;
SavedItem newItem = new SelectionSet(s);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 11:37:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925249#M3208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-23T11:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple conditions for search sets</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925342#M3209</link>
      <description>It is always difficult to spot if you are missing something. You can set the display name of the search set like so newItem.DisplayName = ;&lt;BR /&gt;For more about selection sets see these articles&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2012/08/add-search-selectionset-in-net.html" target="_blank"&gt;https://adndevblog.typepad.com/aec/2012/08/add-search-selectionset-in-net.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2015/07/update-selectionset.html" target="_blank"&gt;https://adndevblog.typepad.com/aec/2015/07/update-selectionset.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Jul 2019 12:08:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/multiple-conditions-for-search-sets/m-p/8925342#M3209</guid>
      <dc:creator>ulski1</dc:creator>
      <dc:date>2019-07-23T12:08:15Z</dc:date>
    </item>
  </channel>
</rss>

