# *******************************************************************
#
#         Mattenschneideskizze nach Schweizer SIA-Norm
# ergänzt - mehrseitiger Druck 07.12.2010 LF
# *******************************************************************

name(i30,"reihe") ;
name(i31,"spalte");
name(i32,"blatnr");
name(r30,"abstx");
name(r31,"absty");

name(i40,"penrah");
name(i41,"penpos");
name(i42,"penlb") ;
name(i43,"penbez");
name(r40,"txhvau");
name(r41,"txhpos");
name(r42,"txhlb") ;
name(r43,"txhbez");
name(r44,"mastab");

penrah = 2 ;           # Farbe fuer den Rahmen               0=Nicht zeichnen
txhvau = 0.0 ;         # Texthoehe fuer den Auszug darunter  0.0 = nicht
penpos = 4;
txhpos = 17.5;         # Farbe+Texthoehe Positionsnummer in Matte
penlb  = 1;
txhlb  = 10.0;         # Farbe+Texthoehe Laenge/Breite
penbez = 3;
txhbez = 17.5;         # fuer Bezeichnung ueber der Matte

mastab = 2.0;
mbwbiegevor(mastab,penrah,penpos,penlb,penbez,txhvau,txhpos,txhlb,txhbez);
# 2.0 ist der faktor zum verkleinern der matte da list 1:100 und Plan 1:50

#Einfügepunkt auf 0 setzen
	p1.x = 0;
	p1.y = 0;
	p1.z = 0;

# Abfrage Einfügepunkt
# Mehrseitiger Druck?
	if (WCOPLOTPAGE = 0 ) then
		begin
   write("Einfuegepunkt SIA -Schneideskizze:");
   read(p1);
	end
  
   blatnr = 1;
   reihe  = 0;
   spalte = 0;

  plotpage(blatnr,p1);

   insert("WCOSIA","ARTIFEX",p1,50.0,50.0,0.0);
   # Block/Zelle wcomsk in Bibliothek ARTIFEX

   abstx= 300.0 / mastab;
   absty= 760.0 / mastab;
   p3 = p1 ;
   p3.x = p3.x + 170 / mastab ;
   p3.y = p3.y + 1200  / mastab ;


   write(mbwanzbieg);

   for i88 = 1 to mbwanzbieg do
     begin
      p2 = p3 ;
      p2.x = p2.x + reihe * abstx;
      p2.y = p2.y + spalte* absty;

      i87 = 4;
      reihe = reihe + 1;
      if( reihe = i87) then
         begin
          reihe = 0;
          spalte = spalte +1;
         end;
       mbwplbiege(p2,i88);
      if( spalte = 2) then
          begin
           spalte = 0 ;
           reihe      = 0 ;
           blatnr = blatnr + 1;
           p1.x = p1.x + 2500.0 / mastab;
           p3 = p1 ;
           p3.x = p3.x + 170.0 / mastab ;
           p3.y = p3.y + 1200.0 / mastab ;
        plotpage(blatnr,p1);
           insert("WCOSIA","ARTIFEX",p1,50.0,50.0,0.0);
          end

#       mbwplbiege(p2,i88);
     end


   # Einfuegen der Gesamtanzahl aller Matten
   abstx = 210.0/mastab;
   absty = 159.2/mastab;
   p2  = p1;
   p2.x = p2.x + 1400/mastab;
   p2.y = p2.y + 2360 / mastab;

   gst_height(12.5);
   gst_color(2);

   gst_rotation(0.0);

   for i88 = 1 to mbwanzmatt do
     begin
      p3=p2;
      mbwliste(i88,"GANZ","7",s1);
      text(p3,s1);
      p3.x = p3.x + abstx ;
      mbwliste(i88,"GTYP","7",s1);
      text(p3,s1);
      p3.x = p3.x + abstx ;
      mbwliste(i88,"GGWP","7.2",s1);
      text(p3,s1);
      p2.y = p2.y - absty / mastab ;
     end


   p2 = p1;
   p2.x = p2.x + 1450 / mastab;
   p2.y = p2.y + 1390 / mastab;
   mbwliste(i88,"GGEW","7.2",s1);
   text(p2,s1);
   end

	# Start mehrseitiger Druck   
	plotpage(0,p1);
	write("");

END.

