<?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 回复： How to add materials to document in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11575613#M42966</link>
    <description>&lt;P&gt;I don't think much of that dialogue is exposed to the API in terms of importing materials from the external library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the easiest way by far to import materials is to load a family containing them and then delete the family.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Nov 2022 13:01:55 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2022-11-24T13:01:55Z</dc:date>
    <item>
      <title>How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8737567#M42961</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi all, How can I implement the arrow (adds materials to document) as circled in the attached file using API, and then I can use the material in my model. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 15:12:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8737567#M42961</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-17T15:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8737890#M42962</link>
      <description>&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;P&gt;You can get material from active Revit document with FilteredElementCollector and Linq.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this code snippet, I showed how to get a material from the document and apply this material to a wall layer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// You can get any material in the document with just material name
Material material = new FilteredElementCollector(doc).OfClass(typeof(Material)).Cast&amp;lt;Material&amp;gt;().Where(q =&amp;gt; q.Name == "Material Name").First();

// Choose a wall from document
Wall wall = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as Wall;
// Get wall layers
IList&amp;lt;CompoundStructureLayer&amp;gt; layers = wall.WallType.GetCompoundStructure().GetLayers();

foreach (var layer in layers)
{
    // Choose which layer you want to change
    if (layer.Function == MaterialFunctionAssignment.Finish2)
    {
        // Set layer material
        layer.MaterialId = material.Id;
        // Set Layer thickness
        layer.Width = 5; //Feet
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps,&lt;/P&gt;
&lt;P&gt;Recep.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 17:07:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8737890#M42962</guid>
      <dc:creator>recepagah12</dc:creator>
      <dc:date>2019-04-17T17:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8738690#M42963</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for your reply. I might not state my question clearly. From the Revit UI, Manage -&amp;gt; Settings -&amp;gt; Materials, the upper panel of the pop-up window shows all the materials which can be used in the current project document. However, I want to use the material listed in the bottom panel, for example, “Concrete C45/55”. I have to press the arrow button as shown in the attached file to import “Concrete C45/55” to the current document, and then I can use it in my model. What I want is to import &amp;nbsp;“Concrete C45/55” through API.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I tried the method you suggested:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Material material = new FilteredElementCollector(doc).OfClass(typeof(Material)).Cast&amp;lt;Material&amp;gt;().Where(q =&amp;gt; q.Name == "Material Name").First();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But it can only get the materials in the upper panel.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 00:23:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8738690#M42963</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-18T00:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8747203#M42964</link>
      <description>&lt;P&gt;&lt;SPAN&gt;There should be API methods to accomplish this. But I could not find the solution. Could someone please help me on this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 11:18:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/8747203#M42964</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-23T11:18:23Z</dc:date>
    </item>
    <item>
      <title>回复： How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11574671#M42965</link>
      <description>&lt;P&gt;I have encountered the same problem. Do you have a solution？&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 03:42:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11574671#M42965</guid>
      <dc:creator>850550146</dc:creator>
      <dc:date>2022-11-24T03:42:44Z</dc:date>
    </item>
    <item>
      <title>回复： How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11575613#M42966</link>
      <description>&lt;P&gt;I don't think much of that dialogue is exposed to the API in terms of importing materials from the external library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the easiest way by far to import materials is to load a family containing them and then delete the family.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 13:01:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11575613#M42966</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-11-24T13:01:55Z</dc:date>
    </item>
    <item>
      <title>回复： How to add materials to document</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11579195#M42967</link>
      <description>&lt;P&gt;This is also a way, thank you&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2022 10:52:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-add-materials-to-document/m-p/11579195#M42967</guid>
      <dc:creator>850550146</dc:creator>
      <dc:date>2022-11-26T10:52:07Z</dc:date>
    </item>
  </channel>
</rss>

