slice script
Hello
I try to make a script to slice selected polys at equal distances in between two picked points.
Here is the in progress (in not progressing state) script.
Don't work.... If somebody can help. :-)
#universe
pta = pickpoint snap:#3d
ptb = pickpoint snap:#3d rubberBand:pta
try destroyDialog rlslice catch()
global rlslice = rollout rlslice "Slice"
(
button butconnect "GO" pos:[2,2]
spinner spX "X " width:60 range:[2,100,3] type:#integer pos:[55,5]
on butconnect pressed do
(
ptd = ( pta - ptb )
for i=0 to (spX.value) do
(
inc = (ptd/(spX.value+2))
ppp = (inc * i) + pta
Point pos: ppp
$.EditablePoly.slice [1,0,0] ppp flaggedFacesOnly:on
)
)
)
createDialog rlslice 160 50
Comments
.
Ah, now it makes totall sense. Thanks Miauu :)
Question: What do you need to change in the code so that it affects the current slice modifier instead of adding a new one?
Kind regards
Haider
www.haider.se
.
Tools and Scripts for Autodesk 3dsMax
.
Wonderful!
Works perfect :)
I saved both of them and will at some point look how it works to create a scripted plugin so that I use the first one (that adds a new modifier) as an option to the regular Slice.
Kind regards
Haider
www.haider.se
.
How is this last script supposed to work?
Made a quick try, but achieved nothing.
Kind regards
Haider
www.haider.se
.
Tools and Scripts for Autodesk 3dsMax
Add slice modifier from two points
-- Add slice modifier from two points
-- p1 is point 1
-- p2 is point 2
fn AddSliceFrom2Pts myobj p1 p2 =
(
mySlide = sliceModifier()
AddModifier myobj mySlide
vn = [0,0,1] -- vertical vector (normal)
objTM = myobj.objecttransform
Vec1 = normalize ( p2 - p1)
V3= normalize ( cross Vn Vec1) -- get Vy
--create Matrix. Swap X by Z to get vertical plane. p1 is the position of gizmo
newModTM = matrix3 Vn Vec1 V3 p1
mytransform = (inverse objTM ) * newModTM
mySlide.slice_plane.transform = mytransform
)
mmorais.gumroad.com
Hi Titane, is this that you
Hi Titane,
is this that you looking for?
in coordsys local $.EditablePoly.slice [na,nb,nc] ppp flaggedFacesOnly:on
my recent MAXScripts RSS (archive here)
hello anubis, nice to see
hello anubis, nice to see you.
I test with "local" but don't work....
I have another version where I substract object position, it was ok but slices planes wasn't rotated within the object...
(
local savesnap=snapMode.active
snapMode.active=true
in coordsys local pta = pickpoint snap:#3d
in coordsys local ptb = pickpoint snap:#3d rubberBand:pta
ptd = ( ptb - pta )
nptd = normalize ptd
na = nptd[1]
nb = nptd[2]
nc = nptd[3]
try destroyDialog rlslice catch()
global rlslice = rollout rlslice "Slice"
(
button butconnect "GO" pos:[2,2]
spinner spX "X " width:60 range:[2,100,3] type:#integer pos:[55,5]
on butconnect pressed do
(
for i=1 to (spX.value-1) do
(
inc = (ptd/(spX.value))
ppp = (inc * i) + pta
in coordsys local Point pos: ppp
in coordsys local $.EditablePoly.slice [na,nb,nc] ppp flaggedFacesOnly:on
)
)
)
createDialog rlslice 160 50
snapMode.active=savesnap
)
hello again, Here is my
hello again,
Here is my script, but I don't know how to convert in local syst (because slice is in local sys )
anybody help ?
pta = pickpoint snap:#3d
ptb = pickpoint snap:#3d rubberBand:pta
ptd = ( ptb - pta )
nptd = normalize ptd
na = nptd[1]
nb = nptd[2]
nc = nptd[3]
try destroyDialog rlslice catch()
global rlslice = rollout rlslice "Slice"
(
button butconnect "GO" pos:[2,2]
spinner spX "X " width:60 range:[2,100,3] type:#integer pos:[55,5]
on butconnect pressed do
(
for i=1 to (spX.value-1) do
(
inc = (ptd/(spX.value))
ppp = (inc * i) + pta
--Point pos: ppp
$.EditablePoly.slice [na,nb,nc] ppp flaggedFacesOnly:on
)
)
)
createDialog rlslice 160 50