I played around with it, but I have problems to understand the format of the returned path. Example: % -------- \setuppagenumber[state=stop] \starttext \nopdfcompression \startMPpage path p; p:= (20,20){up} .. {down}(200,100); passvariable("path",p); draw p ; \stopMPpage \ctxlua{inspect{metapost.variables["path"]}} \stoptext % ------- The PDF code of the path is (mainly) 20.000000 20.000000 m 20.000000 190.342880 200.000000 184.016693 200.000000 100.000000 c "path" contains table={ { { 200, 100, 200, 184.0167, 200, 100 }, }, } The end point and the second control point are the same, as in the PDF code. But how do I calculate the starting point and the first control point from the returned values? And is the type of operation (line, curve,..) given by the number of values? Peter Am 04.10.2013 16:15, schrieb Hans Hagen:
On 10/4/2013 2:52 PM, Peter Rolf wrote:
Hi,
I played around with the new passvariable() option and ran into errors when passing a path. Used the latest beta (01.10.2013). Can someone confirm this?
in mp-mlib.mpiv:
vardef mfun_path_to_string(expr p) = mfun_point_to_string(p,1) for i=2 upto length(p) : & " " & mfun_point_to_string(p,i) endfor enddef ;
vardef mfun_boolean_to_string(expr b) = if b : "true" else : "false" fi enddef ;
(i forgot to rename the argument when outlining the code)
fwiw: in your case you still get an (empty) graphic, use \startMPcalculation ... when you don't want that
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________