Jump to content

Relax only Z axis

Chris MacDonald

Recommended Posts

  • 9 months later...

I found this on another forum, might be useful


You have to be in an editable poly, select the vertex you want to "Z-Relax", then launch the script


(open listener, copy paste the code, select the code and drag & drop on a toolbar to create a button)




Relaxes verts only along the Z axis

2008 [email]shannont@pbworld.com[/email]

adjusted to only work on selected verts by Dave Buchhofer [email]dbuchhofer@gmail.com[/email] 01-2009

--local theQuery = queryBox "This will convert your object into an editable poly.\nALL modifiers will be lost!\nDo you still want to do this?"
--if theQuery != false do 
fn geomFilt o = (superClassOf o == GeometryClass)

local theSourceObject = selection[1]

if (ClassOf theSourceObject == Editable_Poly) and (subobjectLevel == 1) and (theSourceObject.selectedVerts.count != 0) then
--Copy our object to a new one
local theCopy = copy theSourceObject

verts = theCopy.selectedVerts as bitarray

--set the relax settings
theCopy.relaxAmount = .25
theCopy.relaxIterations = 4
theCopy.relaxHoldOuterPoints = false
theCopy.relaxHoldBoundaryPoints = false
theCopy.EditablePoly.Relax selLevel:#Object

--Change the Z values for all the original verts based on the z value of the relaxed object
for v in verts do
theOriginalVertPos = polyOp.getVert theSourceObject v
theNewVertPos = polyOp.getVert theCopy v
theZrealxedPos = [theOriginalVertPos.x,theOriginalVertPos.y,theNewVertPos.z]
polyOp.setVert theSourceObject v theZrealxedPos

delete theCopy
select theSourceObject
subobjectLevel = 1
)else messagebox "Z relax currently only works on Collapsed Editable Poly objects\nand requires a selection at the vertex level."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...