Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 01-06-2011 , 04:08 PM
mechanicarts's Avatar
Registered User
Join Date: Mar 2011
Posts: 45

A (most probably) very easy script...please correct!

Here I am, making my first script, using MEL Reference...but of course it is wrong, since I've never ever programmed again...

I have a surface "extrudedSurface36" which I want to duplicate 35 times around the pivot, so that I have something like a cone cage...Essentially, I want each new copy to be rotated 10 degrees, and when the copies reach 35, the script stops...here is what I have so far.

Code:
int 	$angl = 10;
	$name = 36;
string $namestring;

while ($angl<=351)
{
$namestring = "extrudedSurface",$name;
select -r $namestring;
duplicate;
rename $namestring
rotate -y 0 $angl 0;
$angl = $angl + 10;
$name++;
}
But of course it is wrong. Any ideas?user added image

# 2 01-06-2011 , 07:08 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
I see a few issues.

Line 2

Code:
$name = 36;
the variable isn't defined with a datatype. Int datatype is appropriate here.

Code:
int $name = 36;
On line 7,

Code:
$namestring = "extrudedSurface",$name;
looks like bad syntax so I'm sure that will error out. I'm guessing you want $name to count upwards from 36 for each loop executed and use it as a suffix for "extrudedSurface". In that case, line 7 should be.

Code:
$namestring = ("extrudedSurface" + $name);
The rename statement doesn't have a semi colon and you didn't give the rename command anything to work with really.

Code:
rename $namestring
It should more like...

Code:
rename $namestring $newName;


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 3 01-06-2011 , 07:58 PM
mechanicarts's Avatar
Registered User
Join Date: Mar 2011
Posts: 45
Thanks!! That really helped me!

As for the rename, I thought the new duplicate would autoselect so that "rename" would rename the object with $namestring.

user added image

# 4 01-06-2011 , 08:09 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
You're right. Learn something new everyday. I'm used to telling Maya exactly what I want and being a tight ass about it lol.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 5 17-06-2011 , 06:35 PM
I-Iybrid's Avatar
Simply Maya OG
Join Date: Dec 2002
Location: Queensbury NY, US A
Posts: 1,438
I know I'm a little bit late here, but.... Can't you just duplicate with transform, and tell it to turn 10* and duplicated 35 times, and go? I mean, that seems TOO easy, so I'm probably wrong. lol


- Hybrid
# 6 17-06-2011 , 09:15 PM
mechanicarts's Avatar
Registered User
Join Date: Mar 2011
Posts: 45
I used both methods back then, the script (which didn't work and I gave up) and the Duplicate with Transform (which is awesome for chains btw!!) user added image

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