Weird Allow Multiple Selection - Revit API 2025

Weird Allow Multiple Selection - Revit API 2025

ricaun
Advisor Advisor
1,292 Views
11 Replies
Message 1 of 12

Weird Allow Multiple Selection - Revit API 2025

ricaun
Advisor
Advisor

Hello, 

 

I found a strange behavior when using Selection.PickObject inside an ExternalEventHandler

 

For some reason the Allow Multiple Selection ribbon appear and the user can select multiple elements, and my code asked for only one element.

 

Here is a video how to reproduce.

 

 

This only happens in Revit 2025.

Does not break anything in the code, but could mislead the user to think that multiple elements is allowed in the command.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Accepted solutions (1)
1,293 Views
11 Replies
Replies (11)
Message 2 of 12

Moustafa_K
Collaborator
Collaborator

that is strange, i wasn't able to reproduce it using ExternalEventHandler!!!  but i am still on Revit preview release didn't yet downloaded the 2025 version. I will try downloading and see if it behaves similar to yours

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 12

ricaun
Advisor
Advisor

Below is a sample code for a quick test in Revit 2025.

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    public class Command : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiapp = commandData.Application;

            ExternalEventHandler.Create().Raise();

            return Result.Succeeded;
        }
    }
    public class ExternalEventHandler : IExternalEventHandler
    {
        public void Execute(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Selection selection = uidoc.Selection;
            var reference = selection.PickObject(ObjectType.Element);
        }
        public string GetName()
        {
            return this.GetType().Name;
        }
        public static ExternalEvent Create()
        {
            return ExternalEvent.Create(new ExternalEventHandler());
        }
    }
}

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 4 of 12

jeremy_tammik
Alumni
Alumni

Thank you for analysing and reporting this. I have passed it on to the development team.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 12

jeremy_tammik
Alumni
Alumni

Dear Luiz,

 

Thank you again for discovering, documenting and reporting this, and for the clear sample material.

 

Sorry to hear about this.

 

I logged the issue REVIT-221560 [PickObject in ExternalEventHandler displays multiple selection ribbon in Revit 2025] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is crucial. Our engineering team has limited resources and must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 12

ricaun
Advisor
Advisor

Hello Jerem

 

Thanks for sending the issue to the Revit Team.

 


@jeremy_tammik wrote:

This issue is important to me. What can I do to help?


Yes, the issue affects all the plugins that use PickObject and modeless window (ExternalEventHandler).

 

The issue is just a UI that should not be there, the user could think that is a feature but is not. Because Revit 2024 does not have this problem and was introduced in Revit 2025, including a fix in the next Hotpot would be ideal.

 

The extra menu 'Allow Multiple Selection' in that situation does nothing, does not break the plugin/Revit, and does not add any functionality.

 

Just make the menu hide when is a single-element selection.

 

 

 

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 7 of 12

ricaun
Advisor
Advisor

By the way if you use Face, Edge, Point and Link, the Allow Multiple Selection show as well.

 

I tested using the RevitLookup in version 2025.

RevitLookup - Allow Multiple Selection - 2024-04-30 14-58-17.gif

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 8 of 12

Sean_Page
Collaborator
Collaborator

Glad I came across this post as I was going to submit a post about why I was seeing it being handled two different ways, but I will just tack on here.

And yes, I am in the latest version 2025.4.

 

I would also like to add here that there is a different experience when using it directly from a IExternalCommand vs IExternalEventHandler.

 

ExternalCommand: (Old way I'd expect)

Sean_Page_0-1733955478748.png

 

ExternalEvent: Aligns UI / Options as Luiz notes:

Sean_Page_1-1733955538882.png

 

Personally, I MUCH prefer the UI of the IExternalEventHandler option, and I am looking for selecting multiple, but it's much cleaner.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 9 of 12

Sean_Page
Collaborator
Collaborator

So, I am not sure if maybe it's because you don't have a filter / prompt specified, but I don't actually see this behavior with PickObject.

 

This is in the command:

Sean_Page_2-1733956058330.png

 

This is being ran within an IExternalEventhandler as a switched method on Execute().

private void AssignParameters(UIDocument uiDoc, Document Doc)
{
    try
    {
        Document doc = uiDoc.Document;
        ISelectionFilter filter = new SelectionFilters.SpaceSelectionFilter([SpaceCategory]);
        Selection picked = uiDoc.Selection;
        
        //Does not provide the Multiple selection Option as expected.
        Reference single = picked.PickObject(ObjectType.Element, filter, "Select Rooms");
        
        //Does provide Multiple Option as expected
        IList<Reference> selections = picked.PickObjects(ObjectType.Element, filter, "Select Rooms");
    }
    catch(Exception ex)
    {
        if(ex.GetType() == typeof(Autodesk.Revit.Exceptions.OperationCanceledException))
        {
            return;
        }
    }
}

 

 

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 10 of 12

ricaun
Advisor
Advisor
Accepted solution

The issue was fixed in Revit 2025.2

 

Selection

Fixed an API Issue in which method Selection.PickObject would allow multiple selection if called from a class implementing IExternalEventHandler interface.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 11 of 12

Sean_Page
Collaborator
Collaborator

Thanks Luiz, would still like to see consistent Ribbon UI regardless of where the PO call comes from.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 12 of 12

ricaun
Advisor
Advisor

@Sean_Page wrote:

Personally, I MUCH prefer the UI of the IExternalEventHandler option, and I am looking for selecting multiple, but it's much cleaner.


Agree looks much cleaner. I suppose Autodesk is moving all Option Bar to the Modify tab, there are some movement in the Revit Preview.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils