<?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 wrong reading of Desity. why and how to fix it ? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083236#M154848</link>
    <description>&lt;P&gt;I have a code that read the Density.&amp;nbsp; but some times it read it wrong ... is there a way to fix it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code look somthing close to this,&amp;nbsp; but if I run it on the files I send it say densit is = 1 but it is&amp;nbsp;3,141 .&amp;nbsp; normaly I can just make small change in the file... and it will fix it .. but I would like to have the right number always.. is that possible ?.. My real code run on an assambly&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim rDoc As Document
rDoc = ThisDoc.Document
Dim docPropertySet As PropertySet
docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties")
Dim test

test = docPropertySet.Item("Density").Value

MsgBox(test)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Darkforce_the_ilogic_guy_0-1688638470195.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237254i41574C9F2500B9D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_0-1688638470195.png" alt="Darkforce_the_ilogic_guy_0-1688638470195.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Darkforce_the_ilogic_guy_1-1688638482824.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237255iDB8C5930CB70CD11/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_1-1688638482824.png" alt="Darkforce_the_ilogic_guy_1-1688638482824.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 10:20:07 GMT</pubDate>
    <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
    <dc:date>2023-07-06T10:20:07Z</dc:date>
    <item>
      <title>wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083236#M154848</link>
      <description>&lt;P&gt;I have a code that read the Density.&amp;nbsp; but some times it read it wrong ... is there a way to fix it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code look somthing close to this,&amp;nbsp; but if I run it on the files I send it say densit is = 1 but it is&amp;nbsp;3,141 .&amp;nbsp; normaly I can just make small change in the file... and it will fix it .. but I would like to have the right number always.. is that possible ?.. My real code run on an assambly&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim rDoc As Document
rDoc = ThisDoc.Document
Dim docPropertySet As PropertySet
docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties")
Dim test

test = docPropertySet.Item("Density").Value

MsgBox(test)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Darkforce_the_ilogic_guy_0-1688638470195.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237254i41574C9F2500B9D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_0-1688638470195.png" alt="Darkforce_the_ilogic_guy_0-1688638470195.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Darkforce_the_ilogic_guy_1-1688638482824.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237255iDB8C5930CB70CD11/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_1-1688638482824.png" alt="Darkforce_the_ilogic_guy_1-1688638482824.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 10:20:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083236#M154848</guid>
      <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
      <dc:date>2023-07-06T10:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083317#M154850</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5708980"&gt;@Darkforce_the_ilogic_guy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would probably update all the physical properties of the document by adding this line :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim rDoc As Document
rDoc = ThisDoc.Document
Dim docPropertySet As PropertySet
docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties")
Dim test As Double

ThisApplication.CommandManager.ControlDefinitions.Item("AppUpdateMassPropertiesCmd").Execute

test = docPropertySet.Item("Density").Value
MsgBox(test)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe you can find what you are looking for here&amp;nbsp; :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/how-to-update-physical-mass-area-and-volume-for-an-assembly-by/td-p/9070873" target="_blank" rel="noopener"&gt;Résolu&amp;nbsp;: how to update physical mass, area and volume...for an assembly by API - Autodesk Community - Inventor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;FINET L.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 11:08:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083317#M154850</guid>
      <dc:creator>FINET_Laurent</dc:creator>
      <dc:date>2023-07-06T11:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083599#M154860</link>
      <description>&lt;P&gt;I use this for mass in iLogic:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim NewMass As Double
NewMass = Round(iProperties.Mass, 2)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:03:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083599#M154860</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-07-06T13:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083743#M154863</link>
      <description>&lt;P&gt;It did not work .. Still say 1 isted of the right density&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:48:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083743#M154863</guid>
      <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
      <dc:date>2023-07-06T13:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083752#M154864</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5708980"&gt;@Darkforce_the_ilogic_guy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FINET_Laurent_0-1688651511654.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237352iA862D130393D0651/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FINET_Laurent_0-1688651511654.png" alt="FINET_Laurent_0-1688651511654.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It's working like a charm on my end. How are you updating the density of the part ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;FINET L.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:52:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083752#M154864</guid>
      <dc:creator>FINET_Laurent</dc:creator>
      <dc:date>2023-07-06T13:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083827#M154870</link>
      <description>&lt;P&gt;When dealing with things like Mass, Volume, &amp;amp; Density, it is almost always best to go the API route, and access the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-MassProperties" target="_blank" rel="noopener"&gt;MassProperties&lt;/A&gt; object.&amp;nbsp; Then, if you need to make sure the value is up to date, you may need to adjust the '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=MassProperties_Accuracy" target="_blank" rel="noopener"&gt;Accuracy&lt;/A&gt;' setting.&amp;nbsp; Adjusting the accuracy will force an update and recalculation before retrieving the new value at that accuracy level.&amp;nbsp; There was a thread about this somewhere here on this forum a couple\few years ago in which an Autodesk employee pointed this out.&amp;nbsp; And the one &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=MassProperties_CacheResultsOnCompute_Sample" target="_blank" rel="noopener"&gt;API sample VBA macro&lt;/A&gt; shows an example of this type of thing too, but goes into too much other detail for most folks.&amp;nbsp; However, values obtained through the API route will usually need to have the units converted from 'database units' (g/cm^3) to 'document units'.&amp;nbsp; The simplistic iLogic snippet &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=4da3c892-51fa-b527-88d1-b7a84d8075a9" target="_blank" rel="noopener"&gt;iProperties.Mass&lt;/A&gt; will return the Mass value in document units directly, but the online documentation for that property does not say anything about causing an update.&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; By the way, I know the MassProperties object does not have a direct property for Density, but getting that value is as simple as Mass/Volume, so it is fairly simple to obtain that way.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:24:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12083827#M154870</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-07-06T14:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: wrong reading of Desity. why and how to fix it ?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12084024#M154878</link>
      <description>&lt;P&gt;Density 1 is from Material "Generic".&lt;/P&gt;&lt;P&gt;Mass is override, density is calculated.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 15:12:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/wrong-reading-of-desity-why-and-how-to-fix-it/m-p/12084024#M154878</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-07-06T15:12:07Z</dc:date>
    </item>
  </channel>
</rss>

