ETH Zuerich - Startseite
Professur für CAAD

 


caad d-arch


Caad Teaching
 

 
Bachelor of Architecture: CAAD II ss07

 
Master of Advanced Studies
in Architecture, CAAD


 
DWF-Processing
Programmieren statt Zeichnen


 
Graustufen - Ein Atlas
Schweizer Wohngebäude als XML Daten


 
DWF- Denken in Systemen:
In Collaboration with the Technical University Vienna


 
Seminarwoche:
BlowUp


 
Archiv

 
Caad Projects
 

 
Theory
 
Design
 
Building
 
Practice

 
Related pages
 

 
Swiss Federal Institute of Technology Zurich
 
Institute of Building Technology
 
Faculty of Architecture

 
Other pages

 










hbt d-arch

MAS ETH ARCH/CAAD - 2005/06 - STUDENT PAGES
Master of Advanced Studies in Architecture, Specialization in Computer Aided Architectural Design | 065-0005/6
Supervision: Prof. Dr. Ludger Hovestadt, Philipp Schaerer
Chair of CAAD, ETH Zurich





Toni Kotnik Module 1: Scripting|Mini-Assignment 1
programming of patterns


Example 1: shifting of linear elements


Script2.JPG

PROCEDURE Script1;

VAR
   i,j : INTEGER;    (* counters *)
   r,g,b : LONGINT;  (* variables for rgb-colors *)

BEGIN
   r:=0;g:=0;b:=0;   (* set color to black *)
   j:=12;            (* parameter for manipulation *)
   FOR i:=5 TO 300 DO
      BEGIN
         PenFore(r+i*175,g,b); (* shift of color from black to red *)
         MoveTo(2*i+10*j,Cos(2*pi*i/100)*15+10*j); (* line from ... *)
         LineTo(i+20*j,Sin(4*pi*i/100)*25+18*j);   (* ... to *)  
         RotatePoint(i+2*j,2*j+i,-10*j);           (* rotate line *) 
         DSelectAll;
      END;   
END;
RUN(Script1);


Example 2: rotation of linear bundles


Script3gesamt.jpg

PROCEDURE Script2;

VAR
   i,j : INTEGER;      (* counters *)
   r,g,b : LONGINT;    (* variables for rgb-colors *)
   x1,y1,x2,y2 : REAL; (* coordinates of rectangle *)
   dy : REAL;          (* value of shift *)

BEGIN
   ColorIndexToRGB(50,r,g,b); (* rgb-values of grey *)
   FOR i:=1 TO 85 DO
      BEGIN    
         x1:=i; y1:=i;     (* set lower left corner of rectangle *)
         x2:=2*i; y2:=3*i; (* set upper right corner of rectangle *)
         dy:=(y2-y1)/25;   (* set shift into y-direction *)
         PenFore(r,g,b);   (* rectangle in grey *) 
         Rect(x1,y1,x2,y2);   
         PenFore(i*600,0,0); (* shift of color from black to red for the linear bundle *)
         FOR j:=0 TO 30 DO   (* size of bundle 3) 
            BEGIN       (* line from lower left corner to right edge of rectangle *)
               MoveTo(x1+Random*10,y1);
               LineTo(x2+cos(4*pi*j/25)*5,y1+j*dy+Random*3);
            END;
         RotatePoint(Sin(x1)*10,Sin(y1)*10,10*i); (* rotation of rectangle and bundle *)
         MoveObjs(-10*i,2*i,FALSE,FALSE);         (* move rotated rectangle and bundle = selected objects on active layer *) 
         DSelectAll;   
      END;
END;
RUN(Script2);


Example 3: algorithmic drawing


Script4gesamt.jpg

PROCEDURE Script3;

CONST 
   n = 75; (* number of basic elements *)
   m = 9;  (* depth of basic element *) 

VAR
   i,j : INTEGER;                         (* counters *)
   r,g,b : LONGINT;                       (* variables for rgb-colors *)
   x1,y1,x2,y2,dx,dy : REAL;              (* variables for basic figure *)
   fib : ARRAY [0..n] OF INTEGER;         (* Fibonacci series *)
   corner : ARRAY [0..n,1..2] OF INTEGER; (* series of bounding boxes *)

BEGIN
   r:=0;g:=0;b:=0; (* set color to black *)
   PenFore(r,g,b);
   fib[0]:=1; fib[1]:=1;           (* initialization of Fibonacci series *)
   FOR i:=2 TO n DO
      fib[i]:=fib[i-1]+fib[i-2];
   corner[0,1]:=0; corner[0,2]:=0; (* initialization of corners of bounding box *)
   FOR i:=1 to n DO
      BEGIN
         CASE i MOD 4 OF           (* calculation of bounding box *)
            0:BEGIN
               corner[i,1]:=corner[i-1,1]+fib[i-1]*2^m;
               corner[i,2]:=corner[i-1,2]-fib[i-1]*2^m;
              END;   
            1:BEGIN
               corner[i,1]:=corner[i-1,1]+fib[i-1]*2^m;
               corner[i,2]:=corner[i-1,2]+fib[i-1]*2^m;
              END;   
            2:BEGIN
               corner[i,1]:=corner[i-1,1]-fib[i-1]*2^m;
               corner[i,2]:=corner[i-1,2]+fib[i-1]*2^m;
              END;   
            3:BEGIN
               corner[i,1]:=corner[i-1,1]-fib[i-1]*2^m;
               corner[i,2]:=corner[i-1,2]-fib[i-1]*2^m;
              END;   
         END;
         dx:=corner[i,1]-corner[i-1,1];   (* size of bounding box *)
         dy:=corner[i,2]-corner[i-1,2];
         FOR j:=1 TO m DO                 (* construction of basic element by scaling *)
            BEGIN
               x1:=corner[i-1,1];         
               y1:=corner[i-1,2];
               x2:=corner[i-1,1]+dx/2^j;
               y2:=corner[i-1,2]+dy/2^j;
               PenSize(30*Random+10);     (* random variation of pen size *)
               Oval(x1,y1,x2,y2);
               DSelectAll;
            END;
      END;      
END;
RUN(Script3);


Example 4: welcome to the pleasuredome


Script5.JPG

PROCEDURE Script4;

VAR
   i : INTEGER;    (* counter *)
   
BEGIN
   FOR i:=0 TO 125 DO  (* construction of loudspeaker *)
      BEGIN
         PenFore(60000-i*300,0,0);
         Arc(0,0,i,2*i,Random*i-20,2*i);   
         DSelectAll;
      END;
   PenFore(0,0,0);
   TextFace([Bold,Italic]); (* define text style *)
   TextFont(GetFontID('Ariel'));
   FOR i:=0 TO 30 DO
      BEGIN
         TextRotate((Random-0.5)*5*i); 
         MoveTo(Random*30*i+70,Random*15*i+50);
         TextFlip(i MOD 3);
         TextSize(500*Random+100);
         BeginText;
            'hallo'
         EndText;
         DSelectAll;
      END;            
END;
RUN(Script4);






Revision r1.11 - 01 Nov 2006 - 10:13 - NDSToniKotnik
Parents: NDSToniKotnik
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

This website has been archived and is no longer maintained.