!******************************************************* basic geometry module l_rmbs2( STRING rn*10 >"Ange ritningens namn !"); !* Skriver ut ritning p} MBS-format. !* Parter expanderas. !* !* (C)microform ab 8/2/90 J. Kjellander !* !* 20/1-95 Kurva och m}tt, J. Kjellander !* 1998-01-02 WIDTH, J.Kjellander !* !******************************************************* INT typ,nref,blnk,niv,actniv,pen,actpen,dimtyp,ns, mattr,np,mant,i,ptyp,lf,actlf,af,actaf,tf,acttf, cf,actcf,ns_geo,ns_gra,segtyp,dnd,actdnd,auto,actauto; REF id,gid(3),idm(100),kid; STRING fnam*80,txt*132,namn*10,snr*10; FLOAT r,v1,v2,arcseg(4,4,4),ld,actld,ad,actad,cd,actcd, th,tb,tl,actth,acttb,acttl,offset,curseg(4,4),dps,actdps, dts,actdts,width,actwdt; VECTOR p1,p2,p3; FILE utfil; beginmodule !* !***Initiering. !* actniv:=0; actpen:=1; actlf:=0; actld:=3; actaf:=0; actad:=3; actcf:=0; actcd:=3; acttf:=0; actth:=5; acttb:=60; acttl:=15; actdnd:=0; actauto:=1; actdps:=5; actdts:=5; actwdt:=0.0; !* !***\ppna utfil och ladda RIT-fil. !* open(utfil,"W",act_jobdir()+rn+".MBS"); !* load_gm(act_jobdir()+rn+".RIT"); !* !***Deklaration av modul. !* outstr(utfil,"BASIC DRAWING MODULE "+rn+"();"); outlin(utfil); outlin(utfil); outstr(utfil," FLOAT segdat(100,4,4);"); outlin(utfil); outlin(utfil); outstr(utfil,"BEGINMODULE"); outlin(utfil); outlin(utfil); !* !***H{mta storheter ur GM. !* snr:="#0"; set_root_gm(); next: id:=get_next_gm(); if id <> #0 then gethdr(id,typ,nref,blnk,niv,pen,gid); if typ = 2 or typ = 4 or typ = 8 or typ = 32 then width:=getwidth(id); else width:=0.0; endif; if width<>actwdt then outstr(utfil," set(WIDTH="+str(width,-1,5)+");"); outlin(utfil); actwdt:=width; endif; if niv<>actniv then outstr(utfil," set(LEVEL="+str(niv,-1,0)+");"); outlin(utfil); actniv:=niv; endif; if pen<>actpen then outstr(utfil," set(PEN="+str(pen,-1,0)+");"); outlin(utfil); actpen:=pen; endif; !* !***Punkt. !* if typ=1 then getpoi(id,p1); snr:="#"+str(val(substr(snr,2))+1,-1,0); outstr(utfil," poi_free("+snr); outstr(utfil,",vec("+str(p1.x,-1,5)+","+str(p1.y,-1,5)+"));"); outlin(utfil); !* !***Linje. !* elif typ=2 then getlin(id,lf,ld,p1,p2); snr:="#"+str(val(substr(snr,2))+1,-1,0); if lf<>actlf then outstr(utfil," set(LFONT="+str(lf,-1,0)+");"); outlin(utfil); actlf:=lf; endif; if ld<>actld then outstr(utfil," set(LDASHL="+str(ld,-1,5)+");"); outlin(utfil); actld:=ld; endif; outstr(utfil," lin_free("+snr); outstr(utfil,",vec("+str(p1.x,-1,5)+","+str(p1.y,-1,5)+")"); outstr(utfil,",vec("+str(p2.x,-1,5)+","+str(p2.y,-1,5)+"));"); outlin(utfil); !* !***Arc. !* elif typ=4 then getarc(id,af,ad,p1,r,v1,v2,ns,arcseg); snr:="#"+str(val(substr(snr,2))+1,-1,0); if af<>actaf then outstr(utfil," set(AFONT="+str(af,-1,0)+");"); outlin(utfil); actaf:=af; endif; if ad<>actad then outstr(utfil," set(ADASHL="+str(ad,-1,5)+");"); outlin(utfil); actad:=ad; endif; outstr(utfil," arc_1pos("+snr); outstr(utfil,",vec("+str(p1.x,-1,5)+","+str(p1.y,-1,5)+"),"); outstr(utfil,str(r,-1,5)+","+str(v1,-1,5)+","+str(v2,-1,5)+");"); outlin(utfil); !* !***Kurva. !* elif typ=8 then getcurh(id,cf,cd,ns_geo,ns_gra); snr:="#"+str(val(substr(snr,2))+1,-1,0); if cf<>actcf then outstr(utfil," set(CFONT="+str(cf,-1,0)+");"); outlin(utfil); actcf:=cf; endif; if cd<>actcd then outstr(utfil," set(CDASHL="+str(cd,-1,5)+");"); outlin(utfil); actcd:=cd; endif; for i:=1 to ns_geo do getseg(id,i,0,curseg,offset,segtyp); outstr(utfil," segdat("+str(i,-1,0)+",1,1"+"):="+ str(curseg(1,1),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",1,2"+"):="+ str(curseg(1,2),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",1,3"+"):="+ str(curseg(1,3),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",1,4"+"):="+ str(curseg(1,4),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",2,1"+"):="+ str(curseg(2,1),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",2,2"+"):="+ str(curseg(2,2),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",2,3"+"):="+ str(curseg(2,3),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",2,4"+"):="+ str(curseg(2,4),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",3,1"+"):="+ str(curseg(3,1),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",3,2"+"):="+ str(curseg(3,2),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",3,3"+"):="+ str(curseg(3,3),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",3,4"+"):="+ str(curseg(3,4),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",4,1"+"):="+ str(curseg(4,1),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",4,2"+"):="+ str(curseg(4,2),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",4,3"+"):="+ str(curseg(4,3),-1,14)+";"); outlin(utfil); outstr(utfil," segdat("+str(i,-1,0)+",4,4"+"):="+ str(curseg(4,4),-1,14)+";"); outlin(utfil); endfor; outstr(utfil," cur_usrdef("+snr+","+str(ns_geo,-1,0)+",segdat);"); outlin(utfil); !* !***Text. !* elif typ=32 then gettxt(id,p1,tf,th,tb,tl,v1,txt); snr:="#"+str(val(substr(snr,2))+1,-1,0); if tf<>acttf then outstr(utfil," set(TFONT="+str(tf,-1,0)+");"); outlin(utfil); acttf:=tf; endif; if th<>actth then outstr(utfil," set(TSIZE="+str(th,-1,5)+");"); outlin(utfil); actth:=th; endif; if tb<>acttb then outstr(utfil," set(TWIDTH="+str(tb,-1,5)+");"); outlin(utfil); acttb:=tb; endif; if tl<>acttl then outstr(utfil," set(TSLANT="+str(tl,-1,5)+");"); outlin(utfil); acttl:=tl; endif; outstr(utfil," text("+snr); outstr(utfil,",vec("+str(p1.x,-1,5)+","+str(p1.y,-1,5)+"),"); outstr(utfil,str(v1,-1,5)+","+chr(34)+txt+chr(34)+");"); outlin(utfil); !* !***L{ngdm}tt. !* elif typ=128 or typ=256 then snr:="#"+str(val(substr(snr,2))+1,-1,0); if typ = 128 then getldm(id,p1,p2,p3,dimtyp,dps,dts,dnd,auto); else getcdm(id,p1,p2,p3,dimtyp,dps,dts,dnd,auto); endif; if dps<>actdps then outstr(utfil," set(DASIZ="+str(dps,-1,5)+");"); outlin(utfil); actdps:=dps; endif; if dts<>actdts then outstr(utfil," set(DTSIZ="+str(dts,-1,5)+");"); outlin(utfil); actdts:=dts; endif; if dnd<>actdnd then outstr(utfil," set(DNDIG="+str(dnd,-1,0)+");"); outlin(utfil); actdnd:=dnd; endif; if auto<>actauto then outstr(utfil," set(DAUTO="+str(auto,-1,0)+");"); outlin(utfil); actauto:=auto; endif; outstr(utfil," ldim("+snr); outstr(utfil,",vec("+str(p1.x,-1,5)+","+str(p1.y,-1,5)+")"); outstr(utfil,",vec("+str(p2.x,-1,5)+","+str(p2.y,-1,5)+")"); outstr(utfil,",vec("+str(p3.x,-1,5)+","+str(p3.y,-1,5)+")"); outstr(utfil,","+str(dimtyp,-1,0)+");"); outlin(utfil); endif; !* !***N{sta storhet. !* goto next; endif; !* !***Slut p} filen. !* outlin(utfil); outstr(utfil,"ENDMODULE"); outlin(utfil); !* !***St{ng densamma. !* close(utfil); endmodule !*******************************************************