Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
This really self explaing exception is thrown when i try to do an Application.OpenandActivateDocument, the second time (when i have no active documents it works),
The point is the event i'm trying to do this from, is: application.Idling ...
I really expected to be allowed from there do do that.
Solved! Go to Solution.
Solved by arnostlobel. Go to Solution.
Solved by arnostlobel. Go to Solution.
Dear Luigi,
Does this help in any way?
http://thebuildingcoder.typepad.com/blog/2012/12/closing-the-active-document.html
Cheers,
Jeremy
Hello Jeremy i went through your blog thorougly before posting and that article has been read.
I tried to close the document but i get another error, i think process start can help, but i dislike that option since i don't get any reference to the document ... (maybe i can get throug open documents and find the one with that filename ...
First cal works from second on it doesn't
I made a solution to investigate the problem with the comunity:
https://github.com/LiFeleSs/RevitOpenAndActivateDuringIdle
ALSO i can't access this forum using google chrome anymore
I've implemented the process start workaround and found a way to realiably get the opened document, unfortunately not the UiDocument.
I still think this should be considered a bug in revit API...
Naturally, I have to step in, for I do not like Jeremyās suggested solution all that much (and he knows it š
Although opening a new active document is not allowed from event handlers when there already is a document open in Revit, there may be an alternative. I believe we have implemented External Events so they do not share this restriction with events. Thus, for the user who otherwise used the Idling event, switching to an External Event could be a suitable solution. And it is both supported and safe.
Thank you
I am not sure what your last comment means, but, yes, I guess.
If you are referring to finding some help for using External Event, I recommend searching through the samples in the SDK. There is at least one.
Oh that is a bad habit from when i used to just write on forums for fun, not for relevant things, putting an action between asterisks means i'm actually doing that actions ...
I've found an axample about that on Jeremy blog, my source for inspiration (thanks Jeremy) and updated my solution to not use the idling event but to raise my shiny new external event, and it works like a charm!
I didn't realized external events purpose, i thougth it was a way to leverage idling handling ...
So! thanks for pointing me in the right direction!
Arnost there is some other aspects of the API i'd like to discuss (like button availability) is this the right place ?
P.s. i've updated the git hub repository, if you want to include it in the samples ...
Dear Luigi,
Congratulations on resolving your problem, and thank you for sharing the result.
I would love to share your sample with the rest of the Revit add-in developer community...
Could you be a bit more specific about what it actually demonstrates and how, now that all the issues you were encountering are resolved and you are clear about the use of external events?
Thank you!
Cheers,
Jeremy
Helllo Luigi,
I suggest you take Jeremy's offer for possibly sharing your sample on his blog. That is the right platform for showing custom samples. Here at Revit R&D we can only use SDK samples we develop ourselves, becasue we need to include them as part of our builds to ensure their build-ability (if that is a word.)
As for your question, this forum is totally the right place for your posting questions about button ability etc., assuming your question is about the progamming aspect of such a task. Naturally, not all questions get always answered - after all this is still but a peer-to-peer forum. Most questions do get aswered, however, and we (at Revit R&D) do pay atttention to all posts even when we do not directly participate.
Thank you
Very good! you can share my example as long as you want, in fact is publicily available on gitHub.
The last version of it demostrate how using an ExternalEvent solve getting the "Switching active documents is not allowed during API event handling" exception trying to open a document (or more than one) during a call from a command or an event such the idling.
And also it demostrate how to declare and call the external event.
the previous versions could be also quite usefull to some revit users because it shows how to get a task executed during the idling event. but need some arrangement because it was built to demonstrate the other issue.
Can't find what you're looking for? Ask the community or share your knowledge.