INNA
INNA

Reputation: 131

How to handle a Dialog Box In Revit with Revit API?

While working with pyRevit and Revit API to convert a file from one format to another, I am encountering the below dialog box with the ID - Dialog_Revit_DocWarnDialog. Selecting 'Unjoin Elements' is the option I want to select through the OverrideResult method. The OverrideResult method accepts numbers starting from 1001 corresponding to each button in the dialog box or CommandLink1, CommandLink2 and so on arguments which correspond to each button. I've written the below function in pyRevit to handle the dialog box, the Revit API documentation states that we can overide the Dialog box. I am unable to select the Unjoin Elements option with many different combinations of arguments to the OverrideResult function. Is there a way to know the button ID for Unjoin Elements easily or any other way to handle this dialog box?

def on_dialog_open(sender, event):
    if event.DialogId == "Dialog_Revit_DocWarnDialog":
        print(0)
        event.OverrideResult(TaskDialogResult.CommandLink2)  # Override to the first option

Dialog Box which Opens during the transaction

Upvotes: 0

Views: 32

Answers (0)

Related Questions