ScriptSpot

Forum topic · General Scripting

Evaluation of my beginner script...

By Vapourise · 2011-10-14

Downloads
Description

Hi everyone, I have been trying to put a script together that builds random favela type geometry in a stepped manner as if on a hillside. I will include the script and a picture.

I know the script is awful but I am willing to embarass myself in the name of learning:) Would really appreciate any help you guys can offer in terms of devloping it for the better :)

Thanks for your time :)

Script:

Favela = box length:10 width:10 height:10

-- Create 5 iteration along the Y Axis
for i = 1 to 5 do
(
box_copy = copy Favela
box_copy.pos = [0, i*20, 0]
)

select objects

macros.run "Modifier Stack" "Convert_to_Poly"

-- attach Objects, Courtesy of Chris Gray, CG Society
(
while selection.count > 1 do
(
selcount = selection.count
for i = selcount to 2 by -2 do
(
polyop.attach selection[i] selection[i-1]
)
)
update selection[1]
)

select objects

for i = 1 to 5 do
(
box_copy = copy $
box_copy.pos = [i*20,0,i*20]
)

--Select Box and Move to position 0,0,0
select $Box006
$.position = [0,0,0]

select objects

-- Attach objects, Courtesy of Chris Gray, CG Society
(
while selection.count > 1 do
(
selcount = selection.count
for i = selcount to 2 by -2 do
(
polyop.attach selection[i] selection[i-1]
)
)
update selection[1]
)

-- Select Sub-Object level: Polygons
subobjectLevel = 4

-- Select Random Faces
PolyToolsSelect.Random 1 60 0 false

-- Extrude Selected Faces
$.extrusionType = 2
$.faceExtrudeHeight = 10
$.EditablePoly.buttonOp #Extrude

select objects

-- Select by normal -Z
polyToolsSelect.Normal 3 90 true

-- Inset selected faces
$.insetType = 1
$.insetAmount = 3.93701
$.EditablePoly.buttonOp #Inset

-- Extrude selected faces
$.faceExtrudeHeight = 19.685
$.EditablePoly.buttonOp #Extrude

-- Delete selected faces
actionMan.executeAction 0 "40020"
max delete
$.EditablePoly.delete #Face

Comments (1)

rezoloot · 2014-04-06

Nice little script, thanks for sharing