-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServiceClear.cs
40 lines (37 loc) · 1.15 KB
/
ServiceClear.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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.UI;
using Bimbot.BimbotUI;
using Bimbot.Objects;
// ReSharper disable UnusedMember.Global
namespace Bimbot
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
[Journaling(JournalingMode.NoCommandData)]
public class ServiceClear : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
Schema schema = Schema.Lookup(new Guid("a54b4c89-0ee7-4fae-8fbd-94443f5020b3"));
if (schema != null)
Schema.EraseSchemaAndAllEntities(schema, true);
schema = Schema.Lookup(new Guid("a54b4c89-0ee7-4fae-8fbd-94443f5020b4"));
if (schema != null)
Schema.EraseSchemaAndAllEntities(schema, true);
}
catch (Exception e)
{
Console.WriteLine(e);
}
// autosucceed for now
return Result.Succeeded;
}
}
}