This script comes in 6 macros - rolled into 2 script files. The script flattens splines to an X - Y or Z snap point. You select the spline - select the verts you want affected and then use the command. The script creates 6 commands - Flatten_Spline_X - Flatten_Spline_Y... Fatten_B_Spline_X and so on. The non B version moves the verts to the proper location but will not adjust Bezier Handles. The B version will also flatten the Bezier Handles so that the spline is truly flattened. You can use ESC key of Right Click to cancel. The command is only visible when a spline object is selected. If you select the command while not in vertex sub-object level - nothing happens. If you select the command with no verts selected - nothing happens - but you are in pick destination position mode so you must ESC or Right Click to cancel.
Script
Flatten_Spline_XYZ
By Maneswar Cheemalapati · 2006-10-21
- Version
- 1
- Version requirement
- 7
- Date updated
- 2005-10-01
- Votes
- 24
- External download
- External download
Tags: spline
Description
Additional Info
Hope that makes sense. If not - go to the Discreet / AME 3dsmax forums and post a topic. I'm an FA there so I'll respond once I see it.
Comments (7)
can not download
alexnguyen · 2023-06-07
macroScript Flatten_B_Spline_X
category:"MC_Tools"
internalcategory:"Utilities"
toolTip:"Flatten_B_Spline_X"
buttonText:"Flatten_B_Spline_X"
( --global
On IsVisible Return Filters.Is_EditSpline()
On Execute Do
( --on Execute
local KS = undefined
local PP = undefined
local NS = undefined
local KG = undefined
local KT = undefined
local IV = undefined
local OV = undefined
local SM = undefined
local ST = undefined
local SMV = undefined
local SME = undefined
SM = snapmode.active
if ( SM == true and snapmode.type != undefined ) do ( ST = snapmode.type )
SMV = snapmode.getOSnapItemActive 5 1
SME = snapmode.getOSnapItemActive 5 2
for obj in selection where ( subObjectLevel == 1) do
( --for obj
snapmode.setOSnapItemActive 5 1 true
snapmode.setOSnapItemActive 5 2 true
snapmode.active = true
PP = pickpoint snap:#3D
if ( PP == #escape or PP == #rightClick ) then
( --if escape
) --if escape
else
( --else
NS = numSplines obj
for i = 1 to NS do
( --for i
KS = getKnotSelection obj i
for n = 1 to KS.count where KS.count > 0 do
( --for n
KG = getKnotPoint obj i KS[n]
KT = getKnotType obj i KS[n]
setKnotPoint obj i KS[n] [PP.x, KG.y, KG.z]
if ( KT == #Bezier or KT == #BezierCorner ) do
( --if both
if ( KT == #Bezier ) then
( --if bezier
setKnotType obj i KS[n] #BezierCorner
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [PP.x, IV.y, IV.z]
setOutVec obj i KS[n] [PP.x, OV.y, OV.z]
setKnotType obj i KS[n] #Bezier
) --if bezier
else
( --else
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [PP.x, IV.y, IV.z]
setOutVec obj i KS[n] [PP.x, OV.y, OV.z]
) --else
) --if both
) --for n
) --for i
) --else
updateShape $
) --for obj
snapmode.active = SM
if ( SM == true and ST != undefined ) do ( snapmode.type = ST )
snapmode.setOSnapItemActive 5 1 SMV
snapmode.setOSnapItemActive 5 2 SME
) --on Execute
) --global
macroScript Flatten_B_Spline_Y
category:"MC_Tools"
internalcategory:"Utilities"
toolTip:"Flatten_B_Spline_Y"
buttonText:"Flatten_B_Spline_Y"
( --global
On IsVisible Return Filters.Is_EditSpline()
On Execute Do
( --on Execute
local KS = undefined
local PP = undefined
local NS = undefined
local KG = undefined
local KT = undefined
local IV = undefined
local OV = undefined
local SM = undefined
local ST = undefined
local SMV = undefined
local SME = undefined
SM = snapmode.active
if ( SM == true and snapmode.type != undefined ) do ( ST = snapmode.type )
SMV = snapmode.getOSnapItemActive 5 1
SME = snapmode.getOSnapItemActive 5 2
for obj in selection where ( subObjectLevel == 1) do
( --for obj
snapmode.setOSnapItemActive 5 1 true
snapmode.setOSnapItemActive 5 2 true
snapmode.active = true
PP = pickpoint snap:#3D
if ( PP == #escape or PP == #rightClick ) then
( --if escape
) --if escape
else
( --else
NS = numSplines obj
for i = 1 to NS do
( --for i
KS = getKnotSelection obj i
for n = 1 to KS.count where KS.count > 0 do
( --for n
KG = getKnotPoint obj i KS[n]
KT = getKnotType obj i KS[n]
setKnotPoint obj i KS[n] [KG.x, PP.y, KG.z]
if ( KT == #Bezier or KT == #BezierCorner ) do
( --if both
if ( KT == #Bezier ) then
( --if bezier
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [IV.x, PP.y, IV.z]
setOutVec obj i KS[n] [OV.x, PP.y, OV.z]
) --if bezier
else
( --else
setKnotType obj i KS[n] #BezierCorner
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [IV.x, PP.y, IV.z]
setOutVec obj i KS[n] [OV.x, PP.y, OV.z]
setKnotType obj i KS[n] #Bezier
) --else
) --if both
) --for n
) --for i
) --else
updateShape $
) --for obj
snapmode.active = SM
if ( SM == true and ST != undefined ) do ( snapmode.type = ST )
snapmode.setOSnapItemActive 5 1 SMV
snapmode.setOSnapItemActive 5 2 SME
) --on Execute
) --global
macroScript Flatten_B_Spline_Z
category:"MC_Tools"
internalcategory:"Utilities"
toolTip:"Flatten_B_Spline_Z"
buttonText:"Flatten_B_Spline_Z"
( --global
On IsVisible Return Filters.Is_EditSpline()
On Execute Do
( --on Execute
local KS = undefined
local PP = undefined
local NS = undefined
local KG = undefined
local KT = undefined
local IV = undefined
local OV = undefined
local SM = undefined
local ST = undefined
local SMV = undefined
local SME = undefined
SM = snapmode.active
if ( SM == true and snapmode.type != undefined ) do ( ST = snapmode.type )
SMV = snapmode.getOSnapItemActive 5 1
SME = snapmode.getOSnapItemActive 5 2
for obj in selection where ( subObjectLevel == 1) do
( --for obj
snapmode.setOSnapItemActive 5 1 true
snapmode.setOSnapItemActive 5 2 true
snapmode.active = true
PP = pickpoint snap:#3D
if ( PP == #escape or PP == #rightClick ) then
( --if escape
) --if escape
else
( --else
NS = numSplines obj
for i = 1 to NS do
( --for i
KS = getKnotSelection obj i
for n = 1 to KS.count where KS.count > 0 do
( --for n
KG = getKnotPoint obj i KS[n]
KT = getKnotType obj i KS[n]
setKnotPoint obj i KS[n] [KG.x, KG.y, PP.z]
if ( KT == #Bezier or KT == #BezierCorner ) do
( --if both
if ( KT == #Bezier ) then
( --if bezier
setKnotType obj i KS[n] #BezierCorner
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [IV.x, IV.y, PP.z]
setOutVec obj i KS[n] [OV.x, OV.y, PP.z]
setKnotType obj i KS[n] #Bezier
) --if bezier
else
( --else
IV = getInVec obj i KS[n]
OV = getOutVec obj i KS[n]
setInVec obj i KS[n] [IV.x, IV.y, PP.z]
setOutVec obj i KS[n] [OV.x, OV.y, PP.z]
) --else
) --if both
) --for n
) --for i
) --else
updateShape $
) --for obj
snapmode.active = SM
if ( SM == true and ST != undefined ) do ( snapmode.type = ST )
snapmode.setOSnapItemActive 5 1 SMV
snapmode.setOSnapItemActive 5 2 SME
) --on Execute
) --global
harumscarum · 2017-11-18
great tool, thanks
but is it possible to make it work by single click because on my Wacom tablet is very difficult to double click
Very Useful
vfga10 · 2017-11-15
So good for those who were opening autocad just to flatten the drawings, Thank you
tassel · 2011-05-25
What about flatten spline by view? :D
edit: oh.. sorry, this is an old post i see ;)
suggestion
jsrocha · 2011-05-25
Hey man, is there a way to add a "XY" flatten point? i mean, instead of flatten the vertices in x and then y, use a tool that make this two points in just one tool.
I don´t know if is hard to implement, it´s just a suggestion.
Cheers,
Jsrocha
jsrocha · 2009-06-27
great tool, thanks!
lunerjelly · 2009-06-26
Very good! Thank you!