To convert a string to float, just wrap it in float(), like this:
x = "1.234"
y = float(x)
I'm not sure why you need to do this though since localPositionX is a
float attr. getAttr() should be returning a float value, not a string.
locator = cmds.createNode('locator')
selX = cmds.getAttr(locator+'.localPositionX')
type(selX)
# Result: <type 'float'> #
On Tuesday, June 12, 2012 3:45:21 PM UTC-7, pipo pescattore wrote:
Hello, I have a locator which I get his localPosition by using this command=
selX = cmds.getAttr(locator+'.localPositionX')
the thing is that I need to pass that parameter to this function that only accepts floats
cmds.polyCreateFacet( p=[(0,0,0), (2,1,2), (2,2,3)] )
I tried doing this
cmds.polyCreateFacet( p=[(selX,0,0), (2,1,2), (2,2,3)] )
but did not work
how can I convert the string value and pass that parameter to the polyCreateFacet input?
Thanks