# SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

 SM Forums / Lounges / Maya Basics & Newbie Lounge / Quick way to duplicate/scale concentric walls?
 Register FAQ Calendar Mark Forums Read

 Maya Basics & Newbie Lounge Please post in this section ONLY if your question doesn't fit in anywhere else on the forum, or if you're not sure which section it's relevant to. We also have Free streaming trial available.

 07-12-2005, 04:04 PM #1 Steve555 Subscriber   Join Date: Oct 2005 Posts: 37 Quick way to duplicate/scale concentric walls? In order to make the concentric inner wall iin the picture, I had to duplicate the outer wall and then manually butcher the polygons it until it was what I wanted. I wanted to make a large structure with around 50 such concentric walls and so it's going to take forever. Unforunately just scaling the duplicate obviously scales the size of the 'bricks' as well. Can anyone suggest a shortcut to do this? Thanks Steve (FWIW, the original wall was made with a subdivided poly cube with the the inner sections deleted. Then a duplicate was made and edited to provide the inner walls to give the appearance of it being solid.) Attached Thumbnails
 08-12-2005, 01:50 AM #2 Phopojijo Registered User   Join Date: Aug 2004 Posts: 408 I assume they're all cubes? Why not just extract the faces you wish to copy and simply drag them with either snap-commands or manual number-crunching translations (so as to get each brick exactly lined up) You don't need to copy just 1 object at a time... you can copy whole groups of objects. May I ask why its necessary to have the walls made like that? (all I see are wasted polygons) Last edited by Phopojijo; 08-12-2005 at 01:53 AM.
 08-12-2005, 11:25 AM #3 Alan Moderator     Join Date: Oct 2002 Location: London, UK Posts: 2,800 ok I've got something, I'm still working on the 2d part of the answer. Make a whole bunch of cubes that are concentrict like you need then select them all and run this: global proc buildBricks(float \$brickWidth) { string \$sel[] = `ls -sl`; for(\$s in \$sel) { float \$scalex = `getAttr (\$s + ".scaleX")`; float \$scalez = `getAttr (\$s + ".scaleZ")`; select -r \$s; string \$dupe[] = `duplicate \$s`; setAttr (\$dupe[0] + ".scaleX") (\$scalex - \$brickWidth); setAttr (\$dupe[0] + ".scaleZ") (\$scalez - \$brickWidth); string \$t[] = `polyBoolOp -op 2 -ch 1 \$s \$dupe[0]`; \$s = \$t[0]; } } buildBricks(0.2); that will build the walls at the right thickness. I'm working on the brick making. I have it working but it's being very frsutrating and crashing maya all the time. I'll keep working on it A __________________ Technical Director - Framestore Currently working on: Your Highness IMDB
 08-12-2005, 12:14 PM #4 Steve555 Subscriber   Join Date: Oct 2005 Posts: 37 Thanks... I think I can glean from the code what should happen, but I'm getting a stack of syntax errors. Could you walk me through the steps to running the code? Other than writing some simple MEL scripts, I'm new to this kind of stuff and think that's where I'm going wrong. How do I call the function with the desired value for the variable brickWidth? (Phopojijo... "why its necessary to have the walls made like that? (all I see are wasted polygons)" I'm experimenting with adding different textures per face, and randomizing the vertices slightly to get something bumpier. It may be a dead end, but it's good learning experience, if only to find out what ideas don't work and why.
 08-12-2005, 12:22 PM #5 Alan Moderator     Join Date: Oct 2002 Location: London, UK Posts: 2,800 I dont get any syntax errors when I run it. What are you getting? A __________________ Technical Director - Framestore Currently working on: Your Highness IMDB
 08-12-2005, 01:06 PM #6 Steve555 Subscriber   Join Date: Oct 2005 Posts: 37 As I say, it's probably down to me not knowing how to execute it. I just pasted it in and hit Enter. // Error: global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: ...global proc buildBricks(float \$brickWidth)({(string \$sel[] = `ls -sl`;(for(\$s in \$sel)({(float \$scalex = `getAttr (\$s + ".scaleX // // Error: Syntax error // // Error: // // Error: Syntax error //
 08-12-2005, 01:45 PM #7 Alan Moderator     Join Date: Oct 2002 Location: London, UK Posts: 2,800 looks like the lines are truncated. Make sure that the script lines are being finished off properly and not cutting off half way through A __________________ Technical Director - Framestore Currently working on: Your Highness IMDB
 08-12-2005, 02:34 PM #8 Steve555 Subscriber   Join Date: Oct 2005 Posts: 37 It looked fine in the editor. I typed it in manually rather than pasted it and then it ran OK. Some invisible formatting stuff must've been there. I can only assume you're creating your source brick walls in a completely different way to me, because all I get is a few random faces duplicated. I tried building it brick by brick, or by subdividing a cube but it's not producing anything but a few odd cubes and faces. Any chance you could post a scene that you got it to work with? If not, no sweat, I may be able to get some clues from your code, but I'm intigued as to what your results are. foursheds@btinternet.com
 08-12-2005, 02:42 PM #9 Alan Moderator     Join Date: Oct 2002 Location: London, UK Posts: 2,800 all I did was create a cube and then select it and run that script... it will remove the middle based on how thick you want your walls. It will mean you can have different scales of boxes but the wall width stays the same. A __________________ Technical Director - Framestore Currently working on: Your Highness IMDB