Flatten_Spline_XYZ
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.
Download and place the scripts in the Scripts Folder. Go to Maxscript>Run Script and run the 2 scripts. Go to Customize UI - go to Quads Menu - highlight the lower left Quad on the main menu - then expand the Context Spline Tools Item. The Flatten Spline scripts have a filter flag so they are only visible when Splines are selected - and this location makes them visible with other spline tools. You can look for the script in the MC_Tools Category.
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
can not download
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
Great tool
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
So good for those who were opening autocad just to flatten the drawings, Thank you
What about flatten spline by
What about flatten spline by view? :D
edit: oh.. sorry, this is an old post i see ;)
/ Raymond
suggestion
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
great tool, thanks!
great tool, thanks!
Very good! Thank you!
Very good! Thank you!