2014-06-12 4 views
2

가족의 드래그/드롭을 프로젝트에 바인딩하고 비활성화하려고합니다.Revit API AddInCommandBinding for ID_PROCESS_DROP

내 코드에서 Revit 2014 SDK 샘플 DisableCommand

내 코드가 .CanHaveBinding 테스트를 가지고 있는데이 성공 또는 실패를 표시하는 대화 상자를 기반으로합니다. 명령을 실행하면 성공을 보여 주지만 여전히 낙하산을 끌 수 있습니다. 어떤 아이디어?

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!"); 
} 

답변

0

당신의 방법 (및 클래스)은 정적 일 필요가 있습니다 - 나는 이상한 일들이 과거의 인스턴스 방법으로 일어났습니다. 또한 메서드의 구현이 정확히 무엇인지 모르겠지만 명령을 완전히 완료하려면 CommandData.Result를 반환해야 할 수도 있습니다.