<?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: API - Accessing material asset values in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/8977385#M100549</link>
    <description>&lt;P&gt;Hi Jef_E&lt;/P&gt;&lt;P&gt;I found something close in what I'm looking in this post.&lt;/P&gt;&lt;P&gt;Can you help me in figuring out how to extract the Category Name from a Library?&lt;/P&gt;&lt;P&gt;I have this code but I just stuck thinking too much&lt;/P&gt;&lt;P&gt;Thank you in advance if you can help me on this matter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
        
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssetLibrary&lt;/SPAN&gt;
        &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"CategoryName"&lt;/SPAN&gt;)

        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsset&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Asset&lt;/SPAN&gt;
        &lt;SPAN&gt;oAsset&lt;/SPAN&gt; = &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt;.&lt;SPAN&gt;MaterialAssetCategories&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)

        &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oValue&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssetCategory&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsset&lt;/SPAN&gt;
            &lt;SPAN&gt;Debug&lt;/SPAN&gt;.&lt;SPAN&gt;Print&lt;/SPAN&gt;(&lt;SPAN&gt;oValue&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;)

        &lt;SPAN&gt;Next&lt;/SPAN&gt;
		&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Aug 2019 04:17:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-21T04:17:36Z</dc:date>
    <item>
      <title>API - Accessing material asset values</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/6897996#M70455</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to access some material properties but i'm stuck..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to change values for these fields. ( see image )&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Material.JPG" style="width: 351px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/325890i520370EBB585F1B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Material.JPG" alt="Material.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used this piece of code to access the assetvalue&amp;nbsp;but I cant find a way to set the value of a assetvalue (very confusing I know...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        Dim oAssetLib As AssetLibrary
        oAssetLib = _invApp.AssetLibraries.Item("MaterialLibrary")

        Dim oAsset As Asset
        oAsset = oAssetLib.MaterialAssets.Item(1)

        For Each oValue As AssetValue In oAsset
            Debug.Print(oValue.Name &amp;amp; ": " &amp;amp; oValue.ValueType.ToString)
        Next&lt;/PRE&gt;
&lt;P&gt;This resulted in the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AssetLibID: kAssetValueTypeString
physmat_Comments: kAssetValueTypeString
physmat_Cost: kAssetValueTypeString
physmat_Keynote: kAssetValueTypeString
physmat_Keywords: kAssetValueTypeString
physmat_Label: kAssetValueTypeString
physmat_Manufacturer: kAssetValueTypeString
physmat_Mark: kAssetValueTypeString
physmat_Model: kAssetValueTypeString
physmat_Type: kAssetValueTypeChoice
physmat_URL: kAssetValueTypeString
physmat_aspects: kAssetValueTypeReference
physmat_class: kAssetValueTypeString&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But how can I Set the string value for example "physmat_Cost"? I can't see anything in the API for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AssetValue Object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Description The &lt;FONT color="#000000"&gt;AssetValue&lt;/FONT&gt; object represents a specific value within an asset. The &lt;FONT color="#000000"&gt;AssetValue&lt;/FONT&gt; class is the base class for the various types of asset values.&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;TABLE class="list"&gt;
&lt;TBODY&gt;
&lt;TR class="header"&gt;
&lt;TD class="list"&gt;Name&lt;/TD&gt;
&lt;TD class="list"&gt;Description&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_Application.htm" target="_blank"&gt;Application&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Returns the top-level parent application object. When used the context of Inventor, an Application object is returned. When used in the context of Apprentice, an ApprenticeServer object is returned.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_DisplayName.htm" target="_blank"&gt;DisplayName&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Gets the name of this value as seen in the Material or Appearance Browser. This can change based on the current Inventor language.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_IsReadOnly.htm" target="_blank"&gt;IsReadOnly&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Gets the boolean flag that indicates if this asset value is read-only. If True any attempted edits will fail.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_Name.htm" target="_blank"&gt;Name&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Gets the key name of the value. This name will remain constant for all languages and is the name used as input to the Item property or the Asset object.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_Parent.htm" target="_blank"&gt;Parent&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Read-only property that returns the parent Asset object.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_Type.htm" target="_blank"&gt;Type&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Read-only property returning kAssetValueObject indicating this object’s type.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;&lt;A href="https://forums.autodesk.com/t5/forums/postpage/board-id/AssetValue_ValueType.htm" target="_blank"&gt;ValueType&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="list"&gt;Read-only property that returns the data type that the Value property for this &lt;FONT color="#ffffff"&gt;AssetValue&lt;/FONT&gt; object will return.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:32:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/6897996#M70455</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2017-02-23T10:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: API - Accessing material asset values</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/6898038#M70457</link>
      <description>&lt;P&gt;Hmpppff okay found it myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            If oValue.ValueType = AssetValueTypeEnum.kAssetValueTypeString Then
                Dim oStringAssetValue As StringAssetValue
                oStringAssetValue = oValue
                Debug.Print(oValue.Name &amp;amp; ": " &amp;amp; oStringAssetValue.Value)
            End If&lt;/PRE&gt;
&lt;P&gt;This is really weird in my opinion but, if it works okay &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@F982DDE76110C67DBDB6AF220B48480A/emoticons/1f604.png" alt=":grinning_face_with_smiling_eyes:" title=":grinning_face_with_smiling_eyes:" /&gt; Now to figure out a way to add materials into the library..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:44:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/6898038#M70457</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2017-02-23T10:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: API - Accessing material asset values</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/8977385#M100549</link>
      <description>&lt;P&gt;Hi Jef_E&lt;/P&gt;&lt;P&gt;I found something close in what I'm looking in this post.&lt;/P&gt;&lt;P&gt;Can you help me in figuring out how to extract the Category Name from a Library?&lt;/P&gt;&lt;P&gt;I have this code but I just stuck thinking too much&lt;/P&gt;&lt;P&gt;Thank you in advance if you can help me on this matter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
        
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssetLibrary&lt;/SPAN&gt;
        &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"CategoryName"&lt;/SPAN&gt;)

        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsset&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Asset&lt;/SPAN&gt;
        &lt;SPAN&gt;oAsset&lt;/SPAN&gt; = &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt;.&lt;SPAN&gt;MaterialAssetCategories&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)

        &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oValue&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssetCategory&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsset&lt;/SPAN&gt;
            &lt;SPAN&gt;Debug&lt;/SPAN&gt;.&lt;SPAN&gt;Print&lt;/SPAN&gt;(&lt;SPAN&gt;oValue&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;)

        &lt;SPAN&gt;Next&lt;/SPAN&gt;
		&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 04:17:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/api-accessing-material-asset-values/m-p/8977385#M100549</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-21T04:17:36Z</dc:date>
    </item>
  </channel>
</rss>

