Here is an Asymptote example

unitsize(1cm);
draw((-.1,0) -- (2,0),
arrow=Arrow(TeXHead));
draw((0,-.1) -- (0,2), arrow =
Arrow(TeXHead));
draw((0,0) .. (1,1) .. (2,sqrt(2)));


Below is how I have started setting this up in Context. This creates a pdf file with the drawing, but it is not included in the final docuement.


\defineexternalfilter
[ASY]
[filtercommand={asy -tex "context" -View -outformat pdf -outname \externalfilteroutputfile\space \externalfilterinputfile},
output=\externalfilterbasefile.out,
readcommand=\typefile,
cache=force,
location=text,
continue=yes]

\starttext
\startASY[myplot]
unitsize(1cm);
draw((-.1,0) -- (2,0),
arrow=Arrow(TeXHead));
draw((0,-.1) -- (0,2), arrow =
Arrow(TeXHead));
draw((0,0) .. (1,1) .. (2,sqrt(2)));

\stopASY

\externalfigure[myplot]
\stoptext


Thanks
Jeroen

2014-12-28 12:04 GMT+01:00 Mojca Miklavec <mojca.miklavec.lists@gmail.com>:
Dear Aditya,

On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote:
> On Wed, 24 Dec 2014, Context NTG wrote:
>
>> Could anybody explain how to use Asymptote in ConTeXt with the filter
>> module.
>
> Can you post a minimal asymptote file and how it shoud be processed via the
> command line?

I have no time to create a nice minimal example, but here's an ugly
non-minimal example which should at least enable you to test the
interaction with the filter module.

I also added one ConTeXt-specific command while trying to make math
fonts work properly, just replace "lucidaot" with another font in case
you don't have that one installed.

You can run the example with
    asy -tex context cylinder.asy

(Maybe it's possible to set the tex engine inside the file as well.)


Bonus points if you can get PRC to work properly before TL 2015. Or if
you can make the file print properly from OS X without using Acrobat
or ghostscript/CUPS. Preview.app "forgets" to print the (smoothly
shaded) cylinder for example.

Mojca

___________________________________________________________________________________
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
___________________________________________________________________________________