Thanks for replying, and sorry, I maybe should have start a new thread…
I wrote a command to export referenced geometries from worksession based on the ‘Export’ command (basically merging referenced file together).
It is perfomed as @pascal’s suggestion (please see original thread here):
first the layer structure is created in the current document (one root layer per referenced Rhino file)
then the referenced geometries are duplicated in the current document with original attributes and exported
finally, running the command ‘Undo’ deletes the newly created geometries and layers and reset the document to previous state.
It is working fine, but unfortunately the last step have to be executed manually and I was wondering if there is any way to trigger the Undo right after the export command is done.
I also want to understand why the EndCommand event gets triggered although the command is still active.
Following alternatives come in my mind:
keep track of all newly created objects (geometries + layers) and delete them after the export
perform the Undo once Rhino gets to Idle mode
rethink the whole export thing and start messing up with Rhino.FileIO
Which one seems the more reasonable to you?
Thanks in advance.