Please help me to get the list of Elements that are sorted by Z value and use the python language in dynamo.
I have used “List.SortByKey” in the python script but I can not get the list of Element.
List.SortByKey node in dynamo will be extract 2 sorted list and sortd keys, but I just would like to get the sorted list. In Python script I extract a list of them, however I can not get list of “sorted list” although using “List.GetItemAtIndex”
The list of Elements by using dynamo node.
The list of list when I use “List.SortBykey”
And I do not understand the List.Map node in Dynamo, please help me to know it in detail.
This is code I have use:
if IN[0] == True:
cols = uidoc.Selection.PickObjects(Selection.ObjectType.Element)
Framing =
for i in cols:
Framing1 =
k = doc.GetElement(i)
Framing.append(k)
z =
for i in Framing:
z.append(i.Location.Curve.GetEndPoint(0).ToPoint().Z)
import DSCore
from DSCore import *
z = List.SortByKey(Framing,z)
import System
from System.Windows.Forms import *
from System.Drawing import *
from System.Collections.Generic import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from RevitServices.Elements import *
lev = view.GenLevel
if IN[0] == True:
cols = uidoc.Selection.PickObjects(Selection.ObjectType.Element)
Framing = []
for i in cols:
Framing1 = []
k = doc.GetElement(i)
Framing.append(k)
z = []
for i in Framing:
z.append(i.Location.Curve.GetEndPoint(0).ToPoint().Z)
I need to know the Dynamo core node because I would like to understand how to change the Dynamo node into Python. It is more usefull when we know how to get information we need to take.
I do not know why the node could be extracted the elements but I can not get the list of them.