Added some new scripts
This commit is contained in:
44
nodes/2.x/ReplaceFollowingSameElements.py
Normal file
44
nodes/2.x/ReplaceFollowingSameElements.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# Enable Python support and load DesignScript library
|
||||
import clr
|
||||
clr.AddReference('ProtoGeometry')
|
||||
from Autodesk.DesignScript.Geometry import *
|
||||
|
||||
# The inputs to this node will be stored as a list in the IN variables.
|
||||
in_list = IN[0]
|
||||
replacement = IN[1]
|
||||
countUnit = IN[2]
|
||||
OUT = []
|
||||
out_list_1 = []
|
||||
out_list_2 = []
|
||||
out_list_3 = []
|
||||
# Place your code below this line
|
||||
for layerlists in in_list:
|
||||
layerlist_counted = layerlists[:]
|
||||
layerlist_firstorig = layerlist_counted[:]
|
||||
for num, val in enumerate(layerlists):
|
||||
#egyesével végig megyünk az elemeken
|
||||
valcounter = []
|
||||
valcounter.append(0)
|
||||
for val2 in layerlists[num + 1:]:
|
||||
if val2 == val:
|
||||
valcounter.append(0)
|
||||
else:
|
||||
break
|
||||
if len(valcounter) > 1:
|
||||
for n, x in enumerate(valcounter):
|
||||
layerlists[num + n] = replacement
|
||||
layerlist_counted[num + n] = replacement
|
||||
layerlist_firstorig[num + n] = replacement
|
||||
layerlist_counted[num] = str(len(valcounter)) + " " + countUnit
|
||||
layerlist_firstorig[num] = val
|
||||
|
||||
|
||||
out_list_1.append(layerlists)
|
||||
out_list_2.append(layerlist_counted)
|
||||
out_list_3.append(layerlist_firstorig)
|
||||
|
||||
# Assign your output to the OUT variable.
|
||||
OUT.append(out_list_1)
|
||||
OUT.append(out_list_2)
|
||||
OUT.append(out_list_3)
|
||||
#OUT = out_list
|
||||
Reference in New Issue
Block a user