PickObject from DockablePane

PickObject from DockablePane

annse
Enthusiast Enthusiast
1,827 Views
10 Replies
Message 1 of 11

PickObject from DockablePane

annse
Enthusiast
Enthusiast

Hi!

 

I'm trying to run PickObject from a DockablePane using ExternalEvent. I'm receiving the following error. 

 

"The active view is non-graphical and does not support capture of the focus for pick operations."

 

Runnnig the same code on the same View from an ExternalCommand is no problem.

What are my options? Is it possible to focus the ActiveView?

 

Thanks!

Annse

0 Likes
1,828 Views
10 Replies
Replies (10)
Message 2 of 11

jeremytammik
Autodesk
Autodesk

Dear Annse,

 

Please have a look at my answer just a day or two ago on a similar question involving a dockable panel:

 

http://forums.autodesk.com/t5/revit-api/dockable-dialog-and-promptforfamilyinstanceplacement/m-p/541...

 

Please also let us know whether this helps you.

 

If so, I might promote this to a blog post to make it easier to find.

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 3 of 11

annse
Enthusiast
Enthusiast

Hi Jeremy!

 

Thank you for your quick response. I did read your suggested entry before I posted.

 

The CanBePrinted property returns true.

The app.ActiveUIDocument.ActiveGraphicalView and the app.ActiveUIDocument.ActiveView are the same.

I've also tried things like app.ActiveUIDocument.RefreshActiveView().

 

public class MyExternalEvent : IExternalEventHandler
{
       public void Execute(UIApplication app)
       {

              Reference elementRef = app.ActiveUIDocument.Selection.PickObject(ObjectType.Element, "Select element.");
              Element element = app.ActiveUIDocument.Document.GetElement(elementRef.ElementId);
       }

       public string GetName()
       {
              return "My External Event";
       }
}

 

Thanks!

Annse

0 Likes
Message 4 of 11

jeremytammik
Autodesk
Autodesk

Dear Annse,

 

Have you tried installing Revit 2015 UR4?

 

http://thebuildingcoder.typepad.com/blog/2014/09/revit-2015-r2-ur4-and-dimension-prefix-suffix.html#...

 

Look at the list of API enhancements:

 

  • Improves stability when the Pick Points API was invoked from within a Dockable Frame.

 

Cheers,

 

Jeremy



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

0 Likes
Message 5 of 11

annse
Enthusiast
Enthusiast

Yes, I'm updated.

 

Thanks!

Annse

0 Likes
Message 6 of 11

FrodeTo
Contributor
Contributor
Was there ever a solution to this? I have exactly the same problem.

I have the Revit 2015 version mentioned above, but the PickObject still gives the non-graphical exception.
0 Likes
Message 7 of 11

jeremytammik
Autodesk
Autodesk

Dear Frode,

 

Sorry to hear that.

 

Can you provide a reproducible case for the development team to take a closer look at, please?

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 8 of 11

FrodeTo
Contributor
Contributor
I will make an example and send it to the ADN. I'll post a note here if when I know more.

BTW, that's an impressively quick reply!

Frode
0 Likes
Message 9 of 11

jeremytammik
Autodesk
Autodesk

Dear Frode,

 

Thank you for your appreciation It is a pleasure. I am always glad to impress  🙂

 

Thank you for submitting your sample to ADN, which I received in case 10824043 [PickObject gives exception in dockable dialog].

 

I logged the issue REVIT-68861 [PickObject gives exception in dockable dialog -- 10824043] 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.

 

I hope this helps.

 

I will be on vacation next week, so don't expect to hear anything more from me until afterwards.

 

Happy weekend and following week!

 

Best regards,



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

0 Likes
Message 10 of 11

annse
Enthusiast
Enthusiast

Hi!

 

Good to know this issue has been submitted.

I ended up with reversing the order of the pick operation by implementing a selection watcher.

 

/Annse

0 Likes
Message 11 of 11

Anonymous
Not applicable

Hi annse.

 

 I have Revit 2015 R2 upgrade 8 installed and have an exactly same issue you have. Looks like you have a way to work around the issue by "reversing the order of the pick operation by implementing a selection watcher." Would you please explain in detail? Very appreciate if you can share the code.

 

Mark

 

0 Likes