... That is:

a = wPos0[12:15]
b = wPos1[12:15]
c = wPos2[12:15]

cmds.polyCreateFacet( point=[a,b,c] )


On Tue, Mar 12, 2013 at 11:42 AM, Justin Israel <[email protected]>wrote:

> a1 = "%.3f" %wPos0[12]
>
> That is actually a string representation of a float to a precision of 3.
> So you are passing a string, but thought it was a float because of the
> print out. You should simply do:
>
> a1 = wPos0[12]
>
> or if you wanted to round to 3 precision:
> a1 = round(wPos0[12], 3)
>
> or just get your points like this:
>
> a = wPos0[12:15]  # a tuple of 3 floats
>
>
>
> On Tue, Mar 12, 2013 at 11:13 AM, Amol Deshpande <[email protected]>wrote:
>
>> Ya..Here is the code- [Haven't used any loops just for testing purposes]
>>
>> I select three joints in a hierarchy & then run the following script-
>>
>> import maya.cmds as cmds
>> selJoints = cmds.ls(selection=True)
>> print selJoints
>>
>> wPos0 = cmds.xform(selJoints[0], query=True, matrix=True, worldSpace=True)
>> print wPos0
>> a1 = "%.3f" %wPos0[12]
>> a2 = "%.3f" %wPos0[13]
>> a3 = "%.3f" %wPos0[14]
>> print a1
>> print a2
>> print a3
>>
>>
>> wPos1 = cmds.xform(selJoints[1], query=True, matrix=True, worldSpace=True)
>> print wPos1
>> b1 = "%.3f" %wPos1[12]
>> b2 = "%.3f" %wPos1[13]
>> b3 = "%.3f" %wPos1[14]
>> print b1
>> print b2
>> print b3
>>
>>
>> wPos2 = cmds.xform(selJoints[2], query=True, matrix=True, worldSpace=True)
>> print wPos2
>> c1 = "%.3f" %wPos2[12]
>> c2 = "%.3f" %wPos2[13]
>> c3 = "%.3f" %wPos2[14]
>> print c1
>> print c2
>> print c3
>>
>>
>> cmds.polyCreateFacet( point=[(a1,a2,a3),(b1,b2,b3), (c1,c2,c3)] )
>> cmds.CenterPivot("polySurface1")
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to