Choose your top Archicad wishes!

Read more
Archicad C++ API
About Archicad add-on development using the C++ API.

Performing object manipulation automatically when saving

Rob C
Participant

Hi all,

 

I've been working on trying to change GDL object parameters automatically when the user saves the project file.

 

static GSErrCode __ACENV_CALL ProjectEventHandlerProc(API_NotifyEventID notifID, Int32 param) {
	switch (notifID) {
	case APINotify_PreSave: {
		ACAPI_CallUndoableCommand("Hide", [&]() -> GSErrCode {
			HideStuff(parameter, 0);
			return NoError; });
		break;
	}
	case APINotify_Save: {
		ACAPI_CallUndoableCommand("Hide", [&]() -> GSErrCode {
			HideStuff(parameter, 1);
			return NoError; });
		break;
	}
	break;
	}
	return NoError;
}

 

The object has a parameter to be hidden when the value is False and shown when it's True. Currently the function works fine when called during a PreSave, but ArchiCAD crashes when I try to call it during a Save. Is it possible to call undoable commands during a save function?

 

If not, is it possible within the API to just undo the previous command as if a user had clicked undo?

 

Thanks

2 REPLIES 2
Akos Nagy
Graphisoft
Graphisoft

Hi Rob,

Could you please give us a bug report ID related to this crash?

The definition of the HideStuff function would be helpful. Or the list of the API functions you call inside it.
The minimum steps to reproduce this crash with a new plan also would be a big help.

Regards,
Ákos

Ralph Wessel
Mentor

Have you been able to debug into the add-on? If so, where did the crash happen and what was the stack trace leading to it?

Ralph Wessel BArch

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!