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.

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:
 * In the document tree view, right-click the object you want to modify the colors.
 * In the dialog that appears, select: "Adjust colors".
 * Next, in the 3D view, one face at a time, click on the desired face and then, in the task penel, 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) The Asymptote compiler is called asy.
 * 2) You can compile the generated file directly using the command line:
 * 3) 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
 * 4) Compile the files with the following command lines:
 * 5) At this point there will be a pdf-3D file: interactivePdf3D.pdf
 * 6) 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 tutorial
[https://www.youtube.com/watch?v=PhVNvDZIerM A way of generating interactive pdf-3D files. (2/2)(From Asymptote and LaTex)]

Related video tutorial
[https://www.youtube.com/watch?v=U0m3643Vb1Q A way of generating interactive pdf-3D files. (1/2)(From FreeCAD, MeshLab and LaTeX)]