[Maya-Python] MMeshIntersector grid size

2014-06-17 Thread Janos Hunyadi
Is there any way to set the octree grid size/resolution for MMeshIntersector? Finding closest points on too small objects seem to be problematic. (If its smaller than 1 unit size) Any ideas? -- You received this message because you are subscribed to the Google Groups "Python Programming for A

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Justin Israel
Sorry if this is late info but, the Maya hasAttr is meant to check for the existence of attributes on an object. But these are not functions as everything in Maya command API are string references and you use function calls only to perform certain operations on string references Python has a simil

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Brian Eyre
Oh, weird, I could have sworn i just tried that and it didn't work.. but it works, thanks ;-) On Tuesday, June 17, 2014 3:58:43 PM UTC-7, Kurian wrote: > > I replied already I think :) > > python built in hasattr will also work for you > > import maya.cmds as cmd > > import pymel.core as pm

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
I replied already I think :) python built in hasattr will also work for you import maya.cmds as cmd import pymel.core as pm list = cmd.ls(sl=True) for obj in list: obj = pm.PyNode(obj) print hasattr(obj,'getShape') https://docs.python.org/2/library/functions.html#hasattr On Tue,

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Brian Eyre
Oh, that's brilliant, thanks! Wasn't aware of 'try'.. so this seems to work: import maya.cmds as cmd import pymel.core as pm list = pm.ls(sl=1) for obj in list: obj = pm.PyNode(obj) try: print obj.getShape() except: pm.warning('no shape!') If anyone knows why

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
Just a note hasattr is not a pymel function its a python built in method. https://docs.python.org/2/library/functions.html#hasattr On Tue, Jun 17, 2014 at 3:42 PM, Kurian O.S wrote: > > > import maya.cmds as cmd > > import pymel.core as pm > > list = cmd.ls(sl=True) > > for obj in list: > >

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
import maya.cmds as cmd import pymel.core as pm list = cmd.ls(sl=True) for obj in list: obj = pm.PyNode(obj) print hasattr(obj,'getShape') On Tue, Jun 17, 2014 at 3:40 PM, Kurian O.S wrote: > I didn't use pymel much, but I am not sure you can check a function with > hasAttr. Maybe

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
I didn't use pymel much, but I am not sure you can check a function with hasAttr. Maybe some one will have better idea, I would go for a AttributeError check with try. On Tue, Jun 17, 2014 at 3:35 PM, Brian Eyre wrote: > No, sorry. That returns an error if *obj* happens to have no getShape() >

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Brian Eyre
No, sorry. That returns an error if *obj* happens to have no getShape() method, which is what i'm rying to check for... On Tuesday, June 17, 2014 3:27:16 PM UTC-7, Kurian wrote: > > import maya.cmds as cmd > > import pymel.core as pm > > list = cmd.ls(sl=True) > > for obj in list: > > obj

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
import maya.cmds as cmd import pymel.core as pm list = cmd.ls(sl=True) for obj in list: obj = pm.PyNode(obj) if obj.getShape(): print obj.getShape() Are you looking for this ? On Tue, Jun 17, 2014 at 3:24 PM, Brian Eyre wrote: > It's actually a function that returns the s

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Brian Eyre
It's actually a function that returns the shape node, yes. Do I need a different syntax for that? obj.getShape() definitely works, which is why i'm puzzled. On Tuesday, June 17, 2014 3:20:19 PM UTC-7, Kurian wrote: > > hasAttr will check only for existing attribute. > > import maya.cmds as c

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
http://download.autodesk.com/us/maya/2011help/PyMel/generated/functions/pymel.core.general/pymel.core.general.hasAttr.html On Tue, Jun 17, 2014 at 3:19 PM, Kurian O.S wrote: > hasAttr will check only for existing attribute. > > import maya.cmds as cmd > > import pymel.core as pm > > list = cm

Re: [Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Kurian O.S
hasAttr will check only for existing attribute. import maya.cmds as cmd import pymel.core as pm list = cmd.ls(sl=True) for obj in list: obj = pm.PyNode(obj) print pm.hasAttr(obj,'tx') This will work and what is getShape ?, is it a function ? or is it attribute which is existed in s

[Maya-Python] pm.hasAttr(obj,'getShape') not working, even though obj.getShape() works...

2014-06-17 Thread Brian Eyre
Hi, I'm trying to add a line that error checks for whether the getShape() method exists for selected objects, by using *hasAttr*, but it keeps returning *false* even when getShape() exists for the obj: import maya.cmds as cmd import pymel.core as pm list = cmd.ls(sl=True) for obj in list: