Rhinopython: Guid has no attribute __float__

Ahoy Sailors!

I have a strong background in Grasshopper and I´m starting to train myself in rinopython as a personal challenge.

I was trying to create a script that rotates two objects from two different centerpoints but I got the following error:

Message: 'Guid' object has no attribute '__float__'

Traceback:
  line 652, in coerce3dpoint, "C:\Users\xx\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py"
  line 1492, in RotateObjects, "C:\Users\xx\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
  line 14, in RotarColumnas, "C:\Users\xx\Documents\Python Scripts\rotatetest.py"
  line 22, in <module>, "C:\Users\xx\Documents\Python Scripts\rotatetest.py"

In the name of Neptune… what is a GUID?

Here´s the code:

import rhinoscriptsyntax as rs

class rotate:
    
 
    def __init__ (self,_columnas, _points):
        self.columnas = _columnas
        self.points = _points
    
    def RotarColumnas(self):
        columnasId = [(self.columnas)]
        print(columnasId)
        
        rs.RotateObjects(columnasId, self.points, 45.0, None, False)



columnas = rs.GetObjects('select', 16)
points = rs.GetObjects('select', 1)

obj01 = rotate(columnas,points)
obj01.RotarColumnas()

Best regards,
Sir Ernest Shackleton

Looks like you may have to coerce your inputs into the actual objects you are expecting. I don’t actually have much experience using rhinoscript syntax, but a starting point would be to use rs.coercebrep() and rs.coerce3dpoint() functions. Based on the names you may have to coerce each object individually using a list comprehension like self.columnas = [rs.coercebrep(c) for c in _columnas]

Solved!
All i had to do was create a for loop.

import rhinoscriptsyntax as rs

class rotate:
    
    #definir el inicio y las variables necesarias (_dentro y fuera)
    def __init__ (self,_columnas, _points):
        self.columnas = _columnas
        self.points = _points
    
    def RotarColumnas(self):
        
        count = 0
        for column in columnas:
            rs.RotateObjects(self.columnas[count], self.points[count], 45.0, None, False)
            count += 1 




columnas = rs.GetObjects('select', 16)
points = rs.GetObjects('select', 1)

obj01 = rotate(columnas,points)
obj01.RotarColumnas()
2 Likes