ScriptSpot

Forum topic · Scripts Wanted

first vertex snap

By blop · 2012-07-17

Description

Hi there,

this is what I need to do.
In 3DSMAX I have an object and lot of splines which I created from HAIR&FUR modifier.
I want to snap this object onto the first [or TOP] vertex of each spline [along the vertex normal].
This way I could create lot of foliage types by creating base of the flower with hair&fur and snap the top of the flower with the script.

I tried to use OBJ2SPL ALIGNER but it does not work with more than one splines

Do you have any recommendations how to achieve this effect?

Comments (6)

test

blop · 2012-07-21

I want to create some lake bushes with this script. I am attaching test render.

Again, thank you.

Attachments

barigazy · 2012-07-22

very nice.Just keep it up, man

test2

barigazy · 2012-07-18

This example create instances of 4 different flower object
in the random way and do the same job and "test1" example.
NOTE: You can use more than 4 flowers
Open test2.max and run the code below

fn placeFlowers grassLines: flowersArr: =
(
for g in 1 to numSplines grassLines do
(
seg = (numKnots grassLines g) - 1
flowersArr[g].pos = interpBezier3D grassLines g seg 1.0 pathParam:true
flowersArr[g].dir = tangentBezier3D grassLines g seg 1.0 pathParam:true
)
)

grass = $grassLine001
fArr = #($F1_001, $F2_001, $F3_001, $F4_001)
cnt = fArr.count
while fArr.count < numSplines $grassLine001 do
(
fCopy = instance fArr[random 1 cnt]
fCopy.wirecolor = random black white
append fArr fCopy
)

placeFlowers grassLines:grass flowersArr:fArr

Attachments

thx

blop · 2012-07-19

nice! .it's pretty sweet !

good job
than you

test1

barigazy · 2012-07-18

First code and file(max2010x64 +) example(see attachment):
Make instances of single flower, randomize wirecolor and place it on the last knot of the splines extracted from Hair Modifier.
Number of flower = number of splines
Open test1.max and run the code below

fn placeFlowers grassLines: flowersArr: =
(
for g in 1 to numSplines grassLines do
(
seg = (numKnots grassLines g) - 1
flowersArr[g].pos = interpBezier3D grassLines g seg 1.0 pathParam:true
flowersArr[g].dir = tangentBezier3D grassLines g seg 1.0 pathParam:true
)
)

flower = $Flower001
grass = $grassLine001
fArr = #(flower)
for s in 1 to (numSplines grass - 1) do
(
fCopy = instance flower
fCopy.wirecolor = random black white
append fArr fCopy
)

placeFlowers grassLines:grass flowersArr:fArr

Attachments

barigazy · 2012-07-17

Attach a test file.