ScriptSpot

Script

Spline Project

By Chuggnut · 2006-10-21

Version requirement
3ds Max 3-2008
Votes
17
Download
Download
Description

Same kinda thing as mesh project except projects spline anlong their Z axis onto the surface of an object

Tags: spline

Comments (8)

works fine in 2016 watch pivot direction

migero · 2017-03-03

--***********************************
--* 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!"
)
)

paulov · 2010-07-21

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.

atanguay · 2010-03-10

Does anyone have this tool? The website is gone with a squatter sitting on it.

newstyle · 2009-05-13

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] ""

onyxlee · 2008-06-11

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.

Admin · 2008-06-11

Thanks for pointing out the URL mistake, I've updated the script entry.

onyxlee · 2008-06-11

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.