<?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 Export material hatch pattern into raster image in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/export-material-hatch-pattern-into-raster-image/m-p/7560304#M54597</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to export the hatch pattern of a material into an image (*.png, *.jpg...). Since the hatch pattern is vector and the image is raster,&amp;nbsp;is there any API to do that? Here is my&amp;nbsp;code snippet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Material material = document.GetElement(materialId) as Material;
var fillPatternElement = document.GetElement(material.SurfacePatternId) as FillPatternElement;
if (fillPatternElement != null)
{
    FillPattern fillPattern = fillPatternElement.GetFillPattern();
    IList&amp;lt;FillGrid&amp;gt; fillGrids = fillPattern.GetFillGrids();
    foreach (FillGrid fillGrid in fillGrids)
    {
        // Do something to generate image texture from hatch pattern
    }
}&lt;/PRE&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2017 22:44:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-20T22:44:36Z</dc:date>
    <item>
      <title>Export material hatch pattern into raster image</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/export-material-hatch-pattern-into-raster-image/m-p/7560304#M54597</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to export the hatch pattern of a material into an image (*.png, *.jpg...). Since the hatch pattern is vector and the image is raster,&amp;nbsp;is there any API to do that? Here is my&amp;nbsp;code snippet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Material material = document.GetElement(materialId) as Material;
var fillPatternElement = document.GetElement(material.SurfacePatternId) as FillPatternElement;
if (fillPatternElement != null)
{
    FillPattern fillPattern = fillPatternElement.GetFillPattern();
    IList&amp;lt;FillGrid&amp;gt; fillGrids = fillPattern.GetFillGrids();
    foreach (FillGrid fillGrid in fillGrids)
    {
        // Do something to generate image texture from hatch pattern
    }
}&lt;/PRE&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 22:44:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/export-material-hatch-pattern-into-raster-image/m-p/7560304#M54597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-20T22:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Export material hatch pattern into raster image</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/export-material-hatch-pattern-into-raster-image/m-p/7560715#M54598</link>
      <description>&lt;P&gt;Dear khoa.ho,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to Jeremy's blog&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2015/11/fill-pattern-viewer-fix-and-add-materials-2016.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2015/11/fill-pattern-viewer-fix-and-add-materials-2016.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also get the complete codes there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pay attention to method "DrawFillPattern", it can export the fillpattern to bitmap format, then you can save bitmap to other format(such as .jpg,.png) as you wish.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 03:51:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/export-material-hatch-pattern-into-raster-image/m-p/7560715#M54598</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2017-11-21T03:51:46Z</dc:date>
    </item>
  </channel>
</rss>

