<?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: How to assign a texture to an API_MaterialType in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665214#M10447</link>
    <description>&lt;P&gt;Very good question Mats.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jun 2025 11:50:27 GMT</pubDate>
    <dc:creator>Krille-Alster</dc:creator>
    <dc:date>2025-06-10T11:50:27Z</dc:date>
    <item>
      <title>How to assign a texture to an API_MaterialType</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665213#M10446</link>
      <description>&lt;P&gt;I have a program to create a custom&amp;nbsp;&lt;SPAN&gt;API_Attribute&lt;/SPAN&gt; with a specific color. Now i want to assign a texture to it. I have found a list of images using LibraryManager::&lt;SPAN&gt;FindLibParts but when i assign the texture to the API_MaterialType in API_Attribute it is like it is not saved.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_Attribute material;
BNZeroMemory(&amp;amp;material, sizeof(API_Attribute));&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;auto libParts = libraryManager-&amp;gt;FindLibParts(
    [](const ACAPI::Library::LibPart &amp;amp;libPart) {
      return ACAPI::Library::v1::SelectImageLibParts(libPart);
    });

auto libPart = libParts[0];

IO::Location fLoc;
BNZeroMemory(&amp;amp;fLoc, sizeof(IO::Location));
auto tmp = libPart.GetLocation().Unwrap();
memcpy((void *)&amp;amp;fLoc, (void *)&amp;amp;tmp, sizeof(IO::Location));&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then i am assigning it to my API_Attribute like this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;material.material.texture.fileLoc = &amp;amp;fLoc;
memcpy(material.material.texture.texName, libPart.GetName()-&amp;gt;ToCStr(),
        256);
material.material.texture.status = 4096;
material.material.texture.xSize = 250;
material.material.texture.ySize = 250;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Please help me, thanks in advance!&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 12:26:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665213#M10446</guid>
      <dc:creator>mats1</dc:creator>
      <dc:date>2025-06-10T12:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a texture to an API_MaterialType</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665214#M10447</link>
      <description>&lt;P&gt;Very good question Mats.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 11:50:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665214#M10447</guid>
      <dc:creator>Krille-Alster</dc:creator>
      <dc:date>2025-06-10T11:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a texture to an API_MaterialType</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665304#M10448</link>
      <description>&lt;P&gt;I even tried this but it didn't work.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;material.material.texture.fileLoc = new IO::Location(
    "/Applications/Graphisoft/Archicad 28/Archicad "
    "bibliotekspaket/Surface Catalog.libpack/Surface Catalog.lcf/Surface "
    "Catalog/[Timg] Textures/Concrete/Concrete - 02 -opt.jpg");
unsigned char binaryData[] = {66, 101, 116, 111, 110, 103, 32,  45,
                              32, 48,  50,  32,  45,  111, 112, 116};
for (int i = 0; i &amp;lt; 16; i++) {
  material.material.texture.texName[i] = binaryData[i];
}

material.material.texture.ySize = 250;
material.material.texture.xSize = 250;
material.material.texture.withoutExtension = false;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Jun 2025 08:09:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665304#M10448</guid>
      <dc:creator>mats1</dc:creator>
      <dc:date>2025-06-11T08:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a texture to an API_MaterialType</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665324#M10449</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hanginthere.jpg" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/87799iA583B00EB4BEA348/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hanginthere.jpg" alt="hanginthere.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 10:53:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-assign-a-texture-to-an-API-MaterialType/m-p/665324#M10449</guid>
      <dc:creator>Krille-Alster</dc:creator>
      <dc:date>2025-06-11T10:53:28Z</dc:date>
    </item>
  </channel>
</rss>

