cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Begin your Archicad journey with our free learning path - perfect for newcomers and experienced users looking to strenghten their skills.

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

How to get texture file

sxs
Booster

Hi,everyone:

 

	API_Component3D	mat = {};

	mat.header.typeID = API_UmatID;
	mat.header.index = iumat;//iumat is input
	
	//
	auto err = ACAPI_ModelAccess_GetComponent(&mat);
        if(err != NoError)
          return;
        //
	std::string texture_path;
	//
	{
		//
		GS::UniString texture_str;
		if (mat.umat.mater.texture.fileLoc)
		{
			err = mat.umat.mater.texture.fileLoc->ToPath(&texture_str);
			if (err == NoError)
			{
				texture_path = texture_str.ToCStr();
			}

			delete mat.umat.mater.texture.fileLoc;
			mat.umat.mater.texture.fileLoc = nullptr;
		}
		exporter->PrintLog("texture path ");
		exporter->PrintLog(texture_path);
		exporter->PrintLog("\n");
	}

  This is my code for getting texture,but the output texture path does not exist.

 

sxs_0-1749179467518.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi sxs,

 

I think this path means, that the file is in the embedded library of the project. It should be accessible if you use the path with file operations from the ACAPI. So you can e.g. copy it to another place in the filesystem to make it accessible with the Windows File Explorer.

 

Hope that helps,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

View solution in original post

3 REPLIES 3
Solution

Hi sxs,

 

I think this path means, that the file is in the embedded library of the project. It should be accessible if you use the path with file operations from the ACAPI. So you can e.g. copy it to another place in the filesystem to make it accessible with the Windows File Explorer.

 

Hope that helps,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Ok,I got it.

Thank you.