BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

Issue with getting the opened project's name

Anonymous
Not applicable
Hello,

I'm trying to get the current opened project's name. Here is my code, which should work according to the documentation, but it doesn't seem to work:
GSErrCode            err;
    API_ProjectInfo info;
    
    err = ACAPI_Environment (APIEnv_ProjectID, &info, nullptr);
    if (err != NoError){
        ErrorBeep ("APIEnv_ProjectID", err);
    }
    else{
        WriteReport("project path is %s", info.projectPath); // returns null always
        WriteReport("project name is %s", info.projectName); // returns null always
    }
Is there any other specific thing that should be done in order to make this work? Is the project name something different than the filename of the pln?

P.S. I am opening an already saved project.

Any help will be appreciated,
Julian
2 REPLIES 2
Anonymous
Not applicable
I have tried printing the untitled property:
WriteReport("project untitled is %s",(info.untitled)?"true":"false"); // returns false always 
Why it says that the file is not saved? I'm opening an already saved project.
Mihaly Palenik
Graphisoft
Graphisoft
Hello,

Unfortunately this is a bug. We will try to do the best to fix it as soon as possible.

Best,
Mihály
Learn and get certified!