-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cs
49 lines (43 loc) · 1.67 KB
/
main.cs
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
45
46
47
48
49
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace SimpleHouseProject
{
/// <summary>
/// Main external command class to execute the Revit add-in.
/// </summary>
[Transaction(TransactionMode.Manual)]
public class main : IExternalCommand
{
/// <summary>
/// Gets or sets the current Revit document.
/// </summary>
public Document doc { get; set; }
/// <summary>
/// Gets or sets the current Revit UI application.
/// </summary>
public UIApplication uiApp { get; set; }
/// <summary>
/// Gets or sets the current Revit UI document.
/// </summary>
public UIDocument uidoc { get; set; }
/// <summary>
/// Executes the main logic of the Revit add-in.
/// </summary>
/// <param name="commandData">The external command data.</param>
/// <param name="message">The message to return if the command fails.</param>
/// <param name="elements">The set of elements to which the command applies.</param>
/// <returns>Result.Succeeded if the command succeeds.</returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// Initialize Revit API objects
uiApp = commandData.Application;
uidoc = uiApp.ActiveUIDocument;
doc = uidoc.Document;
// Create and display the main UI form
MainUI mainPage = new MainUI(uidoc, doc);
mainPage.ShowDialog();
return Result.Succeeded;
}
}
}