PDA

View Full Version : placement mehod


sethwolford
09-05-2006, 06:02 AM
I am new to maxscript and I am trying to modify a script that I was working on. Originally the script is part of CG-academy's fundamental set.

What I am trying to accomplish is to pick certain verts on a plane and have the script create a tree on that vert. Here is what I came up with

if selection.count == 1 then
(


vertexcount = getvertselection $.mesh
for index in vertexcount do
(
newpos = meshop.getvert $.mesh vertindex
newpos = newpos * $vertex.transform

newheight = random 80.0 150.0
makesingletree newheight newpos
)


group $myObject* name:"trees"


)
else
(
messagebox "Popeye says Select Mesh"
)


but when I run it I get an error saying "--Unable to convert :undefined to type: Integer"
if someone could explain what I am doing wrong I would be most grateful.

RafaPolit
09-05-2006, 07:51 AM
Hi Popeye,

You need to correct the first line in the for-do loop: instead of vertindex you should use the index variable you are assigning the vertexes in each loop, or change the for assignment like so:
for vertindex in vertexcount do
(
newpos = meshop.getvert $.mesh vertindex
...
)
Further errors may be in the makesingletree function that is not included.

Hope this helps,

Rafa Polit
Quito, Ecuador.

sethwolford
09-05-2006, 08:03 AM
Thanks! that solved the prob. I have no prob creating the tree for selected verts the only problem I ran into is getting unknown property when it gets to the line

" newpos = newpos * $vertex.transform"

but I figured out that "$.transform" gives me the correct property.

thanks again for the help I spent about 10 hours trying to figure this out.....:)

RafaPolit
09-05-2006, 08:06 AM
Yea, I know what you mean, sometimes this happens to me too. My approach is to simplify the workflow to the bare structure, and the problem usualy pops up relatively fast!

Glad to be of some help,
good luck

Rafa Polit
Quito, Ecuador.

CGTalk Moderation
09-05-2006, 08:06 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.