Service alert: BIMcloud SaaS disruption in the US Read more

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

How to get texture file

sxs
Contributor

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

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

Ok,I got it.

Thank you.