BASIC DRAWING MODULE Plot2Image( STRING AppName*132 > "Calling App Name"; STRING File_Dir*132 > "File Dir"; INT MODE > "MODE: 1/2: Single/Animation"; STRING IMG_TYPE*3 > "Image Type: (Single Only)"; STRING PAPER_SIZE*132 > "Paper size:"); !********************************************************** FLOAT PAPERSIZE_X; FLOAT PAPERSIZE_Y; FLOAT SCALE; FLOAT SCALE_X; FLOAT SCALE_Y; INT Level; INT PS_DPI; INT Pen; INT Pix; INT TextSize; INT i; STRING EachFile*132; STRING Message*132; STRING Plotfile*132; VECTOR MINPOS, MAXPOS; BEGINMODULE ! Initial Values: PAPERSIZE_X := 8.5 * 25.4; PAPERSIZE_Y := 11 * 25.4; !******************************************** msize_view(MINPOS, MAXPOS); rep_view(1, 0); ! Get the model boundaries by measuring these: ! X Boundary: lin_free(#24, MINPOS, vec(MAXPOS.x,MINPOS.y)); ! Y Boundary: lin_free(#25, MINPOS, vec(MINPOS.x,MAXPOS.y)); ! Get scales for X and Y because model aspect ratio varies. SCALE_X:=PAPERSIZE_X / arcl(#24); SCALE_Y:=PAPERSIZE_Y / arcl(#25); ! Use largest scale that will allow the model to fit: ! If Y >= X AND X * SCALE_Y <= PAPERSIZE_X if arcl(#25) > arcl(#24) AND arcl(#24) * SCALE_Y <= PAPERSIZE_X then SCALE:=SCALE_Y; else SCALE:=SCALE_X; endif; ! ! Send current window to plotfile: EachFile:=AppName+".PLT"; Plotfile:=File_Dir+EachFile; plot_win(MINPOS, MAXPOS, Plotfile); os("cd "+File_Dir+";xterm -e ./plot2img.sh "+str(SCALE,1)+";exit"); ENDMODULE