-
-
Save ksobon/8b6a2a5d972456d6d797 to your computer and use it in GitHub Desktop.
list duplicate items indices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Copyright(c) 2015, Konrad Sobon | |
# @arch_laboratory, http://archi-lab.net | |
import clr | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
# Import DocumentManager and TransactionManager | |
clr.AddReference("RevitServices") | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
from RevitServices.Transactions import TransactionManager | |
# Import RevitAPI | |
clr.AddReference("RevitAPI") | |
import Autodesk | |
from Autodesk.Revit.DB import * | |
doc = DocumentManager.Instance.CurrentDBDocument | |
uiapp = DocumentManager.Instance.CurrentUIApplication | |
app = uiapp.Application | |
from System.Collections.Generic import * | |
# Import ToDSType(bool) extension method | |
clr.AddReference("RevitNodes") | |
import Revit | |
clr.ImportExtensions(Revit.Elements) | |
#The inputs to this node will be stored as a list in the IN variable. | |
dataEnteringNode = IN | |
mylist = IN[0] | |
i, seen, result = mylist, set(), [] | |
for _index, item in enumerate(i): | |
if item not in seen: | |
# First time seeing the element | |
seen.add(item) | |
else: | |
# Already seen, add the index to the result | |
result.append(_index) | |
#Assign your output to the OUT variable | |
OUT = result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment