Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Scaling an edge selection to a certian size?
  RSS 2.0 ATOM  

Scaling an edge selection to a certian size?
Rate this thread
 
36181
 
Permlink of this thread  
avatar
  • Location: Toronto, Ontario, Canada
  • Total Posts: 40
  • Joined: 28 February 2007 11:24 AM

I have an editable poly object with a loop of edges selected.  I’m trying to set it’s length to a new value, scaling the edges around a point.  Does anyone have any suggestions on how to do this?

This code will select the loop and then return it’s current length, but I’m not sure how to go about scaling it to match a specified value.

fn SelectLoop obj =
 
(
 obj
.buttonOp #SelectEdgeLoop
 
baSel obj.GetSelection #Edge
 
total 0.0
 edgeCount 
obj.GetNumEdges()
 
for 1 to edgeCount do
 
(
 
if baSel[i] == true then
 (
 vert1 
obj.GetVertex(obj.GetEdgeVertex i 1)
 vert2 
obj.GetVertex(obj.GetEdgeVertex i 2)
 total 
+= distance vert1 vert2
 )
 )
 
print (units.formatValue total) as string
 )


Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

I don’t think that will work. Your “length” is a sum of distances - a derived value - the only way to change the “length” would be to move the attached vertices which will, in turn, affect the length.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 1
/img/forum/dark/default_avatar.png

Yes, that’s essentially what I’m trying to do.  Scale the edges up or down by a value to make them total a specific length.

Author: WillyWonka

Replied: 31 October 2009 02:27 AM