-
Notifications
You must be signed in to change notification settings - Fork 9
/
CreateTransaction.snippet
62 lines (47 loc) · 1.84 KB
/
CreateTransaction.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
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Create Transaction</Title>
<Author>Maycon Freitas</Author>
<Description>Creates a sample of a Transaction code.</Description>
<Shortcut>rvttrans</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[//Created a transaction inside using block
using (Transaction $trans$ = new Transaction($doc$, "$TransactionName$"))
{
//Starts the transaction
$trans$.Start();
//TODO: Write your code that needs a transaction down here....
$end$
//Finishes the transaction
$trans$.Commit();
}]]>
</Code>
<Declarations>
<Literal>
<ID>trans</ID>
<Default>trans</Default>
<ToolTip>The name of the varible to receive the Transaction.</ToolTip>
</Literal>
<Literal>
<ID>doc</ID>
<Default>commandData.Application.ActiveUIDocument.Document</Default>
<ToolTip>The current Document (doc).</ToolTip>
</Literal>
<Literal>
<ID>TransactionName</ID>
<Default>Transaction Name</Default>
<ToolTip>The name of the Transaction.</ToolTip>
</Literal>
</Declarations>
<Imports>
<Import>
<Namespace>Autodesk.Revit.DB</Namespace>
</Import>
</Imports>
</Snippet>
</CodeSnippet>
</CodeSnippets>