예제 #1
0
파일: workshop_01.py 프로젝트: luca9/ggpl
def createSpace(beamDimensions, pillarDimensions, pillarsDistances,
                interstoryHeights):

    bx, bz = beamDimensions
    px, py = pillarDimensions

    floors = []

    for height in interstoryHeights:
        pillar = CUBOID([px, py, height])
        beams = []
        pillars = [pillar]
        beamWidth = 0

        for i in range(0, len(pillarsDistances) - 1):
            distance = pillarsDistances[i]
            beamWidth += distance + py
            beams += [CUBOID([bx, beamWidth, bz]), T(2)(beamWidth)]
            pillars += [T(2)(distance + py), pillar]
            beamWidth = 0

        distance = pillarsDistances[-1]

        beams.append(CUBOID([bx, distance + py + (py / 2.0) + beamWidth, bz]))

        # last pillar
        pillars += [T(2)(distance + py), pillar]

        floors += [STRUCT(pillars), T(3)(height), STRUCT(beams), T(3)(bz)]

    return STRUCT(floors)
예제 #2
0
파일: columna.py 프로젝트: romatre/ggpl
def columna(dm, h):
    """
    Columna

    :param dm: is the circumference diameter at the column basis;
    :param h: is the column height;
    :return:
    """
    cylndr = COMP([JOIN, TRUNCONE([dm / 2, .8 * dm / 2, h])])(24)
    torus_bot = COMP([JOIN, TORUS([dm / 12, dm / 2])])([8, 27])
    torus_top = COMP([JOIN, TORUS([.8 * (dm / 12), .8 * (dm / 2)])])([8, 24])
    base = COMP([T([1, 2])([7 * dm / -12, 7 * dm / -23]), CUBOID])([7 * dm / 6, 7 * dm / 6, dm / 6])
    base_top = COMP([T([1, 2])([7 * dm / -12, 7 * dm / -12]), CUBOID])([7 * dm / 6, 7 * dm / 6, dm / 6])
    capital = SUM([
        COMP([JOIN, TRUNCONE([.8 * dm / 2, 1.2 * dm / 2, h / 8])])(4),
        COMP([R([1, 2])(PI / 4), JOIN, TRUNCONE([.8 * dm / 2, 1.2 * dm / 2, h / 8])])(4)
    ])
    return TOP([TOP([TOP([TOP([TOP([base, torus_bot]), cylndr]), torus_top]), capital]), base_top])
예제 #3
0
 def struttura():
     return HEX(color)(DIFFERENCE([
         CUBOID([larghezza_armadio, altezza_armadio, profondita_armadio]),
         T([1, 2, 3])([spessore_cornice, spessore_cornice, spessore_cornice])(CUBOID([
             larghezza_armadio-(spessore_cornice*2),
             altezza_armadio-(spessore_cornice*2),
             profondita_armadio
         ]))
     ]))
예제 #4
0
 def ripiani(N):
     """
     genera N ripiani dell'armadio
     :param N:
     :return:
     """
     if (N == 0):
         return CUBOID([0])
     return STRUCT(map(lambda i: T([1, 2])([spessore_cornice, (float(altezza_armadio)/(N+1))*(i+1)])(ripiano()), range(0, N)))
예제 #5
0
 def ante(N):
     """
     genera N ante dell'armadio
     :param N:
     :return:
     """
     if(N == 0):
         return CUBOID([0])
     return STRUCT(map(lambda i: T([1, 3])([float(larghezza_armadio)/N*i, profondita_armadio])(
         anta(float(larghezza_armadio)/N)), range(0, N)))
예제 #6
0
    def anta(larghezza_anta):
        """
        crea un'anta
        :param larghezza_anta:
        :return:
        """
        cornice = CUBOID([larghezza_anta, altezza_armadio, spessore_cornice])
        vetro = T([1, 2])([spessore_cornice, spessore_cornice])(
            CUBOID([larghezza_anta - spessore_cornice * 2, altezza_armadio - spessore_cornice * 2, spessore_cornice]))
        vetro = hex_material("#00EAFF", "#00EAFF", .4)(vetro)
        cornice = STRUCT([
            HEX("#f1c40f")(T([1, 2])([spessore_cornice/2, altezza_armadio/3])(DIFFERENCE([
                T([1, 2, 3])([larghezza_anta - spessore_cornice, spessore_cornice, spessore_cornice])(
                    CUBOID([spessore_cornice/2, spessore_cornice * 2, spessore_cornice])),
                T([1, 2, 3])([larghezza_anta - spessore_cornice, spessore_cornice-(spessore_cornice/3), spessore_cornice-(spessore_cornice/3)])(
                    CUBOID([spessore_cornice/2, spessore_cornice * 2, spessore_cornice])),
            ]))),
            HEX(color)(DIFFERENCE([cornice, vetro]))
        ])

        return STRUCT([cornice, vetro])
예제 #7
0
파일: utilities.py 프로젝트: romatre/ggpl
def arrangedCircularly(o, r, n):
    """
    Dispone l'oggetto o, in un raggio immaginario r, n oggetti.

    :param o:
    :param r:
    :param n:
    :return:
    """
    return STRUCT(
        map(
            lambda i: T([1, 2])
            ([r * math.cos((2 * PI / n) * i), r * math.sin((2 * PI / n) * i)])
            (R([1, 2])((2 * PI / n) * i)(HEX(randomColor())(o))), range(0, n)))
예제 #8
0
def composizione_armadio():
    armadio1 = T([1, 2, 3])([0, 0, 0])(armadio(
        larghezza_armadio=1.2,
        altezza_armadio=2.8,
        profondita_armadio=1.2,
        spessore_cornice=.04,
        numero_ante=0,
        numero_ripiani=6,
        color="#2c3e50",
    ))

    armadio2 = T([1, 2, 3])([1.2, 1.6, 0])(armadio(
        larghezza_armadio=2,
        altezza_armadio=1.2,
        profondita_armadio=.7,
        spessore_cornice=.04,
        numero_ante=4,
        numero_ripiani=2,
        color="#34495e",
    ))

    armadio3 = T([1, 2, 3])([3.2, 1.6, 0])(armadio(
        larghezza_armadio=1,
        altezza_armadio=.6,
        profondita_armadio=.7,
        spessore_cornice=.04,
        numero_ante=0,
        numero_ripiani=0,
        color="#2c3e50",
    ))

    pavimento = HEX("#c0392b")(CUBOID([6, 0, 4]))

    parete = HEX("#c0392b")(CUBOID([6, 3.5]))

    return STRUCT([parete, pavimento, T(1)(1)(STRUCT([armadio1, armadio2, armadio3]))])
예제 #9
0
파일: arch.py 프로젝트: romatre/ggpl
def arch(rr=5, w=1, depth=1, a=1, b=1, half=TRUE):
    """
    Arcata parametrizzabile

    :param rr: raggio maggiore
    :param w: raggio minore
    :param depth: spessore
    :param a: schiacciamento
    :param b: allungamento
    :param half: arco (default TRUE) o circolare
    :return:
    """
    y = lambda (p, q): a * q * math.sin(p)
    x = lambda (p, q): b * q * math.cos(p)

    numberOfPI = 1 if half else 2

    dom2D = MAP([x, y])(T(2)(rr)(PROD(
        [INTERVALS(numberOfPI * PI)(24),
         INTERVALS(w)(1)])))
    dom3D = MULTEXTRUDE(dom2D)(depth)
    return dom3D