Interation coding

Capture

Hello eveyone,

Can you help me solve the problem of this node.
It say “closeparen” but I can’t find a place to input.

Any help would be appreciated.

@dongthl

image

1 Like

Capture

Thank you!

After some changes I get this node which create 20 point at the z=-1 and 16 points at z=1.
Though this node only give me 1 point at (0,0,-1)
Do you have any ideal?

1 Like

@dongthl not sure. DS gives me headaches :grin:

You could try in python:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

OUT=[]
for i in range(IN[0]+1):
	for j in range(IN[0]+1):
		if i==0 or i==IN[0] or j==0 or j==IN[0]:
			OUT.append (Point.ByCoordinates (i,j,-1))
		else:
			OUT.append (Point.ByCoordinates (i,j,1))
1 Like

Thank again!

I’m new to python so it will take time to understand your code.
I will learn python because it is clean and easy to understand :smile:

I still want to know how to solve my code though :confused:
they are missing something and it’s so anoying

@dongthl What about this:

num=5;
i=0..num;
j=0..num;
(i==0 || i==num || j==0 || j==num)
? Autodesk.Point.ByCoordinates(i<1>, j<2>, -1)
:Autodesk.Point.ByCoordinates(i<1>, j<2>, 1);
2 Likes

Many thank again!

The code work to me, but the result is different from the Python earlier.
And can you explain a bit about i<1> or j<2> part?

@dongthl Great!:grinning:

I wasn’t sure of what output you were expecting and your end goal

Look at this short gif and look into Replication guides.

Please mark the topic as solved