<?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 copy the texture from Embedded Library in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/664979#M10440</link>
    <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/733"&gt;@Ralph Wessel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;        API_Component3D	mat = {};

	mat.header.typeID = API_UmatID;
	mat.header.index = iumat;

	auto err = ACAPI_ModelAccess_GetComponent(&amp;amp;mat);
	if(err != NoError)
          return;   
  
        delete mat.umat.mater.texture.fileLoc;//this is texture location in embedded library
	mat.umat.mater.texture.fileLoc = nullptr;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,I already know the path of the texture in embedded library. Is there a way to directly copy it from the library?&lt;/P&gt;
&lt;P&gt;I found your answer in another post,&amp;nbsp;but that method is not suitable for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-the-path-of-texture/m-p/261656#M2314" target="_blank" rel="noopener"&gt;https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-the-path-of-texture/m-p/261656#M2314&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sxs_0-1749200324480.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/87707iC64EABC958C11E8E/image-dimensions/799x315?v=v2" width="799" height="315" role="button" title="sxs_0-1749200324480.png" alt="sxs_0-1749200324480.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jun 2025 17:48:04 GMT</pubDate>
    <dc:creator>sxs</dc:creator>
    <dc:date>2025-06-06T17:48:04Z</dc:date>
    <item>
      <title>How to copy the texture from Embedded Library</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/664964#M10437</link>
      <description>&lt;P&gt;Hi,everyone:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sxs_0-1749195496024.png" style="width: 720px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/87704i0ABF2D4522CB8316/image-dimensions/720x522?v=v2" width="720" height="522" role="button" title="sxs_0-1749195496024.png" alt="sxs_0-1749195496024.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I need these pictures, how to copy them from Embedded Library?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2025 17:47:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/664964#M10437</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-06-06T17:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy the texture from Embedded Library</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/664979#M10440</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/733"&gt;@Ralph Wessel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;        API_Component3D	mat = {};

	mat.header.typeID = API_UmatID;
	mat.header.index = iumat;

	auto err = ACAPI_ModelAccess_GetComponent(&amp;amp;mat);
	if(err != NoError)
          return;   
  
        delete mat.umat.mater.texture.fileLoc;//this is texture location in embedded library
	mat.umat.mater.texture.fileLoc = nullptr;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,I already know the path of the texture in embedded library. Is there a way to directly copy it from the library?&lt;/P&gt;
&lt;P&gt;I found your answer in another post,&amp;nbsp;but that method is not suitable for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-the-path-of-texture/m-p/261656#M2314" target="_blank" rel="noopener"&gt;https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-the-path-of-texture/m-p/261656#M2314&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sxs_0-1749200324480.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/87707iC64EABC958C11E8E/image-dimensions/799x315?v=v2" width="799" height="315" role="button" title="sxs_0-1749200324480.png" alt="sxs_0-1749200324480.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2025 17:48:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/664979#M10440</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-06-06T17:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy the texture from Embedded Library</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/665139#M10445</link>
      <description>&lt;LI-CODE lang="cpp"&gt;void DuplicateTexture()
{
	ModelerAPI::Model model;
	auto err = ACAPI_Sight_GetSelectedSightModel(model);

	if (err != NoError)
		return;
	
	GS::Int32 texture_count = model.GetTextureCount();
	for (GS::Int32 i = 0; i &amp;lt; texture_count; i++)
	{
		if (!model.IsTextureUsed(ModelerAPI::AttributeIndex(ModelerAPI::AttributeIndex::TextureIndex, i)))
			continue;

		ModelerAPI::Texture texture;
		model.GetTexture(ModelerAPI::AttributeIndex(ModelerAPI::AttributeIndex::TextureIndex, i), &amp;amp;texture);
		//
		if (texture.GetPixelType() != ModelerAPI::Texture::ARGBPixelType)
			continue;
		//
		Int32 pixel_x_size = texture.GetPixelMapXSize();
		Int32 pixel_y_size = texture.GetPixelMapYSize();
		Int32 pixel_size = texture.GetPixelMapSize();
		//
		ModelerAPI::Texture::ARGBPixel* pixel = new ModelerAPI::Texture::ARGBPixel[pixel_size];
		texture.GetPixelMap(pixel);

		//save bitmap
		{
			IO::Location fileLocation;
			IO::fileSystem.GetSpecialLocation(IO::FileSystem::TemporaryFolder, &amp;amp;fileLocation);
			fileLocation.AppendToLocal(IO::Name(texture.GetName()+".jpg"));
			//
			std::string filePath;
			GS::UniString filePath_uni;
			fileLocation.ToPath(&amp;amp;filePath_uni);
			filePath = filePath_uni.ToCStr();
			//
			int ow = pixel_x_size;
			int oh = pixel_y_size;
			int n = 4;
			unsigned char* odata = (unsigned char*)malloc(ow * oh * n);

			for (size_t w = 0; w &amp;lt; pixel_x_size; w++)
			{
				for (size_t h = 0; h &amp;lt; pixel_y_size; h++)
				{
					odata[(w * pixel_x_size + h) * n]	= pixel[w * pixel_x_size + h].red;
					odata[(w * pixel_x_size + h) * n+1] = pixel[w * pixel_x_size + h].green;
					odata[(w * pixel_x_size + h) * n+2] = pixel[w * pixel_x_size + h].blue;
					odata[(w * pixel_x_size + h) * n+3] = pixel[w * pixel_x_size + h].alpha;
				}
			}

			// write jpg
			stbi_write_jpg(filePath.c_str(), ow, oh, n, odata, 100);
			stbi_image_free(odata);
		}
		
		delete[] pixel;
	}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Jun 2025 10:08:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-the-texture-from-Embedded-Library/m-p/665139#M10445</guid>
      <dc:creator>sxs</dc:creator>
      <dc:date>2025-06-09T10:08:29Z</dc:date>
    </item>
  </channel>
</rss>

