[Rhino6] FileImportPlugIn.ReadFile results in empty document

I have a strange thing here: we have multiple file import plug-ins and one of them is giving problems. I traced it to a difference in OnNewDocument and OnBeginOpenDocument events that are raised. The problematic plug-in first gets an OnBeginOpenDocument for a document with a certain runtime serial number. This document is also used in the import routines and I put all the geometry in that document, layers and all. After the import is completed, an OnNewDocument is raised where the serial number is increased by one compared to the document I got for the import.
Other file import plug-ins do NOT raise an OnNewDocument event and there the importing is successful.

@dale Any idea why this might happen? I have no clue where to start.

PS. all file import plug-ins work correctly in Rhino 5.

Ok, I have since traced this weird problem to the fact that no geometry was showing after the file loaded because all the geometry is in layers whose visibility is turned OFF by default on load. If I set one of the layers visible to show any piece of geometry during the file load processing, the OnNewDocument is not raised and the loading of the file is successful. Bug? Me thinks so :slight_smile:

Possibly related to

Hi @menno,

It is hard for me to understand what is going on. Can you provide me some way of repeating what you are seeing?

Perhaps. But we have dozens of file import plug-ins that don’t exhibit this.

Also, I don’t understand why your file import plug-in is watching for document events. All it should really do is import stuff when it’s ReadFile member is called.

Perhaps I’m confused…

– Dale

I have tried to make a repro of this problem, but so far I have failed.

Just to clear things up: another plug-in is watching for document events; the file import plug-in is doing what it is supposed to do (import stuff).