CAAD.HBT.ETHZ.CH . Caad0506st . AiTeamAndreaNina

ETH Zuerich - Startseite
Professur für CAAD

 


caad d-arch

Edit | Attach | Backlinks: Web All webs | Printable | History: r3 < r2 < r1 More
{

/* Folding Box

}

PROCEDURE GenerateBox;

   CONST
      GlueFactor = 0.1;

   VAR
      Height:REAL;
      Radius:REAL;
      Edge:REAL;
      Angel: REAL;
      CutColor:INTEGER;
      FoldColor:INTEGER;

      Corners:INTEGER;
      RunVar:INTEGER;

   BEGIN
      {assign Parameters}
      Height := PHEIGHT;
      Radius := PRADIUS;
      Corners := PCORNERS;
      CutColor:=PCUTCOLOR;
      FoldColor:=PFOLDCOLOR;

      {get Edgelegth & Angel}
      Edge := 2 * Radius * sin(Pi/Corners);
      Angel := Pi/Corners;
      
      PenFore(FoldColor);
      MoveTo(0,0);
      LineTo(Edge*Corners,0);
      MoveTo(0, Height);
      LineTo(Edge*Corners, Height);
      PenFore(CutColor);
      MoveTo(Edge*Corners,0);
      LineTo(Edge*Corners, Height);
      MoveTo(0,0);
      LineTo(-GlueFactor*Radius, GlueFactor*Radius);
      LineTo(-GlueFactor*Radius, Height-GlueFactor*Radius);
      LineTo(0, Height);
      LineTo(-GlueFactor*Radius, Height+GlueFactor*Radius);
      LineTo(-GlueFactor*Radius, Height+cos(Angel)*Radius-GlueFactor*Radius);
      LineTo(0, Height+cos(Angel)*Radius);
      MoveTo(Edge*Corners,Height);
      LineTo(Edge*Corners,Height+cos(Angel)*Radius);
      FOR RunVar := 1 TO Corners DO BEGIN
         PenFore(FoldColor);
         MoveTo(Edge*(RunVar-1),0);
         LineTo(Edge*(RunVar-1),Height);
         MoveTo(Edge*(RunVar-1),Height);
         LineTo(Edge*(RunVar-1),Height+cos(Angel)*Radius);
         MoveTo(Edge*RunVar,Height+cos(Angel)*Radius);
         PenFore(CutColor);
         LineTo(Edge*RunVar-sin(Angel)*Radius,Height+cos(Angel)*Radius);
         PenFore(FoldColor);
         LineTo(Edge*RunVar, Height);
         PenFore(CutColor);
         ArcByCenter(Edge*(RunVar-0.75), Height+cos(Angel)*Radius,Edge/4, 0, 180);
         MoveTo(Edge*(RunVar-1),0);
         LineTo(Edge*(RunVar-1)+GlueFactor*Radius,-GlueFactor*Radius);
         LineTo(Edge*(RunVar)-GlueFactor*Radius,-GlueFactor*Radius);
         LineTo(Edge*RunVar,0);
         MoveTo(Radius+Radius*cos(2*Angel*(RunVar-1)),-Radius*(1+2*GlueFactor)+Radius*sin(2*Angel*(RunVar-1)));
         LineTo(Radius+Radius*cos(2*Angel*RunVar),-Radius*(1+2*GlueFactor)+Radius*sin(2*Angel*RunVar));
      END;
   END;

RUN(GenerateBox);

* 1.jpg:
1.jpg

Attachment sort Action Size Date Who Comment
jpg IMG_1754.JPG manage 627.4 K 21 Jun 2006 - 13:10 AiAndreaSchregenberger CNC Verpackung
jpg IMG_1761.JPG manage 788.5 K 21 Jun 2006 - 13:15 AiAndreaSchregenberger  
jpg IMG_1759.JPG manage 841.8 K 21 Jun 2006 - 13:15 AiAndreaSchregenberger  
jpg IMG_1755.JPG manage 680.4 K 21 Jun 2006 - 13:13 AiAndreaSchregenberger CNC Verpackung
jpg IMG_1757.JPG manage 575.5 K 21 Jun 2006 - 13:14 AiAndreaSchregenberger CNC Verpackung

Edit | Attach | Backlinks: Web All webs | Printable | History: r3 < r2 < r1 More

Revision r3 - 21 Jun 2006 - 13:15 - AiAndreaSchregenberger
Parents: Caad06ub > VectorScript

This website has been archived and is no longer maintained.