Suppose I have this code:
\startMPpage
vardef MyShape(expr w, h) =
save pth; path pth ;
save pic; picture pic;
pth = fullsquare xysized (w, h);
pic := image (
draw pth;
% all kind of stuff here
);
setbounds pic to pth;
pic
enddef ;
picture s ; s := MyShape(4cm, 2cm);
draw s;
drawdot center leftboundary s withpen pencircle scaled 2 withcolor green;
drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;
drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;
drawdot origin withpen pencircle scaled 2 withcolor red;
\stopMPpage
Can I reuse that varied across follow-up MPPages?
G