Count to a certain number and start over

I have a script that counts to 6 and starts over. However, What should I change or how to get this effect on dynamo blocks. I would like to receive such a result:
1.1
1.2
1.3
1.4
1.5
1.6
2.1
2.2
2.3
2.4

Hi @seba11

Maybe I made it too complicated, please consider it as one sample case.
Home.dyn (18.9 KB)

1 Like

I just found the python script return list is different to my code block script.
To get same result, You may change the script to this:

start;
stop;
point;
[Imperative]{
	out=[];
	index=0;
	value=1;
	for (i in start..stop){
		if (value>point){
			value=1;
		}
		out[index]=value;
		index=index+1;
		value=value+1;
	}
return out;
};

3 Likes

Another approach. I think mine is a little cleaner. :slightly_smiling_face:

1 Like

Yeah, it’s ok too. Tanks! I have one question. What is DSCore?

I posted it to show it can be done without Python (for people who don’t know Python).

Don’t know how to explain this, but i’ll give it a try.
I have some Custom Packages installed which also have Math nodes.
If i just write Math.Ceiling i get errors. Therefor i put DSCore in front of it
so’ it uses the OOTB Math’(?).

(Someone please correct me here if i am wrong)

image

image

DSCore is basically a stand in for stating “Dynamo Core”, and in this case is the declaration of the namespace (Library) which we want to call the Math module from.

It helps to remember that computers can only take action with clear instructions. If anything is in a grey area, they’ll fail.

In that way you can think of the computer like you would my young niece, and the operating environment like my brother’s garage. Stating “Math.Ceiling” is basically telling my niece to “Go to the toolbox (Math) and take out the flat head screw driver (Ceiling)”. This works well in the basic setup where I open up one just the red tool box (the default environment), but it falls apart if I add the blue toolbox (at last count) tool boxes in my brother’s garage. At that point my niece looks at me and goes to talk to her Dad; The warning which @bvs1982 described is basically Dynamo’s way of saying “this isn’t clear, you’re silly and I’m sort of scared to get it wrong, so I’m gonna go do something else.” By saying “DSCore” we change the instructions to “Go to the red (DSCore) toolbox (Math) and take out the flat head screw driver (Ceiling)”, and we get the right tool without any confusion.

1 Like