<?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: Add Material information to iProperty. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757482#M68730</link>
    <description>&lt;P&gt;I believe that the material does not exist? And also you are not able to change the material by hand as it is greyed out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note that you can only change material to materials that exist in the material library.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 09:04:05 GMT</pubDate>
    <dc:creator>Jef_E</dc:creator>
    <dc:date>2016-12-19T09:04:05Z</dc:date>
    <item>
      <title>Add Material information to iProperty.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757247#M68728</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have developed my plugin for Inventor which imports my CAD file into Inventor.&lt;BR /&gt;While importing file, I write properties related to part file in&amp;nbsp;&lt;SPAN&gt;iProperties-&amp;gt; Custom. I could do this successfully.&lt;BR /&gt;&lt;/SPAN&gt;Now, I want to write material property. I tried by code below but it doesn't work for 'Material'.&lt;BR /&gt;&lt;BR /&gt;In code below, you can see that I have updated property for 'Material' and 'Engineer' but only 'Engineer' property gets updated not the 'Material'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PropertySets pSets = partDoc.PropertySets;
            foreach (PropertySet set in pSets)
            {
                String name = set.Name;
                if (name.Equals("Design Tracking Properties"))
                {
                    Property prop = set.get_ItemByPropId(20);
                    prop.Value = "My Material String";

                    Property prop1 = set.get_ItemByPropId(42);
                    prop1.Value = "Engineer";
                }
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 05:10:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757247#M68728</guid>
      <dc:creator>Rahul.Khande</dc:creator>
      <dc:date>2016-12-19T05:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add Material information to iProperty.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757482#M68730</link>
      <description>&lt;P&gt;I believe that the material does not exist? And also you are not able to change the material by hand as it is greyed out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note that you can only change material to materials that exist in the material library.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 09:04:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757482#M68730</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2016-12-19T09:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add Material information to iProperty.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757640#M68734</link>
      <description>&lt;P&gt;Thank you for your suggestions.&lt;/P&gt;&lt;PRE&gt;Asset asset = partDoc.Assets.Add(AssetTypeEnum.kAssetTypeMaterial, "Test Material", "Test Material");
partDoc.ActiveMaterial = asset;&lt;/PRE&gt;&lt;P&gt;I tried above code by adding asset material and then using asset as ActiveMaterial but still it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other work around you would suggest ?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 10:36:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6757640#M68734</guid>
      <dc:creator>Rahul.Khande</dc:creator>
      <dc:date>2016-12-19T10:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add Material information to iProperty.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6760282#M68761</link>
      <description>&lt;P&gt;This is straight from my addin and it works for me. This allows you to take an existing material and set it for the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            ' Get the asset that corresponds with the selected material
            Dim oAsset As Asset
            oAsset = EM_AddIn.StandardAddInServer.m_inventorApplication.AssetLibraries.Item("EllimetalMaterialLibrary") _
                .MaterialAssets.Item("&lt;FONT color="#FF0000"&gt;Material name here&lt;/FONT&gt;")

            ' Set the document material
            oDoc.ActiveMaterial = oAsset&lt;/PRE&gt;
&lt;P&gt;Your code seems odd to me to always add a material to use it. Just use a existing one.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 12:30:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6760282#M68761</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2016-12-20T12:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add Material information to iProperty.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6762278#M68789</link>
      <description>&lt;P&gt;Thank you !!&lt;BR /&gt;&lt;BR /&gt;Actually, I need to add a custom material and apply that to part document.&lt;BR /&gt;I never worked on material yet. So don't know how it works. What all I have for my material is only name for e.g. "CustomMaterial". Rest material properties can be default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have few questions :&lt;BR /&gt;1. Can we add custom material ? If yes, how can we ?&lt;BR /&gt;2. How to apply that custom material ?&lt;/P&gt;&lt;P&gt;3. Is there any working C# code snippet ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your snippet as below :&lt;/P&gt;&lt;PRE&gt;ThisApplication = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");

                    &lt;FONT color="#FF6600"&gt;foreach (AssetLibraries lib in ThisApplication.AssetLibraries)&lt;/FONT&gt;
                    {
                        foreach (AssetLibrary assetlib in lib)
                        {
                            string name = assetlib.DisplayName;
                            
                        }
                    }&lt;/PRE&gt;&lt;P&gt;But it's crashing at highlighted code above.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 04:22:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/add-material-information-to-iproperty/m-p/6762278#M68789</guid>
      <dc:creator>Rahul.Khande</dc:creator>
      <dc:date>2016-12-21T04:22:07Z</dc:date>
    </item>
  </channel>
</rss>

