PROCEDURE faltkarte;
CONST 
	pageWidth=297;
	pageHeight=210;
	pageFoldY=100;
VAR
	objectX1,objectX2,objectX3,objectX4,objectX5,objectX6,objectX7,objectX8,objectX9:REAL;
	objectXX1,objectXX2,objectXX3,objectXX4,objectXX5,objectXX6,objectXX7,objectXX8,objectXX9,objectXX10:REAL;
	objectY1,objectY2,objectY3,objectYY0,objectYY1,objectYY2,objectYY3:REAL;
	width,depth,height,distance:	REAL;
	wwidth,ddepth,hheight,ddistance:	REAL;
	nVolumes:  INTEGER;
	i,u:  INTEGER;
BEGIN
	{*werte in variablen speichern*}
	nVolumes:=7;
	width:=30;
	wwidth:=20;
	distance:=(pageWidth-(nVolumes*width))/2;
	ddistance:=width-wwidth;
	depth:=80;
	ddepth:=50;
	height:=15;
	hheight:=10;

	{*yWerte für die Linien berechnen*}
		objectY1:=pageFoldY - depth;
		objectY3:=pageFoldY + height;
		objectY2:=objectY3-depth;

		objectYY1:=objectY3-ddepth;
		objectYY3:=objectY3+hheight;
		objectYY2:=objectYY3-ddepth;
		objectYY0:=objectYY1-height;

	
	{*dina a4 blatt zeichnen*}
	penFore(0,0,65535);
	moveto(0,0);
	lineto(pageWidth,0);
	lineto(pageWidth,pageHeight);
	lineto(0,pageHeight);
	lineto(0,0);

	{*in dieser Schleife werden die Volumes gezeichnet*}

		FOR i:=0 TO 6 DO BEGIN
				IF (NOT((i=0)OR(i=4))) THEN BEGIN		
		{*links und rechts des Volumes berechnen*}
		objectX1:=distance+(i*width);
		objectX2:=distance+width+(6*width);
	
{*blau*}
		penFore(0,0,65535);
	moveto(objectX1,objectY1);
	lineto(objectX1,objectYY1);
	moveto(objectX2,objectY1);
	lineto(objectX2,objectY3);		
	END
		
		ELSE BEGIN
		objectX1:=distance+(i*width);
		objectX2:=distance+width+(6*width);
{*blau*}
		penFore(0,0,65535);
	moveto(objectX1,objectY1);
	lineto(objectX1,objectY3);
{*rot*}
		penFore(65535,0,0);
	moveto(objectX1,objectY1);
	lineto(objectX2,objectY1);	
	moveto(objectX1,objectY2);
	lineto(objectX2,objectY2);	
END;

FOR u:=0 TO 5 DO BEGIN
	IF (NOT(u=3)) THEN BEGIN		
		{*links und rechts des Volumes berechnen*}
		objectXX1:=u*(ddistance+wwidth)+distance+2*ddistance;
		objectXX2:=objectXX1+wwidth;

{*blau*}
		penFore(0,0,65535);

		moveto(objectXX1,objectYY1);
		lineto(objectXX1,objectYY3);
		moveto(objectXX2,objectYY1);
		lineto(objectXX2,objectYY3);

{*rot*}
		penFore(65535,0,0);

		moveto(objectXX1,objectYY1);
		lineto(objectXX2,objectYY1);
		moveto(objectXX1,objectYY2);
		lineto(objectXX2,objectYY2);
		moveto(objectXX1,objectYY3);
		lineto(objectXX2,objectYY3);

END;
END;
message('Piano ohne Accord');
		
END;
moveto(objectX2,pageFoldY);	
lineTo(pageWidth,pageFoldY);

END;
RUN(faltkarte);