MFnNurbsSurface Crash

110 views
Skip to first unread message

Rémi Deletrain

unread,
Sep 9, 2015, 4:24:37 AM9/9/15
to Python Programming for Autodesk Maya
Hello everyone,

I am trying to retrieve a position of a uv nurbssurface from a point in space.
For this I use the Maya API.

I tried with a mesh and it works very well. The problem I have with the nurbssurface is that when I run my script Maya plant ...
Is someone already had this problem?

That's the code:

------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

shape = 'nurbsSphereShape1'

dag_path = maya_api_utils.get_dag_path(shape)
mfn_nurbs = OpenMaya.MFnNurbsSurface(dag_path )

point = OpenMaya.MPoint(0.0, 3.116, 4.508)
u = MScriptUtil().asDoublePtr()
v = MScriptUtil().asDoublePtr()

toto = mfn_nurbs.getParamAtPoint(point, u, v, False)

------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

Jefri Yeh

unread,
Sep 9, 2015, 7:37:54 AM9/9/15
to python_in...@googlegroups.com
you need to separate the MScriptUtil  instancing to preserve the pointer.

uutil = MScriptUtil()
u = uutil.asDoublePtr()
vutil = MScriptUtil()
v = vutil.asDoublePtr()




--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9e5948c9-9486-4ab7-b097-0324ac93cae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rémi Deletrain

unread,
Sep 9, 2015, 9:13:12 AM9/9/15
to Python Programming for Autodesk Maya
Actually I do not have the crash problem. Many thank you r4inm4ker!

But now I have an error :
# RuntimeError (kInvalidParameter): value not valid in ranks #

while I give (MPoint, double, double, bool).

Well I guess the problem is MPoint, but I do not understand why.
He requested a position and I give him a Vector3 or Vector4 it's the same ...

Jefri Yeh

unread,
Sep 9, 2015, 9:29:37 AM9/9/15
to python_in...@googlegroups.com
I think that's because you are giving the MPoint position outside the nurbs surface range. Try pick a point on the surface and run it again. I've quickly tested it and that seems to be the reason of # RuntimeError (kInvalidParameter): value not in valid range #  error.

--
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 python_inside_m...@googlegroups.com.

Rémi Deletrain

unread,
Sep 9, 2015, 10:53:19 AM9/9/15
to Python Programming for Autodesk Maya
This is actually due to the tolerance ...
Thank you very much again !!!

Le mercredi 9 septembre 2015 10:24:37 UTC+2, Rémi Deletrain a écrit :
Reply all
Reply to author
Forward
0 new messages