Im rather new in using dynamo in revit and I try to create custom node for classify data coming from excel the code is as follow
import clr
import math
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import*
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
id = IN[0]
x = IN[1]
y = IN[2]
Blevel = IN[3]
Tlevel = IN[4]
b = IN[5]
h = IN[6]
typemark = IN[7]
covering = IN[8]
rebarno = IN[9]
rebarsize = IN[10]
layout = IN[11]
stirrupsize = IN[12]
one = []
two = []
three = []
four = []
for i in layout:
a1 = []
a2 = []
a3 = []
a4 = []
if layout == "Single":
for j in id:
if j == i:
a1 = id
else:
n = id
elif layout == "2-Bundle":
for j in id:
if j == i:
a2 = id
else:
n = id
elif layout == "3-Bundle":
for j in id:
if j == i:
a3 = id
else:
n = id
else:
for j in id:
if j == i:
a4 = id
else:
n = id
one.append(a1)
two.append(a2)
three.append(a3)
four.append(a4)
#Assign your output to the OUT variable.
OUT = one,two,three,four
I got total of 13 input that start from IN[0] to IN[12] each input represent each data category
id = IN[0]
x = IN[1]
y = IN[2]
Blevel = IN[3]
Tlevel = IN[4]
b = IN[5]
h = IN[6]
typemark = IN[7]
covering = IN[8]
rebarno = IN[9]
rebarsize = IN[10]
layout = IN[11]
stirrupsize = IN[12]
and I would like to test using layout as criteria.
This is my id (double) = [367776,367909,367926,367943,367958,367973]
in list format
List 0
1 367776
2 367909
3 367926
4 367943
5 367958
6 367973
and my layout = [“Single”,“2-Bundle”,“3-Bundle”,“4-Bundle”,“Single”,“Single”]
in list format
List 11
1 Single
2 2-Bundle
3 3-Bundle
4 4-Bundle
5 Single
6 Single
what I expected when I run these python scripts
for i in layout:
a1 = []
a2 = []
a3 = []
a4 = []
if layout == "Single":
for j in id:
if j == i:
a1 = id
else:
n = id
elif layout == "2-Bundle":
for j in id:
if j == i:
a2 = id
else:
n = id
elif layout == "3-Bundle":
for j in id:
if j == i:
a3 = id
else:
n = id
else:
for j in id:
if j == i:
a4 = id
else:
n = id
one.append(a1)
two.append(a2)
three.append(a3)
four.append(a4)
#Assign your output to the OUT variable.
OUT = one,two,three,four
the result should be
one = [367776,367958,367973]
two = [367909]
three = [367926]
four = [367943]
in list format
List 0
1 367776
2 367958
3 367973
List 1
1 367909
List 2
1 367926
List 3
1 367943
after I run these scripts I got no error or warning but the result is not as I expected these scripts didnt give out any information and I dont know where I went wrong. I just try to classify only element id first.