Hello :)
I'm wondering what goes wrong with my script. It suppose to flatten all vertices to 0 on the Z-axis.
It seems to only work on non-splines.
Can it be adjusted so it will work with an Edit Spline too?
Thank you.
Forum topic · General Scripting
By remykonings · 2019-01-03
Hello :)
I'm wondering what goes wrong with my script. It suppose to flatten all vertices to 0 on the Z-axis.
It seems to only work on non-splines.
Can it be adjusted so it will work with an Edit Spline too?
Thank you.
.
miauu · 2019-01-03
(
on isEnabled return
(
selection.count == 1 and (classof selection[1] == SplineShape or classof selection[1] == Line) and selection[1].modifiers.count == 0
)
on execute do
(
selObjsArr = selection as array
for spl in selObjsArr do
(
convertToSplineShape spl
new_z = spl.pos.z
splCnt = numSplines spl
for s = 1 to splCnt do
(
knotsCnt = numKnots spl s
for k = 1 to knotsCnt do
(
knt = getKnotPoint spl s k
in_vec = getInVec spl s k
out_vec = getOutVec spl s k
knt.z = in_vec.z = out_vec.z = new_z
setInVec spl s k in_vec
setOutVec spl s k out_vec
setKnotPoint spl s k knt
)
)
updateShape spl
)
)
)
*
remykonings · 2019-01-04
Indeed, It works well.
Thank you for all your effort and help.
It is very appreciated, not only on this topic but also all my others.
Happy New Year and thank you :)
.
miauu · 2019-01-04
Glad to help.
Happy New Year to you too.