-
Notifications
You must be signed in to change notification settings - Fork 5
/
2-SetElementLevel.dyn
133 lines (123 loc) · 14.5 KB
/
2-SetElementLevel.dyn
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
121
122
123
124
125
126
127
128
129
130
131
132
133
<Workspace Version="0.8.2.2392" X="168.842375170658" Y="180.275729312364" zoom="1.19185052383417" Name="Home" Description="" RunType="Manual" RunPeriod="1000" HasRunWithoutCrash="True">
<NamespaceResolutionMap>
<ClassMap partialName="List" resolvedName="DSCore.List" assemblyName="DSCoreNodes.dll" />
<ClassMap partialName="Category" resolvedName="Revit.Elements.Category" assemblyName="RevitNodes.dll" />
</NamespaceResolutionMap>
<Elements>
<DSIronPythonNode.PythonNode guid="dae99f35-d1fe-4e68-aeab-459d3e235603" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="1495.51239899532" y="-425.578407777202" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="2">
<Script>import clr
levels = IN[0]
toFind = IN[1]
OUT = [min(enumerate(levels), key=lambda x: abs(x[1]-f)) for f in toFind]
</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.DSFunction guid="02b1e3b7-4cc1-4274-bcdf-71d0e448ffe8" type="Dynamo.Nodes.DSFunction" nickname="List.GetItemAtIndex" x="1819.95543217324" y="-38.4092045724162" isVisible="true" isUpstreamVisible="true" lacing="Longest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.GetItemAtIndex@var[]..[],int" />
<Dynamo.Nodes.CodeBlockNodeModel guid="6f3b33fe-2aac-4fd2-b96f-6cd3ba90a044" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="1683.73433824527" y="60.2418750847852" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText="0;" ShouldFocus="false" />
<Dynamo.Nodes.DSFunction guid="bf0eddd6-58c1-4987-959b-d14c5a491456" type="Dynamo.Nodes.DSFunction" nickname="List.GetItemAtIndex" x="2110.16400082195" y="221.323455420808" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.GetItemAtIndex@var[]..[],int" />
<Dynamo.Nodes.CodeBlockNodeModel guid="14d4e5e3-7bbf-457d-872f-eb5b42df510c" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="1738.37878018465" y="604.223661889793" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText="0;" ShouldFocus="false" />
<DSIronPythonNode.PythonNode guid="7b80a0e8-b4fb-476a-855a-9be64867b5af" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="1501.90574129251" y="546.130831114236" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="2">
<Script>import clr
levels = IN[0]
toFind = IN[1]
OUT = [min(enumerate(levels), key=lambda x: abs(x[1]-f)) for f in toFind]
</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.DSFunction guid="7343f865-e13d-44e6-ba9b-4559080d7396" type="Dynamo.Nodes.DSFunction" nickname="List.GetItemAtIndex" x="1867.16271882895" y="529.371479140347" isVisible="true" isUpstreamVisible="true" lacing="Longest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.GetItemAtIndex@var[]..[],int" />
<Dynamo.Nodes.DSFunction guid="c51f5cfe-3b30-45a4-be9e-839b0aca24fe" type="Dynamo.Nodes.DSFunction" nickname="List.GetItemAtIndex" x="2110.90400709891" y="451.919516579579" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.GetItemAtIndex@var[]..[],int" />
<Dynamo.Nodes.CodeBlockNodeModel guid="1e53a355-c55b-48af-9f3e-52dc2914ab84" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="2474.21470654395" y="361.378027441368" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" CodeText="bot + top;" ShouldFocus="false" />
<Dynamo.Nodes.DSFunction guid="c4af84dd-8e65-429f-87eb-9bbfc654fb4d" type="Dynamo.Nodes.DSFunction" nickname="Element.SetParameterByName" x="2972.23990282386" y="142.600248733466" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="RevitNodes.dll" function="Revit.Elements.Element.SetParameterByName@string,var" />
<Dynamo.Nodes.CodeBlockNodeModel guid="48038add-02ce-428a-b44b-fb429d9b5d32" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="2694" y="199" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText=""Level";" ShouldFocus="false" />
<DSIronPythonNode.PythonNode guid="f01a6d84-661f-4de0-8c26-c355f1c31751" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="82.0211564495406" y="73.2309457758075" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="0">
<Script>import clr
# Import RevitAPI
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import TaskDialog
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
collector = FilteredElementCollector( doc ).WhereElementIsNotElementType()
cat = []
bboxMin = []
bboxMax = []
error = []
for c in collector:
#if (None != c.Category and c.Category.HasMaterialQuantities):
try:
bboxMin.append(c.get_BoundingBox(None).Min.ToPoint().Z)
bboxMax.append(c.get_BoundingBox(None).Max.ToPoint().Z)
cat.append(c)
except:
error.append(c)
OUT = cat, bboxMin,bboxMax, error</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.CodeBlockNodeModel guid="3d3ee796-5846-488c-b0a2-3942fd491127" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="493.039129352485" y="127.628477586315" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" CodeText="a[0];" ShouldFocus="false" />
<Dynamo.Nodes.CodeBlockNodeModel guid="7b9a5b07-b04d-44af-8287-91b622348446" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="764.938979586452" y="-379.91425273132" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" CodeText="a[1];" ShouldFocus="false" />
<Dynamo.Nodes.CodeBlockNodeModel guid="8461562a-6c3a-44a6-849b-07f6a1525057" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="662.642393254077" y="445.369930580437" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" CodeText="a[2];" ShouldFocus="false" />
<Dynamo.Nodes.CodeBlockNodeModel guid="316a4a8b-b9be-4a90-99be-4358356f7f57" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="934.591271706695" y="105.38431364174" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText="{"B07","P06","B05"};" ShouldFocus="false" />
<Dynamo.Nodes.CodeBlockNodeModel guid="c25fb72f-ca2b-48dc-9f74-837c940c151d" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="944.379935790646" y="356.983651619392" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText="{602328,603618,604728};" ShouldFocus="false" />
<Dynamo.Nodes.DSFunction guid="0a274518-0d0c-4595-aa6c-9bc7b48b8568" type="Dynamo.Nodes.DSFunction" nickname="Element.Id" x="695.553103660403" y="232.751837377495" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="RevitNodes.dll" function="Revit.Elements.Element.Id" />
<Dynamo.Nodes.CodeBlockNodeModel guid="c1a4e369-bc71-4f62-bcbf-9feabf4d9569" type="Dynamo.Nodes.CodeBlockNodeModel" nickname="Code Block" x="828.485502481986" y="332.039717897883" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" CodeText="8100960;" ShouldFocus="false" />
<Dynamo.Nodes.DSFunction guid="0c546d99-f47a-451b-b086-acc0642a9ee0" type="Dynamo.Nodes.DSFunction" nickname="List.AllIndicesOf" x="956.942336401533" y="611.79220164085" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.AllIndicesOf@var[]..[],var" />
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="dae99f35-d1fe-4e68-aeab-459d3e235603" start_index="0" end="02b1e3b7-4cc1-4274-bcdf-71d0e448ffe8" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="02b1e3b7-4cc1-4274-bcdf-71d0e448ffe8" start_index="0" end="bf0eddd6-58c1-4987-959b-d14c5a491456" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="6f3b33fe-2aac-4fd2-b96f-6cd3ba90a044" start_index="0" end="02b1e3b7-4cc1-4274-bcdf-71d0e448ffe8" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="bf0eddd6-58c1-4987-959b-d14c5a491456" start_index="0" end="1e53a355-c55b-48af-9f3e-52dc2914ab84" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="14d4e5e3-7bbf-457d-872f-eb5b42df510c" start_index="0" end="7343f865-e13d-44e6-ba9b-4559080d7396" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="7b80a0e8-b4fb-476a-855a-9be64867b5af" start_index="0" end="7343f865-e13d-44e6-ba9b-4559080d7396" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="7343f865-e13d-44e6-ba9b-4559080d7396" start_index="0" end="c51f5cfe-3b30-45a4-be9e-839b0aca24fe" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="c51f5cfe-3b30-45a4-be9e-839b0aca24fe" start_index="0" end="1e53a355-c55b-48af-9f3e-52dc2914ab84" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="1e53a355-c55b-48af-9f3e-52dc2914ab84" start_index="0" end="c4af84dd-8e65-429f-87eb-9bbfc654fb4d" end_index="2" portType="0" />
<Dynamo.Models.ConnectorModel start="48038add-02ce-428a-b44b-fb429d9b5d32" start_index="0" end="c4af84dd-8e65-429f-87eb-9bbfc654fb4d" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="f01a6d84-661f-4de0-8c26-c355f1c31751" start_index="0" end="7b9a5b07-b04d-44af-8287-91b622348446" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="f01a6d84-661f-4de0-8c26-c355f1c31751" start_index="0" end="8461562a-6c3a-44a6-849b-07f6a1525057" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="f01a6d84-661f-4de0-8c26-c355f1c31751" start_index="0" end="3d3ee796-5846-488c-b0a2-3942fd491127" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="3d3ee796-5846-488c-b0a2-3942fd491127" start_index="0" end="c4af84dd-8e65-429f-87eb-9bbfc654fb4d" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="3d3ee796-5846-488c-b0a2-3942fd491127" start_index="0" end="0a274518-0d0c-4595-aa6c-9bc7b48b8568" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="7b9a5b07-b04d-44af-8287-91b622348446" start_index="0" end="dae99f35-d1fe-4e68-aeab-459d3e235603" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="8461562a-6c3a-44a6-849b-07f6a1525057" start_index="0" end="7b80a0e8-b4fb-476a-855a-9be64867b5af" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="316a4a8b-b9be-4a90-99be-4358356f7f57" start_index="0" end="bf0eddd6-58c1-4987-959b-d14c5a491456" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="316a4a8b-b9be-4a90-99be-4358356f7f57" start_index="0" end="c51f5cfe-3b30-45a4-be9e-839b0aca24fe" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c25fb72f-ca2b-48dc-9f74-837c940c151d" start_index="0" end="7b80a0e8-b4fb-476a-855a-9be64867b5af" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c25fb72f-ca2b-48dc-9f74-837c940c151d" start_index="0" end="dae99f35-d1fe-4e68-aeab-459d3e235603" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="0a274518-0d0c-4595-aa6c-9bc7b48b8568" start_index="0" end="0c546d99-f47a-451b-b086-acc0642a9ee0" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c1a4e369-bc71-4f62-bcbf-9feabf4d9569" start_index="0" end="0c546d99-f47a-451b-b086-acc0642a9ee0" end_index="1" portType="0" />
</Connectors>
<Notes />
<Annotations>
<Dynamo.Models.AnnotationModel guid="9ff4a12b-93bb-4893-be5e-1d89da20148f" annotationText="" left="2684" top="169" width="123" height="123" fontSize="14" InitialTop="199" InitialHeight="123" TextblockHeight="20" backgrouund="#FFA4E1FF">
<Models ModelGuid="48038add-02ce-428a-b44b-fb429d9b5d32" />
</Dynamo.Models.AnnotationModel>
<Dynamo.Models.AnnotationModel guid="0af4074b-6d97-42aa-a412-1d59a97e9c82" annotationText="All categories" left="72.0211564495406" top="-166.769054224193" width="114" height="333" fontSize="48" InitialTop="73.2309457758075" InitialHeight="125.597599428023" TextblockHeight="230" backgrouund="#FFC1D676">
<Models ModelGuid="f01a6d84-661f-4de0-8c26-c355f1c31751" />
</Dynamo.Models.AnnotationModel>
<Dynamo.Models.AnnotationModel guid="ff7d7af0-b312-4f9a-a940-81d720d0023f" annotationText="Min Point Z" left="1485.51239899532" top="-521.578407777202" width="144" height="215" fontSize="36" InitialTop="-425.578407777202" InitialHeight="149" TextblockHeight="86" backgrouund="#FFC1D676">
<Models ModelGuid="dae99f35-d1fe-4e68-aeab-459d3e235603" />
</Dynamo.Models.AnnotationModel>
<Dynamo.Models.AnnotationModel guid="44550541-90ce-4e11-9eea-cac6f511d2fb" annotationText="Max Point Z" left="1491.90574129251" top="450.130831114236" width="144" height="215" fontSize="36" InitialTop="546.130831114236" InitialHeight="149" TextblockHeight="86" backgrouund="#FFC1D676">
<Models ModelGuid="7b80a0e8-b4fb-476a-855a-9be64867b5af" />
</Dynamo.Models.AnnotationModel>
<Dynamo.Models.AnnotationModel guid="e63177b8-b3d5-4f82-8b5b-d257dda2d173" annotationText="Level Name" left="924.591271706695" top="52.38431364174" width="222" height="146" fontSize="36" InitialTop="105.38431364174" InitialHeight="123" TextblockHeight="43" backgrouund="#FFA4E1FF">
<Models ModelGuid="316a4a8b-b9be-4a90-99be-4358356f7f57" />
</Dynamo.Models.AnnotationModel>
<Dynamo.Models.AnnotationModel guid="1d2de974-c1c7-47c0-83d9-3171c2248d0c" annotationText="Level SSL" left="934.379935790646" top="303.983651619392" width="247" height="146" fontSize="36" InitialTop="356.983651619392" InitialHeight="123" TextblockHeight="43" backgrouund="#FFA4E1FF">
<Models ModelGuid="c25fb72f-ca2b-48dc-9f74-837c940c151d" />
</Dynamo.Models.AnnotationModel>
</Annotations>
<Presets />
<Cameras>
<Camera Name="background_preview" eyeX="10" eyeY="15" eyeZ="10" lookX="-10" lookY="-10" lookZ="-10" />
</Cameras>
</Workspace>