I was making a maya python script which intends to turn jagged lines(or faces) into straight lines(or flatten faces).
Just like the picture below:
I was thinking that I can relatively scale all selected components in x and z axes,so the result will align to y axis.
This is my code:
import pymel.core as pm
#sel = cmds.ls(sl=True)
pv = pm.manipScaleContext('Scale',q=True,p=True)
pm.scaleComponents(1e-05,1,1,p=pv)
But it doesn’t work at all.
I can get the pivot of the selected components.It seems the scaleComponents
didn’t work as expected.I also tried the scale
funtion,same result.The jagged lines are still there.
Is there any mistake in my code?
Other solutions are also welcomed.