That there is a bug. here's some background, if you care:
pymel parses the api documentation to learn about the arguments of the api methods, because this cannot be gleaned through typical python inspection. The problem is that the api documentation contains many, many errors when it comes to specifying whether an argument is an input, or an output passed by reference c-style. from the docs: [in] toThisPoint The point to test [in] paramAsStart If true use the value pointed to by param as a starting point for the search. [in] param pointer to a double. If non-null, on successful returns this will contain the parameter value of the returned point. [in] tolerance The amount of error (epsilon value) in the calculation [in] space Specifies the coordinate system for this operation [out] ReturnStatus Status code as you can see 'param' as marked as an input, but it's actually an output (aka a result). the good folks at autodesk are working on fixing this. Isn't that right, guys? :) when pymel generates the cached 'bin' files from the docs, it uses an algorithm that checks names, number of outputs, descriptions, etc, to attempt to detect correct these mistakes. it also contains a manually maintained list of overrides. in this case, we'll have to manually fix it. to fix this we would correct closestPoint to always return 2 values, a tuple of (Point, float). in pymel, you should never have to pass values by reference. if you find that you have to, there's something wrong. -chad On Aug 26, 2009, at 3:43 PM, hapgilmore wrote: > > First off, i'm new to pymel, but loving how much it improves python in > maya. > > I have a nurbsCurve PyNode, and a point (float array) and i'd like to > get the param value of the closest point. > > I cant figure out the syntax to get this to work. > > This works, but returns a point(float array): > <code> > point = [1,1,1] > closestPoint = myNurbsCurve.closestPoint(point) > </code> > > This doesn't: > <code> > point = [1,1,1] > param = 0.0 > closestPoint = myNurbsCurve.closestPoint(point,param) > </code> > > Neither does this: > <code> > point = [1,1,1] > su = OpenMaya.MScriptUtil() > paramPtr = su.asDoublePtr() > closestPoint = myNurbsCurve.closestPoint(point,paramPtr) > param = su.getDouble(paramPtr) > </code> > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
