<?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 Exception thrown if changing attributes e.g. transparency in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10909889#M2114</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are using the dll Autodesk.Navisworks.Api in a custom developed Plugin. In this Plugin we use different apis, e.g. find an element or focus an element.&lt;/P&gt;&lt;P&gt;But we also want to set a general transparency to the full model for example.&lt;/P&gt;&lt;P&gt;Reading apis are working fine, but if we want to change something like transparency, then we get following message and Simulate is closing:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Exception thrown at 0x00007FFCA863AF30 (lcutil.dll) in Roamer.exe: 0xC0000005: Access violation reading at position 0x0000000000000000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below you can find the source:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;try&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Document localDocument = Application.ActiveDocument;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var collection = localDocument.Models.CreateCollectionFromRootItems();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;localDocument.Models.OverridePermanentColor(collection, Color.FromByteRGB(color.R, color.G, color.B));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;catch (Exception ex)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Logger.Error(ex);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone had the same Issues?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jan 2022 08:48:22 GMT</pubDate>
    <dc:creator>christoph.schillingLHCFR</dc:creator>
    <dc:date>2022-01-27T08:48:22Z</dc:date>
    <item>
      <title>Exception thrown if changing attributes e.g. transparency</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10909889#M2114</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are using the dll Autodesk.Navisworks.Api in a custom developed Plugin. In this Plugin we use different apis, e.g. find an element or focus an element.&lt;/P&gt;&lt;P&gt;But we also want to set a general transparency to the full model for example.&lt;/P&gt;&lt;P&gt;Reading apis are working fine, but if we want to change something like transparency, then we get following message and Simulate is closing:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Exception thrown at 0x00007FFCA863AF30 (lcutil.dll) in Roamer.exe: 0xC0000005: Access violation reading at position 0x0000000000000000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below you can find the source:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;try&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Document localDocument = Application.ActiveDocument;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var collection = localDocument.Models.CreateCollectionFromRootItems();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;localDocument.Models.OverridePermanentColor(collection, Color.FromByteRGB(color.R, color.G, color.B));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;catch (Exception ex)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Logger.Error(ex);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone had the same Issues?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 08:48:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10909889#M2114</guid>
      <dc:creator>christoph.schillingLHCFR</dc:creator>
      <dc:date>2022-01-27T08:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Exception thrown if changing attributes e.g. transparency</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10909919#M2115</link>
      <description>That is not how you set transparency the method is OverridePermanentTransparency&lt;BR /&gt;Beware that transparency is a double.&lt;BR /&gt;Change your code to use using statement whenever you use disposable objects like so:&lt;BR /&gt;&lt;BR /&gt;using (ModelItemCollection searchResultCollection = searchObject.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false))&lt;BR /&gt;{&lt;BR /&gt;Autodesk.Navisworks.Api.Application.ActiveDocument.Models.OverridePermanentTransparency(searchResultCollection, mytransparency);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;- also I recommend that you install the Visual Studio extension DisposableFixer&lt;BR /&gt;&lt;BR /&gt;Br&lt;BR /&gt;Ulrik&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jan 2022 09:01:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10909919#M2115</guid>
      <dc:creator>ulski1</dc:creator>
      <dc:date>2022-01-27T09:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Exception thrown if changing attributes e.g. transparency</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10910768#M2116</link>
      <description>&lt;P&gt;Hey Ulrik,&lt;/P&gt;&lt;P&gt;sorry for that mistake with the code. I copied the wrong lines of my source code.&lt;/P&gt;&lt;P&gt;I have tried your proposal with dispose:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Document localDocument = Application.ActiveDocument;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;using(var collection = localDocument.Models.CreateCollection())&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;localDocument.Models.OverridePermanentTransparency(collection, value);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;but I am always getting the same error. Value hast the type double.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your hint with DisposibleFixer. I have installed it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings Chris.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 15:11:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10910768#M2116</guid>
      <dc:creator>christoph.schillingLHCFR</dc:creator>
      <dc:date>2022-01-27T15:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Exception thrown if changing attributes e.g. transparency</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10910840#M2117</link>
      <description>Createcollectionfromrootitem returns a ModelItemCollection but OverridePermanentTransparency takes a IEnumerable check if that is your problem&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jan 2022 15:32:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/exception-thrown-if-changing-attributes-e-g-transparency/m-p/10910840#M2117</guid>
      <dc:creator>ulski1</dc:creator>
      <dc:date>2022-01-27T15:32:09Z</dc:date>
    </item>
  </channel>
</rss>

