.txt file to Points to cubes

Hi, I have a text file with x,y,z coordinates of points. I would like to import and draw cubes on those locations.

I am struggling with importing the points and converting them to box.

thanks in advance

I want to make into an object like this
VOLUME 2.stl (3.4 MB)

The import in rhino looks likes this.
img11

What have you tried so far? You need a Read File component, set the path and then you have each line of text. Then you use the Text Split component and split by “,”. Now you have a list with all the coordinates.

Turn the coordinates into points and place a cube on it.

If we can’t see what you have tried, its kind of hard to know what part you are struggling with…

1 Like

Hey Seltzdesign,

Thank you for your reply.
I am pretty new to grasshopper.
I have been able to only do the following.

i’m going to try to do this in python, due to the regex component i put in. You can put in stardard Gh components that would do the Text Regex Split in the meanwhile.

x: 31, y: 45, z: 1
x: 22, y: 1, z: 11
x: 80, y: 80, z: 17
x: 45, y: 40, z: 22
x: 99, y: 22, z: 31
x: 40, y: 31, z: 45
x: 17, y: 99, z: 40
x: 11, y: 77, z: 77
x: 1, y: 11, z: 80
x: 77, y: 17, z: 99

Hey Rickson,

thank you, it worked.

I have a continued question.

I want to make a box/ cube on the point. The point has to be the centre of the cube.

Can somebody tell me which command in rhino to use? As when I use centre box, it makes it as the base plane and draws 4 cubes at the point. I want to one cube with the point being the centre.

Thanks in advance.

only took me an hr but i think i got it…


import ghpythonlib.treehelpers as th

newList = []

for line in orgList:
    vec = line.split(", ")
    subList = []
    newList.append(subList)
    for text in vec:
        num = text.split(": ")
        n = int(num[1])
        subList.append(n)
    print subList


a = th.list_to_tree(newList, source=[])
1 Like

The final solution :