Message 1 of 8
Revit API AddInCommandBinding for ID_PROCESS_DROP

Not applicable
06-14-2014
09:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to bind the drag/drop of a family into the project and disable it.
My code is based on the Revit 2014 SDK Sample DisableCommand
My code has the .CanHaveBinding test and I have a dialog that displays success or failure. When I run the command it shows success, but I'm still able to drag drop families. Any ideas?
RevitCommandId commandId2 = RevitCommandId.LookupCommandId("ID_PROCESS_DROP"); if (!commandId2.CanHaveBinding) { TaskDialog.Show("Error", "Drag/Drop cannot be overridden."); } else { TaskDialog.Show("Success", "Drag/Drop can be overridden."); } try { AddInCommandBinding dropBinding = uiapp.CreateAddInCommandBinding(commandId2); dropBinding.Executed += new EventHandler<Autodesk.Revit.UI.Events.ExecutedEventArgs>(dragDropDisable); } catch (Exception ex) { Console.WriteLine("Error: {0}",ex.ToString()); } private void dragDropDisable( object sender, Autodesk.Revit.UI.Events.ExecutedEventArgs args) { TaskDialog.Show("Disabled", "Never Drag/Drop families into your project!"); }