I am trying to create a Generic annotation to record sheet rev and issue dates.
I have three field that I would like to export to excell.
The Generic Annotation family.
How I would like to get it to excell.
Can someone point me in the right direction for this complex list rearrangement?. Im guessing I need a to use python, but not sure where to start.
See if this helps?
SheetRevisions.dyn (54.5 KB)
If you search the forum you’ll find lots of posts about this kind of thing, and perhaps different ways of approaching it.
Something I’ve noted in the graph is that when you get a sheet issed on 27/4/19 and not issued on 28/4/19 you’ll get gaps… Hopefully there are enough tips in the graph for you to fix anything for yourself.
You could do it much more efficiently in Python, but it’s more effort to see what is being outputted as you go along. Personally I’m much more familiar with the Dynamo nodes than Python methods, so would do this in nodes.
Here you go my friend, test it and let me know the results.
# Enable Python support and load DesignScript library
from Autodesk.DesignScript.Geometry import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
# Place your code below this line
x = IN
unique_date = 
unique_sheets = 
rows = 
for i in x:
if i not in unique_date:
if i not in unique_sheets:
#rows = ["N/A"]*(len(unique_date)+1)
for j in unique_sheets:
l = ["N/A"]*(len(unique_date))
for i in x:
if i == j:
for k in unique_date:
if i == k:
l = j
index = unique_date.index(k)
#for ind in range(1,index+1):
l[index] = i
# Assign your output to the OUT variable.
OUT = rows
l1 = List.SortByKey(l[0..1]<1>,l)["sorted list"];
l2 = List.GroupByKey(l1,l1);
l3 = List.AddItemToFront(l2["unique keys"]<1>,l2["groups"]<1>);
l4 = List.AddItemToFront("",List.UniqueItems(List.Sort(l)));
l5 = List.AddItemToFront(l4,l3);
xl = DSOffice.Data.ExportExcel(".\\toExcel.xlsx", "Sheet1", 0, 0, l5, true);
Node version… toExcel.dyn