<?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 Navisworks API 2022: Writing Collision Data to XML in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12997568#M342</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to write the Id parameter of the collision element from Revit and the GUID of the collision to an XML file using the Navisworks COM. Could you please guide me on how to achieve this correctly?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OmarovKK_0-1725365146245.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1405080iF6C3765B05085EE3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OmarovKK_0-1725365146245.png" alt="OmarovKK_0-1725365146245.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private static void ExportResultsToXml(NavisworksIntegratedAPI19.InwClashTestsColl clashResults, string filePath)
{
    using (var writer = new StreamWriter(filePath))
    {
        writer.WriteLine("&amp;lt;ClashResults&amp;gt;");
        foreach (NavisworksIntegratedAPI19.InwOclClashTest2 clashTest in clashResults)
        {
            foreach (NavisworksIntegratedAPI19.InwOclTestResult2 clashResult in clashTest.results())
            {
                writer.WriteLine("  &amp;lt;ClashResult&amp;gt;");
                writer.WriteLine($"    &amp;lt;Name&amp;gt;{clashResult.name}&amp;lt;/Name&amp;gt;");

                writer.WriteLine("    &amp;lt;Element1Path&amp;gt;");
                NavisworksIntegratedAPI19.InwOaPath2 Path1 = (InwOaPath2)clashResult.Path1;

                GetAttributeValue(Path1, "LcRevitPropertyElementId"); //here is a method to find the parameter values

                WritePathNodesToXml(writer, Path1);
                writer.WriteLine("    &amp;lt;/Element1Path&amp;gt;");
                // Записываем все узлы для Element2Path
                writer.WriteLine("    &amp;lt;Element2Path&amp;gt;");
                NavisworksIntegratedAPI19.InwOaPath2 Path2 = (InwOaPath2)clashResult.Path2;
                WritePathNodesToXml(writer, Path1);
                writer.WriteLine("    &amp;lt;/Element2Path&amp;gt;");                        

                string bound = ExtractBoundFromComObject(clashResult.Bound);
                writer.WriteLine($"    &amp;lt;Bound&amp;gt;{bound}&amp;lt;/Bound&amp;gt;");


                writer.WriteLine($"    &amp;lt;Status&amp;gt;{clashResult.status}&amp;lt;/Status&amp;gt;");
                writer.WriteLine($"    &amp;lt;Distance&amp;gt;{clashResult.distance}&amp;lt;/Distance&amp;gt;");

                writer.WriteLine("  &amp;lt;/ClashResult&amp;gt;");
            }
        }
        writer.WriteLine("&amp;lt;/ClashResults&amp;gt;");
    }
}

