Bug or my Fault?


#1

Hi Steve
i have two point at coordinate -2,0,0 and 0,12,0

the below Python code:

import rhinoscriptsyntax as rs
#points=rs.GetPoints(" get points")
pp=rs.GetObjects("seleziona punti")
points=[]
for p in pp:
    cc=rs.PointCoordinates(p)
    points.append(cc)

newp=[]
for el in points:
    u=points.pop()
    points.insert(0,u)
    print points
    newp.append(points)  # append only last points

for xx  in newp:
     print xx

return this result :


<Rhino.Geometry.Point3d object at 0x0000000000000560 [0,12,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000561 [-2,0,0]>]
[<Rhino.Geometry.Point3d object at 0x0000000000000562 [-2,0,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000563 [0,12,0]>]
[<Rhino.Geometry.Point3d object at 0x0000000000000564 [-2,0,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000565 [0,12,0]>]
[<Rhino.Geometry.Point3d object at 0x0000000000000566 [-2,0,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000567 [0,12,0]>]

but for me as Bug because print xx print only the last point
Ciao Vittorio


#2

Hi Vittorio,

I don’t quite understand what you’re trying to do… however, with

newp.append(points)

“points” is a list, so you are appending a list to “newp” (which is empty), so it becomes a nested list… perhaps you want

newp.extend(points)

instead? But I still don’t understand what kind of result you want…
–MItch


#3

Hi Mitch

In the attached example scrolling works, but with the points does not work. I do not understand why.
Ciao Vittorio

# example: shift of circular register 
reg=[1,2,3,4,5]
for i in reg:
    u=reg.pop()
    reg.insert(0,u)
    print reg


[5, 1, 2, 3, 4]
[4, 5, 1, 2, 3]
[3, 4, 5, 1, 2]
[2, 3, 4, 5, 1]
[1, 2, 3, 4, 5]




#4

Hi Mitch
I resolved my problem .Was my fault.
The below code is OK

import rhinoscriptsyntax as rs
#points=rs.GetPoints(" get points")
pp=rs.GetObjects("seleziona punti")
points=[]
for p in pp:
    cc=rs.PointCoordinates(p)
    points.append(cc)

newp=[]
for el in points:
    u=points.pop()
    points.insert(0,u)
    print points
    hh=points[:]
    newp.append(hh)  # append only last points

for xx  in newp:
     print xx

Ciao Vittorio