我用 C# 创建了一个 Revit 插件,允许对 3D 技术完全陌生的用户选择一个族,并将其插入到他们的项目中。但现在用户无法选择将对象放置在任意位置的点上还是放置在面上。要么是其中之一,要么是另一个。现在我的代码如下所示:
bool useSimpleInsertionPoint = false; //or true
bool useFaceReference = true; //or false
if (useSimpleInsertionPoint)
{
//my code for insertion on point here
}
if (useFaceReference)
{
//my code for face insertion here
}
Run Code Online (Sandbox Code Playgroud)
我想做的是问用户他想做什么。TaskDialog.Show 可以解决这个问题还是别的什么?
提前致谢。
文森特的做法很好。我更喜欢的一件事是将 CommandLink 选项与 TaskDialog 一起使用。这为您提供了可供选择的“大选项”按钮,提供了答案以及关于每个答案的可选“解释”行。
代码如下:
TaskDialog td = new TaskDialog("Decision");
td.MainContent = "What do you want to do?";
td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,
"Use Simple Insertion Point",
"This option works for free-floating items");
td.AddCommandLink(TaskDialogCommandLinkId.CommandLink2,
"Use Face Reference",
"Use this option to place the family on a wall or other surface");
switch (td.Show())
{
case TaskDialogResult.CommandLink1:
// do the simple stuff
break;
case TaskDialogResult.CommandLink2:
// do the face reference
break;
default:
// handle any other case.
break;
}
Run Code Online (Sandbox Code Playgroud)