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

Capture the change (addition/deletion/rename) of Story Settings

dushyant
Booster

Hi

Is there any notification of the change in Story settings that can be captured by an add-on?

I tried:

ACAPI_Notify_CatchProjectEvent (API_AllProjectNotificationMask, NotificationHandler);

 and tried capturing the notification ID "APINotify_ChangeFloor"  but that doesn't trigger upon adding or removing a story in the project from 'Story settings'.

How can I capture the addition/deletion/rename of stories in the project?

 

Thanks.

7 REPLIES 7

bschwb
Booster

I haven't tried it myself, but I saw something in the Documentation of APIProjectEventHandlerProc. It seems like you can catch "APINotify_ChangeProjectDB" and if the "param" parameter of your handler callback has value 1 it means that the floors changed.

 

Bernd Schwarzenbacher
Archicad Add-On Developer
AC 24-25, VS 2019

Get free Add-Ons at www.bschwb.com/add-ons

I tried that, but adding/deleting floors does not pass notifID as "APINotify_ChangeProjectDB".

Hm.. that's weird. I tried it now also and it seems to work for me.

Here are the relevant code sections I used:

static GSErrCode __ACENV_CALL ProjectEventHandlerProc (API_NotifyEventID notifID, Int32 param)
{
	switch (notifID) {
		case APINotify_ChangeProjectDB:
		{
			DG::InformationAlert ("Change project DB", "param: " + GS::ValueToUniString (param), "OK");
			break;
		}
		default:	break;
	}
	return NoError;
}

GSErrCode __ACENV_CALL Initialize (void)
{
	GSErrCode err = NoError;
	err = ACAPI_Notify_CatchProjectEvent (APINotify_ChangeProjectDB,
		ProjectEventHandlerProc);
	return err;
}

 
All three actions: Remove/Add/Rename Floor trigger the "APINotify_ChangeProjectDB" with "param = 1" for me.

Bernd Schwarzenbacher
Archicad Add-On Developer
AC 24-25, VS 2019

Get free Add-Ons at www.bschwb.com/add-ons

Where is ProjectEventHandlerProc being called from?

EDIT: Sorry, I didn't scroll your code 🙂

 

So this is what's happening:

I was passing API_AllProjectNotificationMask to the callback, assuming that it would capture _all_ the events, as I needed to capture another event, like so:

ACAPI_Notify_CatchProjectEvent (API_AllProjectNotificationMask, NotificationHandler);

But it seems it does not.

I tried passing APINotify_ChangeProjectDB directly and it worked!

That's strange because the example on https://archicadapi.graphisoft.com/documentation/apiprojecteventhandlerproc  shows the case for APINotify_ChangeProjectDB ...   Don't know what I'm missing here.

 

Anyway, now I have created separate calls for each event.

 

Thanks Bernd!

 

 

Glad it works now for you too 🙂

 

Yes "API_AllProjectNotificationMask" doesn't include "APINotify_ChangeProjectDB". You can check the values of the mask in the AC API header "APIdefs_Callback.h". Here's the relevant part:

#define	API_AllProjectNotificationMask	0x00000FFF				// APINotify_New..APINotify_ConvertGuid
#define	API_AllTeamWorkNotificationMask	0x00018000				// APINotify_Share..APINotify_ChangeWorkspace
#define	API_AllChangeNotificationMask	0x033C0000				// APINotify_ChangeProjectDB..APINotify_ChangeFloor

#define	API_AllNotificationMask			0xFFFFFFFF

The example you linked probably uses "API_AllNotificationMask". You can also select multiple notifications by combining them with "OR" like this:

APINotify_ChangeProjectDB | APINotify_SomeOtherMask | ....

 

Bernd Schwarzenbacher
Archicad Add-On Developer
AC 24-25, VS 2019

Get free Add-Ons at www.bschwb.com/add-ons

I gave a different ref. link last time, which doesn't have the function call. Check out the example here: https://archicadapi.graphisoft.com/documentation/acapi_notify_catchprojectevent?s=ACAPI_Notify_Catch...

It passes API_AllProjectNotificationMask , and shows the case for APINotify_ChangeProjectDB.

 


@bschwb wrote:

You can also select multiple notifications by combining them with "OR"

That's interesting. Thanks! 👍

You are right. That example is very misleading!

Bernd Schwarzenbacher
Archicad Add-On Developer
AC 24-25, VS 2019

Get free Add-Ons at www.bschwb.com/add-ons

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!