object vector scale

8 views
Skip to first unread message

delibrax

unread,
Jul 11, 2021, 1:06:30 AMJul 11
to Python Programming for Autodesk Maya
Hi guys,

I would like to scalling the object nurbsCurves by moving the cv's using vector. So everything is alright unless the  object transform has rotation. Here is the script that I've created:

def scaling_object(value, object):
    object_curve = pm.PyNode(object)
    for cv in object_curve.getShape().cv:
        position_ws = pm.xform(cv, q=True, ws=True, t=True)
        position_os = pm.xform(cv, q=True, os=True, t=True)

        vector_ws = pm.dt.Vector(position_ws[0], position_ws[1], position_ws[2])
        vector_os = pm.dt.Vector(position_os[0], position_os[1], position_os[2])

        final_position = vector_ws + (vector_os * value)

        pm.move((final_position[0]), (final_position[1]), (final_position[2]), cv)

I need advise about rotation in vector things. Thanks in advance!

Reply all
Reply to author
Forward
0 new messages