Bumping post in 2016 :) Just stumbled upon this thread after seeing this is still an issue. I'm wondering if anyone else is experiencing it.
I am using an instance of NurbsSurface and not calling the class itself, like so: import pymel.core as pm import maya.cmds as cmds plane = cmds.nurbsPlane(ch=False)[0] pos = pm.dt.Point(0,0,0) shape = pm.PyNode(plane) shape.closestPoint(pos, space='world') Thus triggering: # Error: TypeError: file /usr/autodesk/maya2016/lib/python2.7/site-packages/pymel/internal/factories.py line 1782: unbound method get() must be called with SafeApiPtr instance as first argument (got list instance instead) # On Thursday, May 7, 2015 at 4:30:44 PM UTC-5, Ryan J Roberts wrote: > > Hi Justin, > > That pretty much is the complete example using pymel. I ran into this > issue pretty quickly. In the pymel docs, under nodetypes, you can find the > nurbsSurface node information and all its methods. Some methods seem to > work pretty easy, like the "getPoints()" method, but "closestPoint()" seems > to have a requirement I don't fully understand. The pymel nodetypes seem > to have a lot of connections to the api, and I think SafeApiPtr makes a > different type of variable than the normal python variable. > > > On Thursday, May 7, 2015 at 12:45:50 PM UTC-7, Justin Israel wrote: >> >> Can you show a complete and concise example of the problem? It seems like >> you are calling closestPoint() on the Nurbsurface class and not an >> instance. Either that or a bug. I wouldn't think you should need to worry >> about the SafeApiPtr stuff as that is probably internal and it is referring >> to a problem of not being called on a valid instance. >> >> On Fri, 8 May 2015 7:30 AM Ryan J Roberts <[email protected]> wrote: >> >>> So I'm trying to use pymel to get information about a point on a >>> nurbsSurface. First I make a PyNode >>> >>> nurbsSurface = pm.PyNode('nurbsPlaneShape1') >>> >>> which allows me at to use all the methods in the pymel nurbsSurface >>> nodetype. >>> >>> I'm able to get some information with no problem, but I'm trying to use >>> the method nurbsSurface.closestPoint(), and I'm giving it a list of 3 >>> numbers. >>> >>> closestPoint = surf.closestPoint( [0.1, 0.3, 0.2] ) >>> >>> and it's giving me this error: >>> >>> *unbound method get() must be called with SafeApiPtr instance as first >>> argument (got list instance instead)* >>> >>> Does anyone have any experience with *SafeApiPtr*? I'm having problems >>> finding out what it is and how to use it. >>> >>> Any help would be greatly appreciated :-) >>> >>> -- >>> 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 view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/5fb010d7-5ef3-45f8-9b78-6772ad1a2fdd%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/python_inside_maya/5fb010d7-5ef3-45f8-9b78-6772ad1a2fdd%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/73681b39-44ad-4b3e-947a-b3b694d03c4f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
