I'm trying to pick an object in Revit when clicking a button without closing the Form. the problem is when i click the button i can't interact with Revit.
here's the main code calling the Form and passing Revit as owner.
IWin32Window revit_window = new JtWindowHandle(ComponentManager.ApplicationWindow);
Process process = Process.GetCurrentProcess();
IntPtr h = process.MainWindowHandle;
form.ShowDialog(revit_window);
public class JtWindowHandle : IWin32Window
{
IntPtr _hwnd;
public JtWindowHandle(IntPtr h)
{
Debug.Assert(IntPtr.Zero != h, "expected non-null window handle");
_hwnd = h;
}
public IntPtr Handle
{
get
{
return _hwnd;
}
}
}
and here is the Form code to select the element:
private void button1_Click(object sender, EventArgs e)
{
Hide();
SelectionFilter1 selfilter1 = new SelectionFilter1();
pickedRef1 = sel.PickObject(ObjectType.Element, selfilter1, "Select Family instance");
Show();
}