is there any way to find out how many modules used in the envelope?
I need the total number of md1,md2 and m3
is there any way to find out how many modules used in the envelope?
I need the total number of md1,md2 and m3
You could opt for a GhPython block that iterates through the entries and looks for specific substring (md1/ md2/ md3). I don’t got the plug-in you’re using but simulated it. It’s best practice on a request on the forums to also add a test script.
Make sure to flatten the output, as now it’s in a tree structure.
# option one with simple for loop
md1 = 0
md2 = 0
md3 = 0
for item in list:
if "md1" in item:
md1 += 1
if "md2" in item:
md2 += 1
if "md3" in item:
md3 += 1
# option 2 using a dictionary
#count_dict = {"md1": 0, "md2": 0, "md3": 0}
#
#for item in list:
# for key in count_dict:
# if key in item:
# count_dict[key] += 1
#
#md1 = count_dict["md1"]
#md2 = count_dict["md2"]
#md3 = count_dict["md3"]
module_length.gh (11.7 KB)
@
project.gh (26.9 KB)
here is the script
Did you already test the above solution? Connecting the GhPython block with the flattened output of Slots?
I assume that’ll do what you want to do.