-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSelectElements.snippet
66 lines (57 loc) · 2.59 KB
/
SelectElements.snippet
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
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Pick Elements</Title>
<Author>Maycon Freitas</Author>
<Description>Creates a selection of elements in the model.</Description>
<Shortcut>rvtpickelms</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[List<Reference> $references$ = $uidoc$.Selection.PickObjects(ObjectType.Element, $selectionFilter$, "$PromptMessage$")?.ToList() ?? new List<Reference>();
List<Element> $selectedElements$ = $references$.Count > 0 ? $references$.Select(x => $doc$.GetElement(x.ElementId)).ToList() : new List<Element>();]]>
</Code>
<Declarations>
<Literal>
<ID>references</ID>
<Default>references</Default>
<ToolTip>List to receive the references of the selected elements.</ToolTip>
</Literal>
<Literal>
<ID>uidoc</ID>
<Default>commandData.Application.ActiveUIDocument</Default>
<ToolTip>The current UIDocument (uidoc).</ToolTip>
</Literal>
<Literal>
<ID>selectionFilter</ID>
<Default>selectionFilter</Default>
<ToolTip>The parameter with a instance of the Selection Filter (see snippet rvtselfilt).</ToolTip>
</Literal>
<Literal>
<ID>PromptMessage</ID>
<Default>Select the elements</Default>
<ToolTip>Message shown at the prompt.</ToolTip>
</Literal>
<Literal>
<ID>selectedElements</ID>
<Default>selectedElements</Default>
<ToolTip>List to receive the elements from references list.</ToolTip>
</Literal>
<Literal>
<ID>doc</ID>
<Default>commandData.Application.ActiveUIDocument.Document</Default>
<ToolTip>The current Document (doc).</ToolTip>
</Literal>
</Declarations>
<Imports>
<Import>
<Namespace>Autodesk.Revit.UI.Selection</Namespace>
</Import>
<Import>
<Namespace>Autodesk.Revit.DB</Namespace>
</Import>
</Imports>
</Snippet>
</CodeSnippet>
</CodeSnippets>