Notifications
Clear all

[Closed] CgTalk Maxscript Challenge 011: "Circular Array Tool"

Thanx ulb, I am glad you like it

 to all: here is final version, fixed align by travell in circular array and overall code was enhanced. (if you saw previous version forget it now :) )

now really final: sat1-0.zip

feel free to comment.

 ulb

so here is my first script with maxscript!:bounce:

It does only the beginner’s level stuff.

would be great to tell me what i shouldn’t have done, just to help me to improve.

rollout ca "circarray" width:150 height:100
(
	spinner cRadius "circle radius" range:[0,200,100] fieldWidth:50 type:#Float pos:[0,0]
	spinner number "number of copies" range:[1,200,10] fieldWidth:50 type:#Integer pos:[0,20]
	button createC "create" pos:[0,65]
	radiobuttons axisR labels:#("x","y","z") pos:[0,40]
	
	on createC pressed do
	(
		try
		(
			myobj = $
			myNumber = number.Value
			cloneAngle = 360.0/number.Value
			cRad = cRadius.Value
			
			case axisR.state of
			(
				1:(for o=0 to myNumber do (copy myobj pos:(myobj.pos + [0,cos(cloneAngle*o)*cRad,sin(cloneAngle*o)*cRad])))
				2:(for o=0 to myNumber do (copy myobj pos:(myobj.pos + [sin(cloneAngle*o)*cRad,0,cos(cloneAngle*o)*cRad])))
				3:(for o=0 to myNumber do (copy myobj pos:(myobj.pos + [sin(cloneAngle*o)*cRad,cos(cloneAngle*o)*cRad,0])))
			)
		)catch(messagebox "no selection?")
	)
)
createDialog ca

btw, after more than 1 hour in the maxscript reference, i couldn’t find why this line doesn’t works in a script but does well in the listener:

for i in objects where not i.isselected do delete i

i’m sure it’s stupid but i couldn’t find why.

 ulb

hi all,

i had some time to learn a bit more of maxscript, and added some functions to my script:

-real time update
-delete last array function
-adjustment of the shape of the circle to make an ellipse
-it is possible to create new arrays around the created objects (not really a function but it was the most difficult…)

comments/feedback would be greatly appreciated!

thanks

edit: Pats’s last attachment doesn’t work anymore, i’ve lost it and i wish i could see his code again, so if it is possible to repair the link, it would be cool. thanks

 ulb

i added some functions, so i post another script…

added:
-rotation of the circle around one axis at a time
-a spinner control the portion of the circle covered by the clones
-you can turn the clones around the circle

any comment still welcome

Congrats. Fine first script!

From quick check i think some changes can be made: u could use local instead of global (if for some reason which i didnt spot u want that to be global) and 1 to myNumber or 0 to myNumber – 1 in loop so the number of copy will be corect + first and last copy will not be on same place.

Hope that helps.

Just saw u post next version…good improvement


Here is new working attachment spherical and circular array tool 1.0 ->

 ulb

thanks Pats for the comments, i still have to learn what global and local variables precisely do in maxscript.

and thanks for reposting your script too, i wanted to check something :).

 ulb

here is another update:

     added:
     -sphere creation (all previous functions work for the sphere too).
     -spiral (more or less like in Pat's script).
     -number of turns covered by the clones.

edit: added the possibility to increase the definition of generated spheres and ui looks a bit better

     i got some nice structures with that. maybe i'll try to use some more math functions to create more interesting stuctures. i'm still searching how i could rotate around three axes at the same time.
    [[img] http://img218.imageshack.us/img218/5636/testspherearray1ar.jpg [/img]]( http://imageshack.us) 

this looks like fun , I will give it a go later

Good progress henri, I too have one update:

version 1.5U
added: position offset by alignment
and some code was improved again.

Dmaxer:It is fun and great practice too so participate if u can, these challenges needs more competitors:thumbsup:

 ulb

thanks.

the offset is a good idea, it can help to get some cool shapes.

there are some features i would like to add or change in my script, but i have some exams to pass before i can do anything with it.

I would also like to make a 3d graph calculator in ms (a quite limited one of course). I really don’t know if it’s feasible for me as i’m not that good at math, but it could be fun to try.

btw changed my name here to put my real one. I had the bad habit to give false names to forums, and I forgot to change it.

Page 2 / 3