Activate Newly Created Document

Activate Newly Created Document

vitalij.marcukov2BP2F
Advocate Advocate
321 Views
2 Replies
Message 1 of 3

Activate Newly Created Document

vitalij.marcukov2BP2F
Advocate
Advocate

I am trying to create a pushbutton which activates NewProjectDocument(template_file) method which creates Revit project with company's template which is stored in central location. The problem is, as far as I understand, that new project is in memory and I cannot see it in Revit UI. Does anyone know how to activate it? I saw someone offered a solution with ShowElements(), but it does not work for me. 

0 Likes
322 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @vitalij.marcukov2BP2F ,


If ShowElements() is not working for you, could you please try the following suggestion?

 

  • Create the document from the template.
  • Save it temporarily.
  • Close the in-memory version.
  • Re-open it using UIApplication.OpenAndActivateDocument().

    We already have an API wishlist item (REVIT-183179) submitted to the engineering team, requesting a new API to activate a document using a DB document

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

vitalij.marcukov2BP2F
Advocate
Advocate

@naveen.kumar.t , thank you for the reply. 

 

The idea was to create a document from template without saving (to avoid all those cleanups), enable worksharing, create company's worksets and all with a click of a button.  And let user save manually save to cloud.

When I use ShowElements(x), 2 things happen: a message appears "there is no open view that shows any of the highlighted elements.." which I don't know how to hide for Revit users not to see it in the first place and also the worksets toolbar is not shown which might confuse Revit users. 

For now, as per your suggestion, I'll try to save it temporarily so to say. 

0 Likes