Index: src/event.c =================================================================== --- src/event.c (revision 29101) +++ src/event.c (revision 29102) @@ -73,7 +73,9 @@ "pcbev_drc_run", "pcbev_dad_new_dialog", "pcbev_dad_new_geo", - "pcbev_net_indicate_short" + "pcbev_net_indicate_short", + "pcbev_export_session_begin", + "pcbev_export_session_end" }; typedef struct event_s event_t; Index: src/event.h =================================================================== --- src/event.h (revision 29101) +++ src/event.h (revision 29102) @@ -83,6 +83,9 @@ PCB_EVENT_NET_INDICATE_SHORT, /* called by core to get a shortcircuit indicated (e.g. by mincut). Args: (pcb_net_t *net, pcb_any_obj_t *offending_term, pcb_net_t *offending_net, int *handled, int *cancel) - if *handled is non-zero, the short is already indicated; if *cancel is non-zero the whole process is cancelled, no more advanced short checking should take place in this session */ + PCB_EVENT_EXPORT_SESSION_BEGIN, /* called before an export session (e.g. CAM script execution) starts; should not be nested; there's no guarantee that options are parsed before or after this event */ + PCB_EVENT_EXPORT_SESSION_END, /* called after an export session (e.g. CAM script execution) ends */ + PCB_EVENT_last /* not a real event */ } pcb_event_id_t; Index: src/file_act.c =================================================================== --- src/file_act.c (revision 29101) +++ src/file_act.c (revision 29102) @@ -510,10 +510,12 @@ argc-=2; /* call the exporter */ + pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_EXPORT_SESSION_BEGIN, NULL); a = args; a++; pcb_exporter->parse_arguments(pcb_exporter, &argc, &a); pcb_exporter->do_export(pcb_exporter, NULL); + pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_EXPORT_SESSION_END, NULL); pcb_exporter = NULL; PCB_ACT_IRES(0); Index: src/hid_init.c =================================================================== --- src/hid_init.c (revision 29101) +++ src/hid_init.c (revision 29102) @@ -667,7 +667,9 @@ pcb_message(PCB_MSG_WARNING, "Exporting empty board (nothing loaded or drawn).\n"); if (pcb_gui->set_hidlib != NULL) pcb_gui->set_hidlib(pcb_gui, hidlib); + pcb_event(hidlib, PCB_EVENT_EXPORT_SESSION_BEGIN, NULL); pcb_gui->do_export(pcb_gui, 0); + pcb_event(hidlib, PCB_EVENT_EXPORT_SESSION_END, NULL); pcbhl_log_print_uninit_errs("Exporting"); return 1; }