Allow Load Into Existing Session

Allow Load Into Existing Session

RPTHOMAS108
Mentor Mentor
1,184 Views
7 Replies
Message 1 of 8

Allow Load Into Existing Session

RPTHOMAS108
Mentor
Mentor

Is the below the correct form for this:

 

<AllowLoadIntoExistingSession>false</AllowLoadIntoExistingSession>

 

Or is it meant to be an attribute to xml AddIn element? Does not seem to work i.e. I get an exception message related to registering custom failures when the manifest is introduced mid session.

 

Also I tried the AddInManifestUtility (Autodesk.RevitAddins namespace):

By setting RevitAddinItem.AllowloadingIntoExistingSession = True & False, but neither come through in the resulting manifest file.

 

This is the best source I found but it gives no example

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2014/EN...

 

Would be good if whole schema was published in the RevitAPI.chm file.

0 Likes
Accepted solutions (1)
1,185 Views
7 Replies
Replies (7)
Message 2 of 8

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Richard,

 

Here is the best info I was able to dig up on the fly:

 

http://thebuildingcoder.typepad.com/blog/2013/04/whats-new-in-the-revit-2014-api.html

 

What's New in the Revit 2014 API

 

Automatic load of add-ins without restarting Revit

 

Revit now automatically loads addins from newly added .addin manifest files without restarting Revit.

 

After placing a new .addin manifest file into one of the dedicated addins folders, the running Revit session will attempt to load the corresponding addin. Loaded ExternalCommands will be added to the External Tools pulldown menu. ExternalApplication and ExternalDBApplication OnStartup methods will be executed upon loading. An addin's installer may leverage this feature – but it must do so by creating the new .addin file at the end of installation to the dedicated Revit addin folders (the installer must ensure that the addin's assembly is already deployed to the target machine and the assembly path can be resolved in the add-in manifest file).

 

Add-ins may decline the ability for Revit to load the .addin in the middle of a session. To decline this options, add an tag (set to “NO”) in the add-in manifest file.

 

Note that when Revit starts an add-in in the middle of the session, some add-in logic may not function identically because of the different interactions with the session. Specifically:

 

  • If the application's goal is to prevent something from happening, the application may not be able to handle the fact that this activity has already happened in the existing session.
  • If the application's goal is to manage external information in synch with documents loaded in the session, the application may not be able to handle documents that were loaded before the application started.
  • If the application's logic depends on the ApplicationInitialized event, this event has already been called before the add-in was loaded.

 

Also, some add-ins may not be able to fully initialize when loading in the middle of the session. This is because some activities must take place at the start of the Revit session:

 

  • Creation of custom failure definitions
  • Establishment of a system-wide IFailureProcessor to handle all failures.
  • Registering ExternalServices.

 

Revit also offers a new UI API method

 

  • UIApplication.LoadAddIn()

 

to programmatically load the add-in(s) listed in the provided add-in manifest file. Typically, this API would not be needed because Revit is already loading new .addin files automatically.

 

I hope this helps.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 8

RPTHOMAS108
Mentor
Mentor

Hello Jeremy,

 

Thanks that is quite useful, I'll try 'NO' instead of 'false', see if that works.

 

Not sure what is happening with the AddInManifestUtility, however.

 

Regards

 

Richard

 

 

0 Likes
Message 4 of 8

RPTHOMAS108
Mentor
Mentor

OK, it worked in the below form but not as an XML element:

 

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<RevitAddIns>
  <AddIn Type="Application" AllowLoadIntoExistingSession="NO">

 

I observe that this auto loading is a bit hit and miss so I tried it a couple of times and it still didn't load, so that looks ok.

0 Likes
Message 5 of 8

jeremytammik
Autodesk
Autodesk

The development team confirms, saying, It's an XML tag that can be added with a value of true or false, hence, a "flag".

 

So the documentation is (slightly) wrong in stating that the table lists XML tags.

 

Thank you for pointing it out, your research and clarification.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 8

jeremytammik
Autodesk
Autodesk

Correction: the development team now says:

 

OK, we sorted this out.  It IS an XML tag, not an attribute.  But it's not `AllowLoadIntoExistingSession` as documented.  It should be `AllowLoadingIntoExistingSession`.

 

I hope this clarifies.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 7 of 8

jeremytammik
Autodesk
Autodesk

By the way, here is the (still erroneous) documentation in the Revit 2018 developer guide:

 

http://help.autodesk.com/view/RVT/2018/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_A...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 8 of 8

RPTHOMAS108
Mentor
Mentor

Hello Jeremy,

 

It's good to know thanks. Now however I can't understand how what I tried also worked, unless I just put it down to 'auto load doesn't always work' and it just happened to be two of those occasions in a row that auto load didn't work.

 

Would be good if they just published the schema within the RevitAPI.chm, there are so many questions on manifest files.

 

Feel the same way about Navis clash detection reports, would be good if full schema was published (less guessing about the form of it as it changes).

 

Regards

 

Richard

 

 

0 Likes