I'm pretty sure you can't process undoable actions during the callback for a project event notification. The right approach would be to ask ARCHICAD to notify you when it's appropriate to action this process – I suggest that you take a look at
ACAPI_Command_CallFromEventLoop
Ralph Wessel BArch
Software Engineer Speckle Systems