Asymptote

Introduction
Asymptote is a programming language with which you can create figures and graphs in two and three dimensions.

An Asymptote program can be stored in a file and compiled individually. In this way, it is possible to generate eps or pdf files, among other formats. But you can also choose to include the Asymptote code in a LaTeX document. In this case, you can include the Asymptote code in the same file where you have the LaTeX document or, if you prefer, you can store the Asymptote program in another file and then include it in the file where you have the LaTeX code.

The pdf-2D files generated from Asymptote codes can be viewed in any available pdf reader.

For the 3D figures obtained from Asymptote programs, you can choose between creating a still image of the 3D figure from a chosen point of view or you can generate an interactive pdf-3D file. As in the former case, files containing static images can be read with any pdf file reader.

Until now, in order to interact with the pdf-3D files that are created using Asymptote, the Acrobat Reader program in version 9 or higher must be used.

In order to get a pdf-3d file using this method, some packages must or are recommended to be installed on your system:
 * Needed: Asymptote compiler
 * Needed if you want to embed the interactive figure into a document: A LaTeX system, for example TeX Live
 * Very useful: An Integrated LaTeX Editing Environment, for example Kile or TeXstudio

Generating Asymptote code from FreeCAD.
Thanks to the developer wmayer, to date FreeCAD from version 0.19 -rev22411, can generate Asymptote codes from meshes created with the Mesh Design Workbench. The process is the following:
 * 1) In a FreeCAD document, create a 3d object, using for example the [[Image:Workbench_Part.svg|24px]] Part Workbench or [[Image:Workbench_PartDesign.svg|24px]] PartDesign Workbench.
 * 2) * You can assign colors to the faces of your choice, as you would normally do by launching the context menu of the selected element in the tree view.
 * In the document tree view, right-click the object you want to modify the colors.
 * In the dialog that appears, select: "Set colors".
 * Next, in the 3D view, one face at a time, click on the desired face and then, in the task panel, click on the button that is just below Faces [] then you can select the color you decide.
 * Press
 * 1) Change to the [[Image:Workbench_Mesh.svg|24px]] Mesh Design Workbench.
 * 2) Create a mesh of the desired object.
 * 3) With one click, select the object to export.
 * 4) From the menu, select . Or equivalently, on the toolbar, click on [[Image:Mesh_FromPartShape.svg|32px]] Create mesh from shape... icon.
 * 5) In the Task panel, select the desired options (such as colors, etc.) and then click the.
 * 6) Export the meshing to Asymptote code:
 * 7) Select the created mesh.
 * 8) On the toolbar press [[Image:Mesh_Export.svg|32px]] Export mesh... icon or follow the menu sequence:.
 * 9) In the lower part of the window that will appear, select the appropriate file type: Asymptote format (*.asy).
 * 10) Choose between leaving its default name or change it if you like, for example to AsymptoteFileName.asy.
 * 11) Ready, you have the Asymptote code with which you can generate, for example, a pdf file with the figure you selected in FreeCAD.



Generating a pdf file from the Asymptote code.

 * 1) (People using a LaTeX GUI should configure it appropriately for compiling Asymptote code or LaTeX documents containning Asymptote code.)
 * 2) The Asymptote compiler is called asy.
 * 3) You can compile the generated file directly using the command line:
 * 4) Or you can incorporate the code into a LaTeX document, say interactivePdf3D.tex by including the asymptote package in its preamble and then create an asymptote environment, where you can copy the generated Asymptote code or include the file AsymptoteFilename.asy: or
 * 5) Compile the files with the following command lines:
 * 6) At this point there will be a pdf-3D file: interactivePdf3D.pdf
 * 7) When reading it with Acrobat Reader, you will have the option of trusting the file once or always. If you agree to trust the file, after a click, you will be able to interact with the figure. You will be able rotate it, to pan it, as well as being able to zoom it in or out.

Related Pages

 * Import Export
 * FreeCAD_Howto_Import_Export

Video tutorials

 * A way of generating interactive pdf-3D files. (3/3) (From FreeCAD, Asymptote and LaTeX)
 * A way of generating interactive pdf-3D files. (2/3)(From Asymptote and LaTex)

Related video tutorial

 * A way of generating interactive pdf-3D files. (1/3)(From FreeCAD, MeshLab and LaTeX)