Scale Edges To Specific Lengths ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2018
Scale Edges To Specific Lengths ?

Hi everyone.

I am looking for a way, to scale one or preferably multiple edges of an objecttoa specific length or in other words: Unify their length.
I have a number of edges on an object, each with unique position and rotation, that need to be the same length.
It seems there is no built in optionso scripting seems to be the best bet.
I was looking into python already, but my knowledge is pretty much non existing, let alone MEL so i had little success.
I was able to scale an edgebybut nottoa certain value and couldnt get it to work the other way around.

Here is what i did, which may or may not be complete nonsens as i have no clue what i am doing:
I built 2 functions. One to get the length of an edge (credit belongs here:
and one to set the length to the value that i get from the first function.

def getEdgeLengthFunc (*pArgs):
global referenceLength
referenceLength =[],fl=True)
print 'Reference Length=',referenceLength

def setLengthFunc (*pArgs):,fl=True)
lengthToSet=abs(referenceLength - initialLength)
cmds.scale( 0.0, lengthToSet, 0.0, cs=True )

What am i missing here ?

Last edited by DavidFalke : 03 March 2018 at 05:20 PM.
  03 March 2018
Ok, in case someone needs this working in the future, here is what messed up my code.
swap "lengthToSet=abs(referenceLength - initialLength)" for "lengthToSet=abs(referenceLength / initialLength)"

... and it works.
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:37 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.