ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
macroscript Spline_project category:"Chuggs tools" tooltip:"Spline Project"
(
if (selection.count == 1) and (superclassof selection[1] == shape) then
(
obj = copy selection[1]
obj.name += "_projected"
converttosplineshape obj
pointer = splineshape name:"pointer" wirecolor:(color 255 255 0)
for i = 1 to obj.numsplines do
(
mid = [0,0,0]
midcount = 0
for n = 1 to (numknots obj i) do
(
mid += (getknotpoint obj i n)
midcount += 1
)
addnewspline pointer
addknot pointer i #corner #line (mid / midcount)
addknot pointer i #corner #line ((mid / midcount) + (obj.dir * 80))
)
updateshape pointer
if (pickobj = pickobject message:"Pick an object") != undefined do
(
new_obj = pickobj
fail = 0
for t = 1 to obj.numsplines do
(
for i = 1 to (numknots obj t) do
(
k = getknotpoint obj t i
r = ray k obj.dir
if (np = intersectray new_obj r) != undefined then
(
d = length (k - np.position)
v = false
if (getknottype obj t i == #bezier) or (getknottype obj t i == #beziercorner) do
(
inv = getinvec obj t i
outv = getoutvec obj t i
v = true
)
setknotpoint obj t i np.position
if v do
(
infail = true
outfail = true
r = ray inv obj.dir
np = intersectray new_obj r
if np != undefined do
(
setinvec obj t i np.pos
infail = false
)
r = ray outv obj.dir
np = intersectray new_obj r
if np != undefined do
(
setoutvec obj t i np.pos
outfail = false
)
if infail do
(
setknottype obj t i #beziercorner
setinvec obj t i (inv + (obj.dir * d))
)
if outfail do
(
setknottype obj t i #beziercorner
setoutvec obj t i (inv + (obj.dir * d))
)
)
)
else
(
fail += 1
)
)
)
if fail == (numknots obj) then
(
updateshape obj
delete obj
delete pointer
)
else
(
updateshape obj
delete pointer
)
)
)
else
(
messagebox "Invalid selection!"
)
)
ASDGAG!! the site is down, I really need to project splines. I've used the itoo Glue tool but it does not generate new vertices in the lines where the surface does have so in some cases it goes under it.
Please reupload it to megaupload or a similar hosting.
and if you have wrong projection, try to collaps your poly into really mesh. to get the best result, turn off the spline's interpolation optimize and increase the step.
and after you copy the file in your script folder, run max, find it under your "customize interface"-->"main UI"-->"chuggs tools", then you know what to do.
to use it, modify your path's local z axis first, then run the script, then select the destination mesh. that's it.
Comments
works fine in 2016 watch pivot direction
--***********************************
--* project spline onto mesh v1.1 *
--***********************************
macroscript Spline_project category:"Chuggs tools" tooltip:"Spline Project"
(
if (selection.count == 1) and (superclassof selection[1] == shape) then
(
obj = copy selection[1]
obj.name += "_projected"
converttosplineshape obj
pointer = splineshape name:"pointer" wirecolor:(color 255 255 0)
for i = 1 to obj.numsplines do
(
mid = [0,0,0]
midcount = 0
for n = 1 to (numknots obj i) do
(
mid += (getknotpoint obj i n)
midcount += 1
)
addnewspline pointer
addknot pointer i #corner #line (mid / midcount)
addknot pointer i #corner #line ((mid / midcount) + (obj.dir * 80))
)
updateshape pointer
if (pickobj = pickobject message:"Pick an object") != undefined do
(
new_obj = pickobj
fail = 0
for t = 1 to obj.numsplines do
(
for i = 1 to (numknots obj t) do
(
k = getknotpoint obj t i
r = ray k obj.dir
if (np = intersectray new_obj r) != undefined then
(
d = length (k - np.position)
v = false
if (getknottype obj t i == #bezier) or (getknottype obj t i == #beziercorner) do
(
inv = getinvec obj t i
outv = getoutvec obj t i
v = true
)
setknotpoint obj t i np.position
if v do
(
infail = true
outfail = true
r = ray inv obj.dir
np = intersectray new_obj r
if np != undefined do
(
setinvec obj t i np.pos
infail = false
)
r = ray outv obj.dir
np = intersectray new_obj r
if np != undefined do
(
setoutvec obj t i np.pos
outfail = false
)
if infail do
(
setknottype obj t i #beziercorner
setinvec obj t i (inv + (obj.dir * d))
)
if outfail do
(
setknottype obj t i #beziercorner
setoutvec obj t i (inv + (obj.dir * d))
)
)
)
else
(
fail += 1
)
)
)
if fail == (numknots obj) then
(
updateshape obj
delete obj
delete pointer
)
else
(
updateshape obj
delete pointer
)
)
)
else
(
messagebox "Invalid selection!"
)
)
Script found on cg-society
The address for the script is
http://forums.cgsociety.org/showthread.php?t=973749
ASDGAG!! the site is down, I
ASDGAG!! the site is down, I really need to project splines. I've used the itoo Glue tool but it does not generate new vertices in the lines where the surface does have so in some cases it goes under it.
Please reupload it to megaupload or a similar hosting.
Does anyone have this tool?
Does anyone have this tool? The website is gone with a squatter sitting on it.
Hellow Is this script work
Hellow
Is this script work with 3DSMax 2008 64bit, because it give me error :
"" UNKNOW PROPERTY: "numSPlines" in $Line:Line02_projecter @ [-0.854530, -3.141411,34.275490] ""
thx to admin for such a
thx to admin for such a swift response.
and if you have wrong projection, try to collaps your poly into really mesh. to get the best result, turn off the spline's interpolation optimize and increase the step.
Thanks for pointing out the
Thanks for pointing out the URL mistake, I've updated the script entry.
Christopher Grant
Admin, ScriptSpot.com
thank you. it's a great
thank you. it's a great tools, and it works fine in max2008.
but the link above is not available any more. here is the correct one:
http://www.chuggnut.com/Scripts/chugg_splineproject.zip
the path name is Case Sensitive.
and after you copy the file in your script folder, run max, find it under your "customize interface"-->"main UI"-->"chuggs tools", then you know what to do.
to use it, modify your path's local z axis first, then run the script, then select the destination mesh. that's it.
happy projecting.