Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add TaskDialog buttons via loop

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
floretti
339 Views, 4 Replies

Add TaskDialog buttons via loop

Hi all,

 

I'm creating a TaskDialog where the user needs to select one of the phases in the model but I don't know how many CommandLinkX I'll need as it will depend on how many phases the model already has. Is there a way to use a loop to add them? I've done some research but couldn't find anything related to it. Thank you.

 

Snippet of code below. Ideally I'd love to do something like CommandLink[i] in the loop. I also noticed that each CommandLinkX has an id number, CommandLink1 is 1001 and I'd love to take advantage of that but not sure how.

 

var phaseArray = doc.Phases;
var phaseNameDiag = new TaskDialog("Phase Selection");
phaseNameDiag.MainInstruction = "What phase is it?";

for ( var i = 0; i < phaseArray.Size; i++)
{
	phaseNameDiag.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, phaseArray.get_Item(i).Name);
}

 

4 REPLIES 4
Message 2 of 5
Moustafa_K
in reply to: floretti

Try this library it has some reasonable good potentials. 

 
 

Moustafa_K_2-1718373110248.png

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 5
Moustafa_K
in reply to: floretti

Try this library it has some reasonable good potentials.  

Moustafa_K_2-1718373110248.png

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 4 of 5
Speed_CAD
in reply to: floretti

Hi floretti,

 

If there are more than 4 buttons, then you should use Autodesk.Windows.TaskDialog

Mauricio Jorquera
Message 5 of 5
floretti
in reply to: floretti

@Speed_CAD Thank you, that did the job.  🙏

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report