Can't save doc opened through OpenDocumentFile method

Hi. GHPython throws the following exception when I try to programatically save documents I’m tinkering with:

Runtime error (InvalidOperationException): Saving is not allowed in the current application mode.

I am suspecting it’s not really a bug and has more to do with the GH window being open at the time of executing the script, since I was able to get it working just by opening the GHPython script window, then clicking outside the GH Window so only the script window is floating but GH is no longer visible (usually bothering behavior, but looks like it’s helping here), then running the script by clicking either “Test” or “OK”. I can submit the code if necessary.

Any plans to make saving and similar actions compatible with running the GH window at the same time? It’s not such a big deal right now since I can just make it work the way I described, but figured this behavior might be worth a look in the future.

Also, it’s such a shame that the Revit API itself seems to be limited regarding automated link creation (Group > Link conversion, or Shared Site setup and modification). I’m trying to develop a script which will create specific named locations in linked documents according to GH Planes in order to keep tidied-up information of their position and angle deviation to True North, but it like there’s some API functionality I’m missing or simply haven’t found yet. Not RiR’s problem, of course, but I just thought I could say it out loud. Will probably submit the idea if it’s not implemented in the API’s next release.

The .Save() method currently does not work inside the Grasshopper since the definition is updated by an event handler, triggered from Revit and thus document is marked as Editable and can not be saved. I have filed an issue for this:

Regarding your question about project locations, they are represented by DB.ProjectLocation which is a subclass of DB.Element. I think you can use the DB.ElementTransformUtils.CopyElements() method to copy the desired project location to another document.

Hi again!

It seems like the latest RiR update, by running in a non-modal UI, won’t let me do the trick I previously mentioned anymore. I never thought I would find myself complaining about it, but here I am… any idea on how to make commands like Save compatible with this environment? I guess it should be possible to do so, since I suspect the Family.New component is able to automate family document creation, modification and saving on the go, but I don’t really understand how (I am considering opening a different thread in order to ask about that).

Anyway, I am always grateful for the hard work put into RiR development. Keep it up!