-
Notifications
You must be signed in to change notification settings - Fork 0
/
Add_Revision_ToSheets.dyf
120 lines (107 loc) · 6.42 KB
/
Add_Revision_ToSheets.dyf
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<Workspace Version="1.3.2.2480" X="-1.40124326102273" Y="310.827408865645" zoom="0.873239338949518" ScaleFactor="1" Name="Add_Revision_ToSheets" Description="Adds input revision to input sheets" ID="28c4d974-ce19-4118-8930-5d621b886827" Category="ArupBimSF.Revit.Views & Sheets">
<NamespaceResolutionMap />
<Elements>
<Dynamo.Graph.Nodes.CustomNodes.Output guid="dc81265e-967a-4452-a616-434313482e3a" type="Dynamo.Graph.Nodes.CustomNodes.Output" nickname="Output" x="1015.96211158126" y="256.308054703556" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false">
<PortInfo index="0" default="False" />
<Symbol value="Sheet" />
</Dynamo.Graph.Nodes.CustomNodes.Output>
<PythonNodeModels.PythonNode guid="425616bb-586a-4436-be22-f8f84db108ef" type="PythonNodeModels.PythonNode" nickname="Python Script" x="846.125086467344" y="254.547889108847" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false" inputcount="3">
<PortInfo index="0" default="False" />
<PortInfo index="1" default="False" />
<PortInfo index="2" default="False" />
<Script># Copyright(c) 2015, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net
import clr
# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
from System import Array
from System.Collections.Generic import *
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
if isinstance(IN[0], list):
sheets = []
for i in IN[0]:
sheets.append(UnwrapElement(i))
else:
sheets = [UnwrapElement(IN[0])]
if isinstance(IN[1], list):
revs = []
for i in IN[1]:
revs.append(UnwrapElement(i))
else:
revs = [UnwrapElement(IN[1])]
RunIt = IN[2]
if RunIt:
try:
errorReport = None
for i in sheets:
revisionsOnSheet = i.GetAdditionalRevisionIds()
for r in revs:
if r.Id not in revisionsOnSheet:
revisionsOnSheet.Add(r.Id)
else:
continue
TransactionManager.Instance.EnsureInTransaction(doc)
i.SetAdditionalRevisionIds(revisionsOnSheet)
TransactionManager.Instance.TransactionTaskDone()
except:
# if error accurs anywhere in the process catch it
import traceback
errorReport = traceback.format_exc()
else:
errorReport = "Set RunIt to True."
#Assign your output to the OUT variable
if errorReport == None:
OUT = IN[0]
else:
OUT = errorReport
</Script>
</PythonNodeModels.PythonNode>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="5c64eb0f-ea51-4462-bf6d-dcecf458769d" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="155.35718815175" y="-149.465558399" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="SheetList" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
<Dynamo.Graph.Nodes.CodeBlockNodeModel guid="ee36f050-5512-4fda-b3aa-b9c566dd8919" type="Dynamo.Graph.Nodes.CodeBlockNodeModel" nickname="Code Block" x="506.371821632587" y="-126.186593251067" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="true" CodeText="list;
Bool;

[Imperative]

{
 if (Bool==true)
 return = list;
 else
 return = list;
};" ShouldFocus="false">
<PortInfo index="0" default="False" />
<PortInfo index="1" default="False" />
</Dynamo.Graph.Nodes.CodeBlockNodeModel>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="db22a78e-5f98-4317-a0c5-082b3f18553e" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="339.40934623553" y="179.813641641113" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="Revision" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="050de48b-c124-4236-8762-5897da4dab8b" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="603.530546248473" y="435.536487928033" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="Run_It:bool = false" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="10a9088c-654b-4a36-815a-1774c472f569" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="172.921862678757" y="-46.0721761965907" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="Refresh:bool=false" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
</Elements>
<Connectors>
<Dynamo.Graph.Connectors.ConnectorModel start="425616bb-586a-4436-be22-f8f84db108ef" start_index="0" end="dc81265e-967a-4452-a616-434313482e3a" end_index="0" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="5c64eb0f-ea51-4462-bf6d-dcecf458769d" start_index="0" end="ee36f050-5512-4fda-b3aa-b9c566dd8919" end_index="0" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="ee36f050-5512-4fda-b3aa-b9c566dd8919" start_index="2" end="425616bb-586a-4436-be22-f8f84db108ef" end_index="0" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="db22a78e-5f98-4317-a0c5-082b3f18553e" start_index="0" end="425616bb-586a-4436-be22-f8f84db108ef" end_index="1" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="050de48b-c124-4236-8762-5897da4dab8b" start_index="0" end="425616bb-586a-4436-be22-f8f84db108ef" end_index="2" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="10a9088c-654b-4a36-815a-1774c472f569" start_index="0" end="ee36f050-5512-4fda-b3aa-b9c566dd8919" end_index="1" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="Background Preview" eyeX="-17" eyeY="24" eyeZ="50" lookX="12" lookY="-13" lookZ="-58" upX="0" upY="1" upZ="0" />
</Cameras>
</Workspace>