Convert Geo Selection to num?

   689   1   0
User Avatar
Member
97 posts
Joined: May 2015
Offline
How do i convert the selection i selected to a int number? i keep getting errors.

-TypeError: int() argument must be a string or a number, not ‘GeometrySelection’
-TypeError: %d format: a number is required, not GeometrySelection

trying to change teh position of the point selected with:
self.node.parmTuple("pt%d" % ptnum).set(position)// ptnum is the point i selected but says the second error
// when i print sel = kwargs['selection'] i get the right number the one i selected.

self.CurrentPt = int(sel) //Gives me the first error
User Avatar
Member
97 posts
Joined: May 2015
Offline
Ok got it my solution was this:

sel = kwargs['selection']

 selection = sel.selections()[0]
 count = selection.numSelected()
 namept = selection.selectionString(geo)
 self.CurrentPt = int(namept)
  • Quick Links