I’m very new to Dynamo (only started with it this week) so I’m sure there’s a simple solution to the issue I’m having;
I have a list of items and I would like to translate the values. I know there’s a ‘TakeNthItem’ function, but I want to take every 2 repeating lines. So for instance, from the above image;
So I want t add 7 to List Items [0,1,4,5,8,9…etc]
And I want to subtract 7 from [2,3,6,7,10,11…etc]
As you can see I’ve used a big code block to brute force the issue, but obviously I want to refine that.
I’m sure there’s a simple notation within the code block that will do it, but I just can’t figure it out.
If anyone could help, that would be greatly appreciated.
If I have understood correctly, you could do something like this but it’s really bad Python, can someone help? XD @jostein_olsen
lst = IN
lst1, lst2 = lst[0::3], 
lst2.extend(set(lst) - set(lst1))
nlst1, nlst2 = , 
for x in lst1:
for x in lst2:
OUT = lst1, lst2, nlst1, nlst2
I’m sure we can help you with this spesific problem, but it feels like there may be some data management issues further upstream? If you could show us some more of the graph, maybe the issue can be resolved further up.
So effectively I have several floors of a building, and I’m trying to determine new areas of each floor.
So I’m translating the X and Y points to create smaller floor areas.
My output actually works, I’m more trying to make it simpler and easier to use.
Well, something like this for instance? Offset+ is from the Springs package
My first reply was completely wrong, I felt I had to have another go after re-reading what you’ve said. This is what I came up with.
It chops the list into pairs, see if they equal each other and returns true or false, then apply + 7 to true and -7 to false whilst keeping the index correct. Again, there’s a better way to do this but it’s all I can do.