! MBS-code automatically generated by COW ! Version 1.0 Daterra AB, Sweden MACRO GEOMETRY MODULE edconst(); !* !***Edit constants like density of water !* INT main_id,bidx; INT bid1, bid2, bid3, bid4, bid5, bid6, bid7, bid8; INT eid1; FLOAT rho,k(1); INT status,quit; BEGINMODULE !* !***Get the density of water. If database is empty the !***default is Seawater. !***Input is in kg/m^3 for convinience, but we store !***everything in kg,mm units. !* status:=getdat_gm("DENSITY_WATER",k); if status < 0 then k(1):=1025.0/1E9; endif; main_id:=cre_win(vec(0,0),200,142,"Density of water"); bid1:=cre_button(main_id,vec(6,40),87,22,1,"Saltwater","Saltwater"); bid2:=cre_button(main_id,vec(105,40),87,22,1,"Freshwater","Freshwater"); bid3:=cre_button(main_id,vec(6,110),54,26,2,"OK","OK"); bid4:=cre_button(main_id,vec(66,110),54,26,2,"Reject","Reject"); bid5:=cre_button(main_id,vec(138,110),54,26,2,"Help","Help"); bid6:=cre_button(main_id,vec(6,4),186,18,0,"Enter or select","Enter or select"); bid7:=cre_button(main_id,vec(6,18),186,18,0,"density of water:","density of water:"); bid8:=cre_button(main_id,vec(108,73),50,20,0,"kg/m³","kg/m³"); eid1:=cre_edit(main_id,vec(42,72),60,20,1,str(k(1)*1E9,-1),8); show_win(main_id); quit:=0; loop: bidx:=wait_win(main_id); ! Saltwater if bidx = bid1 then k(1):=1025.0/1E9; quit:=1; endif; ! Freshwater if bidx = bid2 then k(1):=1000.0/1E9; quit:=1; endif; ! OK if bidx = bid3 then rho:=fval(get_edit(main_id,eid1),status); if status = 0 then k(1):=rho/1E9; quit:=1; else lst_ini("INPUT ERROR"); lst_lin("Your density is not a number:"); lst_lin(""); lst_lin("Please do it again."); lst_exi(); quit:=-1; endif; endif; ! Reject if bidx = bid4 then quit:=-1; endif; ! Help if bidx = bid5 then quit:=-1; endif; if quit = 0 then goto loop; endif; del_win(main_id); if quit = 1 then status:=deldat_gm("DENSITY_WATER"); status:=putdat_gm("DENSITY_WATER", 1, k); endif; ENDMODULE