-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DA_Revit.cs
66 lines (54 loc) · 2.14 KB
/
DA_Revit.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Autodesk.Forge.Oss.DesignAutomation.Samples.Models;
using Autodesk.Forge.Oss.DesignAutomation.Services;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Autodesk.Forge.Oss.DesignAutomation.Samples
{
public class DA_Revit
{
public static async Task<bool> Test(string version = null)
{
if (string.IsNullOrEmpty(version))
version = "2021";
IDesignAutomationService service = new RevitDesignAutomationService("DeleteWalls")
{
EngineVersions = new[] { version },
EnableConsoleLogger = true,
EnableParameterConsoleLogger = true,
EnableReportConsoleLogger = true,
};
await service.Initialize(@".\DA\DA4Revit\DeleteWalls.zip");
var result = await service.Run<RevitParameterOptions>(options =>
{
options.RvtFile = $@".\DA\DA4Revit\DeleteWalls{version}.rvt";
options.Result = $@"Result{version}.rvt";
});
await service.Delete();
return result;
}
public static async Task<bool> AllEngines_Test()
{
IDesignAutomationService service = new RevitDesignAutomationService("DeleteWalls")
{
EngineVersions = new[] { "2021", "2022", "2023", "2024" },
EnableConsoleLogger = true,
EnableParameterConsoleLogger = true,
};
await service.Initialize(@".\DA\DA4Revit\DeleteWalls.zip");
var tasks = new List<Task<bool>>();
foreach (var version in service.CoreEngineVersions())
{
var task = service.Run<RevitParameterOptions>(options =>
{
options.RvtFile = $@".\DA\DA4Revit\DeleteWalls{version}.rvt";
options.Result = $@"Result{version}.rvt";
}, version);
tasks.Add(task);
}
var results = await Task.WhenAll(tasks);
await service.Delete();
return !results.Contains(false);
}
}
}