Spline Project

17 votes

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

Version Requirement: 
3ds Max 3-2008
Video URL: 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migero's picture

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

savascetin's picture

Script found on cg-society

The address for the script is
http://forums.cgsociety.org/showthread.php?t=973749

AttachmentSize
splineproject.ms 1.88 KB
paulov's picture

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.

atanguay's picture

Does anyone have this tool?

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

newstyle's picture

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

onyxlee's picture

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.

Admin's picture

Thanks for pointing out the

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

Christopher Grant
Admin, ScriptSpot.com

onyxlee's picture

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.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.