PickObject in class/function

Yeah I ran into that problem too.
It’s not a problem with the tool per-say, but it has to do with how dialogs & windows work.

So the problem you have is that you’ve created a ‘modal window’ which is a fancy term for, ‘this thing will always be on top and will block you from interacting with revit untill it is closed’.

That’s why you cannot interact with revit after pushing the button. Your wpf window is keeping you in the dialog.

So you have 3 options ahead of you.

  1. You can either redesign your code so that you close the wpf window temporarily and re-enable it after the pick command has passed. (Perhaps sounds harder than it is, but it requires a bit of work)

  2. You can try and go for a ‘non-modal’ window. Which is more tricky as well as requires some more experience I fear. There’s an example in this thread here

  3. (maybe?) is it possible (and reasonable) to ask users to pick a face before your window even shows? Sometimes a simple change of concept can do a lot of good.