Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5844

One-Dimensional Array Query

$
0
0

@brobes05 wrote:

Hello,

I have a simple attractor script. When I append the 'i' and 'j' loop values to tuples in the main list, I am unable to use the tuples as point3D objects. I thought that many functions that required 3d point objects would also accepts tuples.

Anyway, when I create another for loop and choose the 'ptlist[i]', it somehow transforms the tuples into point3D objects. This, I don't understand.

import rhinoscriptsyntax as rs
#import random

ptList = []
rs.EnableRedraw(False)

def pointMatrix():
    iMax = 20
    jMax = 20
    k = 0
    
    testPt = rs.GetObject('select Attractor pt', rs.filter.point) 
    
    #loop to create list of short values
    for i in range(iMax):
        for j in range(jMax):
            
            x = i
            y = j
            z = k
            ptList.append([x,y,z])
            
            
    #loop to create circles
    for i in range(len(ptList)):
        distance = rs.Distance(testPt, ptList[i])
        radius = distance / 20
        
        if radius > .5:
            radius = .5
        elif radius < .125:
            radius = .125
        
        
        rs.AddCircle(ptList[i], radius)
        print(ptList[i])
        #here the tuples are now point3D objects or read that way
    
pointMatrix()

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5844

Latest Images

Trending Articles



Latest Images