Jump to content

Maxscript help


gediminasstasaitis
 Share

Recommended Posts

Hey guys,

 

I'm new to the forums so bare with me please. We are doing this recursive script and it is just hard to find information that we need, we have gotten this far and can't even delete the parents with leaving the children only..Later on we will want the recursion to happen in one place more than the other by selecting a point, and or placing the recursion on a certain plane or shape..

 

So my questions are:

 

1. How do you find the needed info for the syntax? Do you know or have any recursion tutorials?

2. How do you delete the parents each time you make the new children?

3. Is there a way in doing this script more efficiently? (I have a feeling its extremely inefficient)

4. how do you do recursion in one place more than the other by placing a point?

5. how do you place it on a plane then?

 

Basically I want to learn the basics of maxscript, and I will be browsing throught this forum and other ones at the same time waiting for responses here (because of the lack of time we have). Thank you for you patience and help.

 

Here is the script (couldn't attach the file..):

 

resetmaxfile #noprompt

 

myLevel = 2

radius = 20

a = 180

global triangleRoot = NGon radius:radius nsides:3 scribe:1

 

 

fn createChildren parentTriangle currentLevel =

(

if currentLevel

(

 

child01 = copy parentTriangle

child01.radius = (parentTriangle.radius/2)

aRotation = eulerAngles 0 0 a

rotate child01 aRotation

 

(child01.parent = parentTriangle)

 

child02 = copy parentTriangle

child02.radius = (parentTriangle.radius/2)

in coordsys parentTriangle move child02 [(parentTriangle.radius/2), 0, 0]

 

(child02.parent = parentTriangle)

 

child03 = copy parentTriangle

child03.radius = (parentTriangle.radius/2)

in coordsys parentTriangle move child03 [-(parentTriangle.radius/4), ((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius) , 0]

 

(child03.parent = parentTriangle)

 

child04 = copy parentTriangle

child04.radius = (parentTriangle.radius/2)

in coordsys parentTriangle move child04 [-(parentTriangle.radius/4), -((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius), 0]

 

(child04.parent = parentTriangle)

 

)

 

 

currentLevel = currentLevel +1

for i =1 to parentTriangle.children.count by 1 do

(

createChildren parentTriangle.children currentLevel

 

)

)

 

createChildren triangleRoot myLevel

delete triangleRoot

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...