-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandWallCollector.cs
74 lines (58 loc) · 2.58 KB
/
CommandWallCollector.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
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI.Selection;
namespace TestWorks
{
[Transaction(TransactionMode.Manual)]
public class CommandWallCollector : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
#region SAMPLE COLLECTORS FOR WALLS
SampleCollector sc = new SampleCollector();
List<Wall> ListWalls_Class = sc.GetWalls_Class(doc);
List<Wall> ListWalls_ClassActiveView = sc.GetWalls_ClassActiveView(doc);
List<Wall> ListWalls_Category = sc.GetWalls_Category(doc);
Element Wall_ByNameLINQ = sc.GetWallByNameLINQ(doc, "ApollosWall200");
Element Wall_ByNameLambda = sc.GetWallByNameLambda(doc, "ApollosWall200");
TaskDialog.Show("Values", "---Walls using Class \n" + SB(ListWalls_Class).ToString()
+ "---Walls using Class ActiveView \n" + SB(ListWalls_ClassActiveView).ToString()
+ "---Walls using Category \n" + SB(ListWalls_Category).ToString()
+ "\n ---Walls using LINQ \n" + Wall_ByNameLINQ.Name + " " + Wall_ByNameLINQ.Id
+ "\n ---Walls using Lambda \n" + Wall_ByNameLambda.Name + " " + Wall_ByNameLambda.Id);
#endregion
#region SET TYPE PARAMETER ISSUES
//SampleParameters_Type typeParameter = new SampleParameters_Type();
//typeParameter.SetTypeParameter(doc);
#endregion
#region SHARED PARAMETER ISSUES
//SampleCreateSharedParameter scsp = new SampleCreateSharedParameter();
//scsp.CreateSampleSharedParameters(doc, app);
#endregion
#region DELETING ELEMENTS
//SampleDeleteElements d = new SampleDeleteElements();
//d.DeleteElement(doc);
//d.DeleteElements(doc);
#endregion
return Result.Succeeded;
}
public StringBuilder SB(List<Wall> Walls)
{
StringBuilder sb = new StringBuilder();
foreach (Wall w in Walls)
sb.AppendLine(w.Name + " " + w.Id + "\n");
return sb;
}
}
}