Help setEdgeSmoothings() crisis

37 views
Skip to first unread message

justin hidair

unread,
Mar 15, 2017, 9:05:08 PM3/15/17
to Python Programming for Autodesk Maya

import maya.OpenMaya as om

msh=om.MSelectionList()
om.MGlobal.getActiveSelectionList(msh)

mshdp=om.MDagPath()
msh.getDagPath(0,mshdp)

meshfn=om.MFnMesh(mshdp)

edgelist=om.MIntArray()
for i in xrange(meshfn.numEdges()):
    edgelist.append(i)
smooths=om.MIntArray(edgelist.length(),1)

meshfn.setEdgeSmoothings(edgelist,smooths)
meshfn.cleanupEdgeSmoothing()

trying to get every edges to  be smooth , and getting this error :

// Error: setEdgeSmoothings

# Traceback (most recent call last):

# File "<maya console>", line 16, in <module>

# File "S:\Maya_2017_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 6041, in <lambda>

# File "S:\Maya_2017_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 54, in _swig_getattr

# AttributeError: setEdgeSmoothings //


with no feedback on what's wrong, setEdgeSmoothings don't work in Python ? both edgelist and smooths have equal length...


what's the doc says :


MStatus setEdgeSmoothings


( const MIntArray edgeIds,


const MIntArray smooths 

)

This method sets the specified edges to be hard or smooth (soft).

You must use the cleanupEdgeSmoothing method after all the desired edges on your mesh have had setEdgeSmoothing done. Use the updateSurface method to indicate the mesh needs to be redrawn.

Parameters
[in]edgeIdsThe edges to set the smoothing information for
[in]smoothsIf true the edges will be smooth (soft), otherwise the edges will be hard.
Returns
Status code
Status Codes:

Justin Israel

unread,
Mar 15, 2017, 11:51:32 PM3/15/17
to python_in...@googlegroups.com
On Thu, Mar 16, 2017 at 2:05 PM justin hidair <justin...@gmail.com> wrote:

import maya.OpenMaya as om

msh=om.MSelectionList()
om.MGlobal.getActiveSelectionList(msh)

mshdp=om.MDagPath()
msh.getDagPath(0,mshdp)

meshfn=om.MFnMesh(mshdp)

edgelist=om.MIntArray()
for i in xrange(meshfn.numEdges()):
    edgelist.append(i)
smooths=om.MIntArray(edgelist.length(),1)

meshfn.setEdgeSmoothings(edgelist,smooths)
meshfn.cleanupEdgeSmoothing()

trying to get every edges to  be smooth , and getting this error :

// Error: setEdgeSmoothings

# Traceback (most recent call last):

# File "<maya console>", line 16, in <module>

# File "S:\Maya_2017_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 6041, in <lambda>

# File "S:\Maya_2017_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 54, in _swig_getattr

# AttributeError: setEdgeSmoothings //


with no feedback on what's wrong, setEdgeSmoothings don't work in Python ? both edgelist and smooths have equal length...


I don't have Maya 2017 to confirm, but this error seems to indicate that setEdgeSmoothings() is not even included in the Python bindings on MFnMesh. Maybe they named it something else?
 


what's the doc says :


MStatus setEdgeSmoothings


( const MIntArray edgeIds,


const MIntArray smooths 

)

This method sets the specified edges to be hard or smooth (soft).

You must use the cleanupEdgeSmoothing method after all the desired edges on your mesh have had setEdgeSmoothing done. Use the updateSurface method to indicate the mesh needs to be redrawn.

Parameters
[in]edgeIdsThe edges to set the smoothing information for
[in]smoothsIf true the edges will be smooth (soft), otherwise the edges will be hard.
Returns
Status code
Status Codes:

--
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/6b26af6d-d8c1-4b2d-b8a1-5a6f1496786f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

justin hidair

unread,
Mar 16, 2017, 2:03:24 PM3/16/17
to Python Programming for Autodesk Maya
I was running it in 2017 , Python 2.0 api got it apparently
"
OpenMaya.MFnMesh.setEdgeSmoothings

(
)
setEdgeSmoothings(edgeIds, smooths) -> self

Sets the specified edges to be hard or smooth. You must use the
cleanupEdgeSmoothing() method after all the desired edges on your
mesh have had setEdgeSmoothings() done. Use the updateSurface() method
to indicate the mesh needs to be redrawn."

there is no reason for Python 1.0 to not have such a simple thing, I searched on google before and no one talks about edge smoothing in the API..


edit : OMG It's a new feature in Maya 2017 Update 3

here is it :

http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_GUID_20D778B6_325A_4B06_B4A8_AE60D8DAB43D_htm

guess I'll have to use setEdgeSmoothing without the s for compatibility matters

thanks!

justin hidair

unread,
Mar 16, 2017, 2:49:44 PM3/16/17
to Python Programming for Autodesk Maya
also wanted to add that it is incredibly slow, so maya.cmds.polySoftEdge is the way to go...
Reply all
Reply to author
Forward
0 new messages