<?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: Does anyone know why my function for exploding empty groups is not working properly? in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11784887#M1603</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13494320"&gt;@mtrainottiGHXJH&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to reproduce the issue.&lt;BR /&gt;I have &lt;A title="https://autodesk.slack.com/archives/C1S2NDLLV/p1677483808196029" href="https://autodesk.slack.com/archives/C1S2NDLLV/p1677483808196029" target="_blank" rel="noopener"&gt;&lt;U&gt;&lt;STRONG&gt;raised your issue to the Navisworks Engineering team&lt;/STRONG&gt;&lt;/U&gt;&lt;/A&gt;.&lt;BR /&gt;But I haven't received any response from the engineering team yet.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2023 15:58:13 GMT</pubDate>
    <dc:creator>naveen.kumar.t</dc:creator>
    <dc:date>2023-02-27T15:58:13Z</dc:date>
    <item>
      <title>Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11774522#M1601</link>
      <description>&lt;P&gt;Below is my function for exploding empty groups and removing an item from a group if it is the only item in a group. This function works as expected with the caveat that I have to run it multiple times to remove all the groups. I have tried several solutions including rerunning the test recursively every time a group is removed until it does not return but this still does not work. I think it may have to do with do with items moving around the testdata in the same step(idk). Does anybody have any ideas for a solution or a method to await the testdata refreshing after an item is moved?&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;        void explode_empty_groups()
        {
            var tests_data = doc_cd.TestsData.Tests;
            foreach (ClashTest ctest in tests_data)

            {
                    foreach (SavedItem _item in ctest.Children)
                    {

                        if(_item.IsGroup)
                        {
                            ClashResultGroup clash_group = _item as ClashResultGroup;
                            if (clash_group == null) 
                            {
                                //isgroup &amp;amp; null
                                doc_cd.TestsData.TestsRemove(ctest, _item);
                                continue;
                            }


                            //move child out
                            if (clash_group.Children.Count == 1)
                            {
                                doc_cd.TestsData.TestsMove(clash_group, 0, ctest, 0);
                                doc_cd.TestsData.TestsRemove(ctest, clash_group);
                                continue;
                            }

                            //remove group
                            if (clash_group.Children.Count == 0)
                            {
                                doc_cd.TestsData.TestsRemove(ctest, clash_group);
                                continue;
                            }


                        }

                    }


                return;
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 23:44:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11774522#M1601</guid>
      <dc:creator>mtrainottiGHXJH</dc:creator>
      <dc:date>2023-02-22T23:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11774524#M1602</link>
      <description>&lt;P&gt;Also the return after a single clash test intentional as I am testing this over 1 clash test currently.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 23:45:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11774524#M1602</guid>
      <dc:creator>mtrainottiGHXJH</dc:creator>
      <dc:date>2023-02-22T23:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11784887#M1603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13494320"&gt;@mtrainottiGHXJH&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to reproduce the issue.&lt;BR /&gt;I have &lt;A title="https://autodesk.slack.com/archives/C1S2NDLLV/p1677483808196029" href="https://autodesk.slack.com/archives/C1S2NDLLV/p1677483808196029" target="_blank" rel="noopener"&gt;&lt;U&gt;&lt;STRONG&gt;raised your issue to the Navisworks Engineering team&lt;/STRONG&gt;&lt;/U&gt;&lt;/A&gt;.&lt;BR /&gt;But I haven't received any response from the engineering team yet.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 15:58:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11784887#M1603</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2023-02-27T15:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11789399#M1604</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13494320"&gt;@mtrainottiGHXJH&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still have not received any response from the NW Engineering team.&lt;BR /&gt;So I have logged the issue(&amp;nbsp;&lt;A id="key-val" class="issue-link" href="https://jira.autodesk.com/browse/NW-58887" rel="6220906" data-issue-key="NW-58887" target="_blank"&gt;NW-58887&lt;/A&gt; ) with the Navisworks Engineering team.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 06:07:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11789399#M1604</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2023-03-01T06:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11796435#M1605</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13494320"&gt;@mtrainottiGHXJH&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had a discussion with my team.&lt;BR /&gt;The below sample code will help you.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt; private void Code(Document doc)
        {
            DocumentClash docClash = doc.GetClash();
            DocumentClashTests tests = docClash.TestsData;
            foreach (ClashTest test in tests.Tests)
            {
                var groupToDelete = new List&amp;lt;ClashResultGroup&amp;gt;();

                foreach (SavedItem savedItem in test.Children)
                {
                    if (savedItem is ClashResultGroup)
                    {
                        ClashResultGroup resultGroup = savedItem as ClashResultGroup;
                        string resultGroupName = resultGroup.DisplayName;

                        //If the group does not have any clash, the group will be deleted
                        if (resultGroup.Children.Count() == 0)
                        {
                            groupToDelete.Add(resultGroup);
                        }
                    }
                }
                foreach (ClashResultGroup resultGroup in groupToDelete)
                {
                    docClash.TestsData.TestsRemove(resultGroup.Parent, resultGroup);

                }
            }
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Mar 2023 15:56:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11796435#M1605</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2023-03-03T15:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my function for exploding empty groups is not working properly?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11796492#M1606</link>
      <description>&lt;P&gt;I appreciate your help! I wasn’t aware you could remove this way.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 16:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/does-anyone-know-why-my-function-for-exploding-empty-groups-is/m-p/11796492#M1606</guid>
      <dc:creator>mtrainottiGHXJH</dc:creator>
      <dc:date>2023-03-03T16:14:50Z</dc:date>
    </item>
  </channel>
</rss>

