Am 07.05.2013 um 22:28 schrieb Roland Thiers
Thank you very much for this precision, Wolfgang. I tried with two variables and it works with this syntax :
\startuniqueMPgraphic{polygoneregulier} numeric u ; u:=\MPvar{unite}*cm ; numeric n ; n:=\MPvar{sides}; rest of the code \stopuniqueMPgraphic
\define[2]\polyreg {\setupMPvariables[polygoneregulier][unite,sides] \uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}}
You can define the command as \define[2]\polyreg {\setupMPvariables[polygoneregular][sides=#1,unite=#2]% \uniqueMPgraphic{polygoneregular}} where the variables are set with the \settupMPvariables command or as \define[2]\polyreg {\uniqueMPgraphic{polygoneregular}{sides=#1,unite=#2}} where the variables are set in the optional argument for \uniqueMPgraphic.
\starttext %\uniqueMPgraphic{polygoneregulier}{unite=2,sides=4} \polyreg{6}{0.5} \stoptext
I did not find any détails on \MPvar et \setupMPvariables on the wiki, however
Both commands are mentioned in the metafun [1] manual. [1] http://www.pragma-ade.nl/show-man-7.htm Wolfgang