-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommand.cs
More file actions
44 lines (42 loc) · 1.3 KB
/
Command.cs
File metadata and controls
44 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#region Namespaces
using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
#endregion
namespace WC
{
[Transaction(TransactionMode.Manual)]
public class CommandWarningChart : IExternalCommand
{
public static string global_message;
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
try
{
App.thisApp.ShowForm(commandData.Application);
return Result.Succeeded;
}
catch (Exception ex)
{
var sb = new System.Text.StringBuilder();
sb.AppendLine(ex.GetType().FullName + ": " + ex.Message);
var inner = ex.InnerException;
int depth = 0;
while (inner != null && depth < 5)
{
sb.AppendLine("--- Inner [" + depth + "] " + inner.GetType().FullName + ": " + inner.Message);
inner = inner.InnerException;
depth++;
}
sb.AppendLine("--- Stack ---");
sb.AppendLine(ex.StackTrace);
message = sb.ToString();
return Result.Failed;
}
}
}
}