private static string GetAttributeValue(NavisworksIntegratedAPI19.InwOaPath2 inwOaPath2, string attributeName)
{
    try
    {
        var attribute = inwOaPath2.FindAttribute(attributeName, true);
        if (attribute != null)
        {
            return attribute.UserName; // Предполагается, что значение атрибута можно преобразовать в строку
        }
    }
    catch
    {
        return " NA";
    }
    return "NA";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2024 12:10:26 GMT</pubDate>
    <dc:creator>OmarovKK</dc:creator>
    <dc:date>2024-09-03T12:10:26Z</dc:date>
    <item>
      <title>Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12997568#M342</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to write the Id parameter of the collision element from Revit and the GUID of the collision to an XML file using the Navisworks COM. Could you please guide me on how to achieve this correctly?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OmarovKK_0-1725365146245.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1405080iF6C3765B05085EE3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OmarovKK_0-1725365146245.png" alt="OmarovKK_0-1725365146245.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private static void ExportResultsToXml(NavisworksIntegratedAPI19.InwClashTestsColl clashResults, string filePath)
{
    using (var writer = new StreamWriter(filePath))
    {
        writer.WriteLine("&amp;lt;ClashResults&amp;gt;");
        foreach (NavisworksIntegratedAPI19.InwOclClashTest2 clashTest in clashResults)
        {
            foreach (NavisworksIntegratedAPI19.InwOclTestResult2 clashResult in clashTest.results())
            {
                writer.WriteLine("  &amp;lt;ClashResult&amp;gt;");
                writer.WriteLine($"    &amp;lt;Name&amp;gt;{clashResult.name}&amp;lt;/Name&amp;gt;");

                writer.WriteLine("    &amp;lt;Element1Path&amp;gt;");
                NavisworksIntegratedAPI19.InwOaPath2 Path1 = (InwOaPath2)clashResult.Path1;

                GetAttributeValue(Path1, "LcRevitPropertyElementId"); //here is a method to find the parameter values

                WritePathNodesToXml(writer, Path1);
                writer.WriteLine("    &amp;lt;/Element1Path&amp;gt;");
                // Записываем все узлы для Element2Path
                writer.WriteLine("    &amp;lt;Element2Path&amp;gt;");
                NavisworksIntegratedAPI19.InwOaPath2 Path2 = (InwOaPath2)clashResult.Path2;
                WritePathNodesToXml(writer, Path1);
                writer.WriteLine("    &amp;lt;/Element2Path&amp;gt;");                        

                string bound = ExtractBoundFromComObject(clashResult.Bound);
                writer.WriteLine($"    &amp;lt;Bound&amp;gt;{bound}&amp;lt;/Bound&amp;gt;");


                writer.WriteLine($"    &amp;lt;Status&amp;gt;{clashResult.status}&amp;lt;/Status&amp;gt;");
                writer.WriteLine($"    &amp;lt;Distance&amp;gt;{clashResult.distance}&amp;lt;/Distance&amp;gt;");

                writer.WriteLine("  &amp;lt;/ClashResult&amp;gt;");
            }
        }
        writer.WriteLine("&amp;lt;/ClashResults&amp;gt;");
    }
}

private static string GetAttributeValue(NavisworksIntegratedAPI19.InwOaPath2 inwOaPath2, string attributeName)
{
    try
    {
        var attribute = inwOaPath2.FindAttribute(attributeName, true);
        if (attribute != null)
        {
            return attribute.UserName; // Предполагается, что значение атрибута можно преобразовать в строку
        }
    }
    catch
    {
        return " NA";
    }
    return "NA";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 12:10:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12997568#M342</guid>
      <dc:creator>OmarovKK</dc:creator>
      <dc:date>2024-09-03T12:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999509#M343</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12683140"&gt;@OmarovKK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that you're able to access and retrieve most of the necessary data. The challenge seems to be extracting the element ID, and then writing the collision data to XML using the COM API. Is that correct?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;To assist you better, I need some additional details. Could you please describe your workflow? A detailed description will help me understand the situation more clearly and provide you with a more effective solution.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 05:31:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999509#M343</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2024-09-04T05:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999795#M344</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt;&lt;BR /&gt;My workflow is that I try to automatically write all clashes and their parameters to an XML file. To do this, I look at the results of the clash check and write the parameters. I get the parameters of the clashes, but I can't get the parameters of the elements that are involved in the clash (namely the Revit ID).&lt;BR /&gt;Maybe you know how to get the parameters of the element that is involved in the clash?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 08:36:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999795#M344</guid>
      <dc:creator>OmarovKK</dc:creator>
      <dc:date>2024-09-04T08:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999946#M345</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12683140"&gt;@OmarovKK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Obtain DocumentClash&lt;BR /&gt;2. Retrieve ClashTest&lt;BR /&gt;3. Within ClashTest, access Selection A and Selection B&lt;BR /&gt;4. Selection A and Selection B are instances of ModelItemCollection.&lt;BR /&gt;5. From ModelItemCollection, access ModelItems, and then retrieve the associated parameters from ModelItems&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here are the useful links&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/navisworks-api/accessing-specific-clash-test-object-to-find-object-s-specific/td-p/12021588" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/navisworks-api/accessing-specific-clash-test-object-to-find-object-s-specific/td-p/12021588&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-2013-new-feature-clash-1.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-2013-new-feature-clash-1.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 10:08:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/12999946#M345</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2024-09-04T10:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/13005084#M346</link>
      <description>&lt;P&gt;Thank you! I managed to extract the ID via SmartTeg!&lt;BR /&gt;Do you know how to get a GUID collision via COM?&lt;BR /&gt;Via the NET API it exists as a parameter (see screenshot 1), but in COM it is absent (see screenshot 2).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OmarovKK_1-1725633375188.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1406437iAA7445F37A60AEFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OmarovKK_1-1725633375188.png" alt="OmarovKK_1-1725633375188.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OmarovKK_2-1725633430926.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1406438i4AC7EE8C44BD1B0A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OmarovKK_2-1725633430926.png" alt="OmarovKK_2-1725633430926.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 14:37:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/13005084#M346</guid>
      <dc:creator>OmarovKK</dc:creator>
      <dc:date>2024-09-06T14:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Navisworks API 2022: Writing Collision Data to XML</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/13006240#M347</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12683140"&gt;@OmarovKK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I'm not an expert on the COM API.&lt;/P&gt;
&lt;P&gt;The COM API is too old and Autodesk has stopped supporting the COM API for Navisworks.&lt;BR /&gt;&lt;SPAN&gt;If a case is about the possibility of a COM API, you can try searching the blog or SDK sample for any quick clue. Note that Autodesk no longer supports the COM API when it comes to troubleshooting.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2024 06:47:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/navisworks-api-2022-writing-collision-data-to-xml/m-p/13006240#M347</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2024-09-07T06:47:18Z</dc:date>
    </item>
  </channel>
</rss>

