RhinoPageView dissapear when using headless docs

Hi all!

I’m creating a Rhino Plugin and lately I’ve been facing this issue several times, trying to get a workaround at the moment… When I open a headless doc using a template with layouts, they disappear. In the position where the layout should be, there is another RhinoView (usually Top I remember).

In my base file I have different objects I want to save in separate files and automate the layout generation (I do have hundreds of stone pieces that need each of them one specific drawing). My steps are the following:

  • Select all objects in my base file
  • For each one of them:
    • Create a headless doc using my template (with one layout + details, annotations, etc)
    • Adding the object to my new doc
    • SavingAs my new doc
    • Disposing the doc

Anyone else with this same issue? I do think it might be a bug with rhinopageview? Is it possible to report it and have it fixed?

PD. I’ve also tried Open and Save methods in the headless mode to check if the problem was related to Create and SaveAs, still same issue.

Thanks!

Hi @Oriol,

Some sample code along with a test file that doesn’t work for you would help us diagnose the issue.

Thanks,

– Dale

Hola @dale ,

Thanks for your answer.
Attached you have the files I’m using.
I do have to redact the info as per an NDA, hence the basic geometry. But the purpose is the same.

Here is the sample code of what I’m trying to do:

var geos = RhinoDocument.Objects.Select(x => x.Geometry).ToList();

for (int i = 0; i < geos.Count; i++)
{
  Print(i.ToString());

  var newDoc = RhinoDoc.CreateHeadless(path);
  var newPath = "Obj" + i.ToString() + ".3dm";
  var newGuid = newDoc.Objects.Add(geos[i]);
  var success = newDoc.SaveAs(newPath);
  newDoc.Dispose();
}

As you can see, I have an external final as a template (MyTemplateFile.3dm) and then export the three elements from my main file (MainFileToExportObjects.3dm) to it. If you run the GH definition, you can see that the original layout I previously defined disappears.

Let me know if you need anything else from my side.

Thanks!

ObjectExport.gh (4.0 KB)
MainFileToExportObjects.3dm (43.1 KB)
MyTemplateFile.3dm (39.0 KB)

Hi @Oriol,

I am able to reproduce the issue, and I have logged a bug report.

https://mcneel.myjetbrains.com/youtrack/issue/RH-74835

I can see that the “page” view is read from the 3dm file. But because Rhino never displays the documetn in UI, the actual page view is never created - Rhino tends to do things “just in time.”

– Dale

Hola Dale,

Thanks for your help.
Happy to contribute :slight_smile: