Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 29-10-2006 , 04:38 PM
Registered User
Join Date: Oct 2006
Posts: 10

please,.. help an architecture student

I'm architecture studet and I'm doing my final project using .mel scripting to generate the design.
I've made an script to create some boxes with their names: shop1_1,...
To create that boxes the program will read some variable from the model (the position of the vertex of one nurbs surface called potential) if the Y position=1, it will create 1 box, if it's 2, 2 boxes,... shop 1_1, and shop 1_2,...

I've put all the scripts and procedures in a folder in: my documents>maya>scripts. After I've openend the file with I'll work with (where it is the potential surface). And finally I've opened the script editor and I've called the procedure: createShops ();

After execute that procedure that is calling to 2 other procedures: getPotentiality() and createShop ()
the program in not giving me any answer,.. it doesn't create the shops and it neither give me any error!!!!
I've very worried because I really need it to continue with my project,..

So,. please, if someone can help me,.. Nobody in my university can help me with that,.. and I really need to solve it,...

I've send you the scripts but I think they are right,.. I think I'm doing sth wrong in the way of running the script or sth like that,...

global proc createShops() {
global int $lengthSite;
int $i;
int $ii;
for ($i=1;$i<=$lengthSite;$i++) {
int $potentiality;
$potentiality = getPotentiality($i);
for ($ii=1;$ii<=$potentiality;$ii++) {
createShop ($i, $ii, $potentiality);
}
}
}




global proc int getPotentiality(int $i) {
int $result;
$result = getAttr ("potential.cv["+$i+"][0].yValue");
return $result;
}

global proc createShop (int $i, int $ii, int $potentiality) {
string $name;
$name = "shop"+$i+"_"+$ii;
int $x;
$x = ($ii*locate($i)/($potentiality+1));

polyCube -w 1 -d 4 -h 3.5 -name $name;
move -r -os -wd ($x) 1.75 (4*$i);
}


Thank you!!!

# 2 29-10-2006 , 09:43 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
The reason it does nothing is because your variable $lengthSite has no value and your first for loop looks for $i to be less than $lengthSite and it never is.

Once I gave it a value, I then got an error that Maya doesn't know what locate is, but at least it's progress.

Good luck.

# 3 02-11-2006 , 02:45 AM
Registered User
Join Date: Oct 2006
Posts: 10

thanks Dann

Now that part is working,.. the problem was that I tought that the global variables were actualized automatically, also from other scripts from teh same folder,.. so I didn't upload that variable,..

Now I know that if I define that variable ($lengthSite) before,.. it works..
hehehh

Thank you very much!!!

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads