home processing download documents tutorial python tutorial gallery source about
 Python Tutorials (back to the list of tutorials)

Panelization Examples

     Panelization Example5

The following example shows panelization with random length panels. Each of the panel length is defined by vlen .
The sample input file used in the example is below.

surface5.3dm

add_library('igeo')

size(480, 360, IG.GL)

IG.open("surface5.3dm")
surfaces = IG.surfaces()

for surf in surfaces :
    unum = 30
    vnum = 40
    uinc = 1.0/unum
    vinc = 1.0/vnum
    for i in range(unum) : 
        for j in range(vnum) :
            vlen = IRand.getInt(1, 10)
            if j+vlen > vnum : 
                vlen = vnum-j
            cpts = []
            cpts.append([])
            cpts.append([])
            for k in range(vlen+1) : 
                cpts[0].append(surf.pt(i*uinc, (j + k)*vinc))
                cpts[1].append(surf.pt((i+1)*uinc, (j + k)*vinc))
            ISurface(cpts).clr(IRand.clr())
            j += vlen-1
    surf.del()

And then the offset distance of the panel from the orignal input surface is randomized by the parameter depth.

add_library('igeo')

size(480, 360, IG.GL)

IG.open("surface5.3dm")
surfaces = IG.surfaces()

for surf in surfaces :
    unum = 30
    vnum = 40
    uinc = 1.0/unum
    vinc = 1.0/vnum
    for i in range(unum) :
        for j in range(vnum) :
            vlen = IRand.getInt(1, 10)
            if j+vlen > vnum :
                vlen = vnum-j
            cpts = []
            cpts.append([])
            cpts.append([])
            depth = IRand.get(0, 1)
            for k in range(vlen+1) : 
                cpts[0].append(surf.pt(i*uinc, (j+k)*vinc, depth))
                cpts[1].append(surf.pt((i+1)*uinc, (j+k)*vinc, depth))
            ISurface(cpts).clr(IRandom.gray())
            j += vlen-1
    surf.del()


(back to the list of tutorials)

HOME
FOR PROCESSING
DOWNLOAD
DOCUMENTS
TUTORIALS (Java / Python)
GALLERY
SOURCE CODE(GitHub)
PRIVACY POLICY
ABOUT/CONTACT