Python Tutorials (back to the list of tutorials)

Panelization Examples

Panelization Example1

The following is an example of panelization of a surface. It creates diagrid structure, triangulated glazing panels and diagonal fin skins. Here is a sample input file.

```add_library('igeo')

size(480,360,IG.GL)

IG.open("surface2.3dm")
surfaces = IG.surfaces()
surf = surfaces[0]

layer1 = IG.layer("glazing")
layer2 = IG.layer("structure")

unum = 20
vnum = 30
uinc = 1.0/unum
vinc = 1.0/vnum
for i in range(unum) :
for j in range(vnum) :
if (i+j)%2 == 0 :
# glazing panels
gpt1 = surf.pt( i*uinc, j*vinc )
gpt2 = surf.pt( (i+1)*uinc, (j-1)*vinc )
gpt3 = surf.pt( (i+1)*uinc, (j+1)*vinc )
gpt4 = surf.pt( i*uinc, (j+2)*vinc )
ISurface(gpt1,gpt2,gpt3).clr(0,1-.1*i,1-.05*i,.3).layer(layer1)
ISurface(gpt3,gpt4,gpt1).clr(.5,1-.1*i,1-.05*i,.3).layer(layer1)

# diagrid structure
spt1 = surf.pt( i*uinc, j*vinc, 0.5 )
spt2 = surf.pt( (i+1)*uinc, (j-1)*vinc, 0.5 )
spt3 = surf.pt( (i+1)*uinc, (j+1)*vinc, 0.5 )
ICylinder(spt1, spt2, 0.2).clr(0.3).layer(layer2)
ICylinder(spt1, spt3, 0.2).clr(0.3).layer(layer2)
# fin skin
fpt1 = surf.pt( i*uinc, j*vinc )
fpt2 = surf.pt( (i+1)*uinc, (j+2)*vinc )
fpt3 = surf.pt( i*uinc, j*vinc, -3.0 )
fpt4 = surf.pt( (i+1)*uinc, (j+2)*vinc, -3.0 )
fpt3.rot(fpt1, fpt2.dif(fpt1), i*uinc*PI/2)
fpt4.rot(fpt1, fpt2.dif(fpt1), i*uinc*PI/2)

ISurface(fpt1, fpt2, fpt4, fpt3).layer(layer3)
surf.del()

#IG.save("surface2out.3dm") # saving here or type control+s
```

(back to the list of tutorials)