License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

Automatic Link library folder when loading add-on? How to

Anonymous
Not applicable
I want to auto link library when I load add-on

I found this code
GSErrCode __ACENV_CALL	Initialize (void)
{

	GSErrCode err = ACAPI_Install_MenuHandler (32500, MenuCommandHandler);
	if (err != NoError)
		DBPrintf ("LibPart Test:: Initialize() ACAPI_Install_MenuHandler failed\n");
	IO::Location rab("E:/ArchiCAD Phase/Present ArchiCAD/Phase_9 16 พ.ย. - 31 ธ.ค. 53/All HRC OK/HRC_Object/");
	ACAPI_Environment (APIEnv_AddLibrariesID, reinterpret_cast<void *>(&rab), NULL);

	return NoError;
}		// Initialize


OK it's load all gsm file to my project.

So I can use
CHANSI2Unicode("เข็มหกเหลี่ยมกลวง 15cm ยาว 3 เมตร.gsm", strlen("เข็มหกเหลี่ยมกลวง 15cm ยาว 3 เมตร.gsm"), part.file_UName, API_UniLongNameLen);  
	if((err = ACAPI_LibPart_Search(&part, false)) == NoError)   
	{ ... }
And it return no error

But before I run ACAPI_LibPart_Search(&part, false) function I look at Library Part Manager

It's don't show Folder That I link correctly below
8 REPLIES 8
Anonymous
Not applicable
You can see in this picture there is no library link.

(It's have only default ArchiCAD Library)
Anonymous
Not applicable
But after Libpart Function It's show!!
Anonymous
Not applicable
Do you have any idea? to fix code to work correctly at picture 2

That I don't want to run Libpart Function before.

Thank you very much
Ralph Wessel
Mentor
Paodekcal wrote:
Do you have any idea? to fix code to work correctly at picture 2 That I don't want to run Libpart Function before.
I don't fully understand what you are trying to do. I assume you want to be sure a specific library is loaded when your add-on carries out its primary function. I have 2 suggestions:
  • 1. Check whether the library is already loaded before you try to load it again. It is possible to load the same library twice, and ArchiCAD will complain of duplicate objects.

    2. Don't change the loaded libraries within Initialize. Depending on the add-on type, it may be called before a project has been opened. I would wait until the library is actually required, e.g. the menu has been selected, before checking or changing the loaded libraries.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
I want to "Auto Link my folder library every time I create new project or open ArchiCAD"

So the users don't have to link library folder by themself.

Like the roofmaker or truss maker
Ralph Wessel
Mentor
Paodekcal wrote:
I want to "Auto Link my folder library every time I create new project or open ArchiCAD"
So the users don't have to link library folder by themself.
Like the roofmaker or truss maker
OK. I suggest using ACAPI_Notify_CatchProjectEvent so you can check if the necessary libraries have been loaded only when a project is opened or created.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
I found undirect solution.

I create new default Archicad 14 template.

It's easier
Anonymous
Not applicable
it may be called before a project has been opened.
Thank you.

I think I can change Default Template is easier.

I just realize from you say.

Thanks again