r90210
12-28-2008, 11:10 AM
Hi everyone!
I have a simple script below which I want to use to copy boxes in the x and z axis to form a grid, changed by a simple UI.
However, I am not sure how to script the copy and offset functions in the double loop(see below) Does anyone know how to code it?
Many, many, thanks!
Script:
(
--Define variables--
local b = box pos:[0,0,0] width:2465 height:3000 length:180
local pan_row = 1
local pan_col = 1
local xOffset = 0
local zOffset = 0
fn CREATE = ( b
for i = 1 to spn_panX.value-1 do
(
for j = 1 to spn_panZ.value-1 do
(
select b
--offset and copy the panel (b) in z and x directions (THIS IS TOTALLY WRONG)
Offset:[(3000*i),0,(2465*j)]
)--end do
)--end do
)--end create
--automatically destroys and replaces any existing rollout boxes--
if ((r_thePanels != undefined) and (r_thePanels.isdisplayed)) do
(destroyDialog r_thePanels)
--Define interface
rollout r_thePanels "FACADE GENERATOR"
(
label lbl_note1 "Press to generate panel"
button btn_CREATE "CREATE" width:100 height:20 align:#center toolTip: "Click here to generate panel"
group "FACADE SIZE"
(
label lbl_note2 "Increase length and width of facade"
spinner spn_panX "Columns: " type:#integer range:[1,100,pan_col] enabled:true
spinner spn_panZ "Rows: " type:#integer range:[1,100,pan_row] enabled:true
)
--Event Handler
on btn_CREATE pressed do CREATE()
)
) --ends rollout
CreateDialog r_thePanels pos:[200,200] width:260
I have a simple script below which I want to use to copy boxes in the x and z axis to form a grid, changed by a simple UI.
However, I am not sure how to script the copy and offset functions in the double loop(see below) Does anyone know how to code it?
Many, many, thanks!
Script:
(
--Define variables--
local b = box pos:[0,0,0] width:2465 height:3000 length:180
local pan_row = 1
local pan_col = 1
local xOffset = 0
local zOffset = 0
fn CREATE = ( b
for i = 1 to spn_panX.value-1 do
(
for j = 1 to spn_panZ.value-1 do
(
select b
--offset and copy the panel (b) in z and x directions (THIS IS TOTALLY WRONG)
Offset:[(3000*i),0,(2465*j)]
)--end do
)--end do
)--end create
--automatically destroys and replaces any existing rollout boxes--
if ((r_thePanels != undefined) and (r_thePanels.isdisplayed)) do
(destroyDialog r_thePanels)
--Define interface
rollout r_thePanels "FACADE GENERATOR"
(
label lbl_note1 "Press to generate panel"
button btn_CREATE "CREATE" width:100 height:20 align:#center toolTip: "Click here to generate panel"
group "FACADE SIZE"
(
label lbl_note2 "Increase length and width of facade"
spinner spn_panX "Columns: " type:#integer range:[1,100,pan_col] enabled:true
spinner spn_panZ "Rows: " type:#integer range:[1,100,pan_row] enabled:true
)
--Event Handler
on btn_CREATE pressed do CREATE()
)
) --ends rollout
CreateDialog r_thePanels pos:[200,200] width:260
