Is it possible to extrude equally in both directions?

Is it possible to extrude equally in both directions?

MayaNZ01
Enthusiast Enthusiast
818 Views
2 Replies
Message 1 of 3

Is it possible to extrude equally in both directions?

MayaNZ01
Enthusiast
Enthusiast

Is it possible to extrude equally in both directions? Or is there a script that can already do this? Would be very useful in a lot of scenarios when modeling, and particularly when bringing in garments from MD

0 Likes
Accepted solutions (1)
819 Views
2 Replies
Replies (2)
Message 2 of 3

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

I don't think there is a standart tool to do that in Maya.

 

If this is only about giving clothing from MD some thickness, I wrote a script for that a while back.

But it was only for my own workflow, so it is pretty limited and only works if you select all the faces of the object at the same time.

import maya.cmds as mc

def extrudeFlatObjBothDirections(thick = 0, tz = 0):
    """
    Extrudes selected faces in both directions.
    WARNING: only works properly if all polygons of object are selected
    """
    sl = mc.ls(selection = True) or []
    l = mc.ls(selection = True, fl = True) or []
    
    ext = mc.polyExtrudeFacet(sl[0], kft = True, thickness = thick, ltz = tz, sma = 30, taper = 1, d = 1, ws = True)
    mc.setAttr('{0}.reverseAllFaces'.format(ext[0]),1)
    ext = mc.polyExtrudeFacet("{0}[{1}:{2}]".format(sl[0].split("[")[0],len(l), 2*len(l)-1), kft = True, thickness = thick, ltz =tz, sma = 30, taper = 1, d = 1, ws = True)
    mc.setAttr('{0}.reverseAllFaces'.format(ext[0]),1)

    
extrudeFlatObjBothDirections(thick = 0, tz = 0.1)  

the arg "thick" defines thickness and "tz" defines Translate Z, depending on the mesh one or the other will give you better results.

 

I hope this helps!

0 Likes
Message 3 of 3

MayaNZ01
Enthusiast
Enthusiast

This works amazing, thank you so much for sharing 🙂

0 Likes