Код:
rollout unnamedRollout "KUBY" width:160 height:185
(
label lbl1 "Select single cube -BlokTravy_Obrasez-, add to the selected -surface_For_Cubes-, push - GO !" pos:[25,5] width:140 height:82
button btn1 "GO !" pos:[30,75] width:100 height:25
label lbl2 "Paint" pos:[65,105] width:40 height:22
button btn2 "Red - Green" pos:[30,125] width:100 height:25
button btn3 "All Gray" pos:[50,155] width:55 height:25
fn sortPoint3ArrByAxis_fn v1 v2 axis: =
(local v = case axis of
(
#x:(v1.x - v2.x)
#y:(v1.y - v2.y)
#z:(v1.z - v2.z)
)
case of
(
(v < 0):-1
(v > 0):1
default:0
)
)
fn PosCubesForVerts_fn a b =
(local aGab=(a.max.z-a.min.z)
pv_b=for i=1 to b.verts.count collect b.verts[i].pos
xpv_b=for i=1 to pv_b.count collect ((pv_b[i][1]/aGab) as integer)*aGab
ypv_b=for i=1 to pv_b.count collect ((pv_b[i][2]/aGab) as integer)*aGab
zpv_b=for i=1 to pv_b.count collect ((pv_b[i][3]/aGab) as integer)*aGab
npv_b=for i=1 to b.verts.count collect [(xpv_b[i]),(ypv_b[i]),(zpv_b[i])]
makeUniqueArray npv_b
)
on btn1 pressed do
(undo on
(if selection.count==2 then
(a1=$[1]; b1=$[2]
arrPos_a2=PosCubesForVerts_fn a1 b1
qsort arrPos_a2 sortPoint3ArrByAxis_fn axis:#z
clearselection(); hide b1
for i=1 to arrPos_a2.count do
(a2=copy a1 pos:(arrPos_a2[i]) name:("BlokRG"+i as string) parent:b1
)
unhide b1; select b1; max views redraw
)
else (messageBox "! ! ! Vydeli Kub, CTRL + Vydeli Poverhnost")
)
)
on btn2 pressed do
(undo on
(all_bl=$b* as array
bl_rg=$blokrg* as array
gbrt=(bl_rg[1].max.z-bl_rg[1].min.z)
for j=1 to bl_rg.count do bl_rg[j].wirecolor=red
for i in all_bl do
for b in bl_rg where distance b.pos [i.pos.x,i.pos.y,i.pos.z-gbrt]<0.01 do b.wirecolor=green
)
)
on btn3 pressed do
(undo on
(all_bl=$b* as array
for j=1 to all_bl.count do all_bl[j].wirecolor=gray
)
)
)
createDialog unnamedRollout pos:[40,110]