Asymptote: Difference between revisions
mNo edit summary |
(Part_ColorPerFace) |
||
(27 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
|||
{{Page in progress}} |
|||
<translate> |
|||
</translate> |
|||
{{TOCright}} |
{{TOCright}} |
||
<translate> |
|||
==Description== |
==Description== <!--T:13--> |
||
<!--T:14--> |
|||
[https://asymptote.sourceforge.io/ Asymptote] is a programming language for the creation of 2D and 3D computer graphics. Asymptote code can be included in a LaTeX document or used to generate PostScript, PDF, SVG, WebGL, and PRC files. |
|||
[https://asymptote.sourceforge.io/ Asymptote] is a vector language for 2D and 3D computer graphics. Asymptote code can be included in [https://www.latex-project.org/ LaTeX] documents or used to generate [https://en.wikipedia.org/wiki/PostScript PostScript], [[PDF|PDF]], [[SVG|SVG]], [https://www.khronos.org/webgl/ WebGL], and [https://en.wikipedia.org/wiki/PRC_(file_format) PRC] files. Interactive 3D PDF files created from Asymptote code require Acrobat Reader version 9 or higher. |
|||
Interactive 3D PDF files created from [https://asymptote.sourceforge.io/ Asymptote] code require Acrobat Reader version 9 or higher. For other PDF files any PDF reader can be used. |
|||
<!--T:15--> |
|||
Asymptote support was added in FreeCAD version 0.19. |
Asymptote support was added in FreeCAD version 0.19. |
||
==Exporting== |
==Exporting== <!--T:16--> |
||
<!--T:17--> |
|||
To generate Asymptote code do the following: |
|||
# Optionally assign colors to the faces of the object you want to export with the [[Image: |
# Optionally assign colors to the faces of the object you want to export with the [[Image:Part_ColorPerFace.svg|24px]] [[Part_ColorPerFace|Part ColorPerFace]] command. |
||
# Change to the [[Image:Workbench_Mesh.svg| |
# Change to the [[Image:Workbench_Mesh.svg|24px]] [[Mesh Workbench|Mesh Workbench]]. |
||
# Create a mesh from the object with the [[Image:Mesh_FromPartShape.svg| |
# Create a mesh from the object with the [[Image:Mesh_FromPartShape.svg|24px]] [[Mesh_FromPartShape|Mesh FromPartShape]] command. |
||
# Select the new mesh object. |
# Select the new mesh object. |
||
# Invoke the [[Image:Mesh_Export.svg| |
# Invoke the [[Image:Mesh_Export.svg|24px]] [[Mesh_Export|Mesh Export]] command. |
||
# Select the {{FileName|*.asy}} file format in the dialog box. |
# Select the {{FileName|*.asy}} file format in the dialog box. |
||
# Enter a filename. |
# Enter a filename. |
||
# Press the {{Button|Save}} button. |
# Press the {{Button|Save}} button. |
||
==Converting== <!--T:18--> |
|||
==Generating a PDF file from Asymptote code== |
|||
<!--T:19--> |
|||
In order to get a pdf-3d file using this method, some packages must or are recommended to be installed on your system: |
|||
You need the [https://sourceforge.net/projects/asymptote/ Asymptote compiler] to convert {{FileName|*.asy}} files. To convert to PDF a [https://www.latex-project.org/get/ LaTeX] system is also required. |
|||
*Needed if you want to embed the interactive figure into a document: A LaTeX system, for example [https://www.tug.org/texlive/ TeX Live] |
|||
**Very useful: An Integrated LaTeX Editing Environment, for example [https://kile.sourceforge.io/ Kile] or [https://www.texstudio.org/ TeXstudio] |
|||
<!--T:20--> |
|||
The compiler is a command line tool. To covert to PDF you can use this syntax: |
|||
⚫ | |||
==Related== <!--T:21--> |
|||
# (People using a LaTeX GUI should configure it appropriately for compiling Asymptote code or LaTeX documents containning Asymptote code.) |
|||
# The Asymptote compiler is called asy. |
|||
# You can compile the generated file directly using the command line: {{Code|code= |
|||
⚫ | |||
# 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:{{Code|code= |
|||
<!--T:22--> |
|||
\documentclass[a4paper,10pt]{article} |
|||
⚫ | |||
... |
|||
\usepackage{asymptote} |
|||
... |
|||
\begin{document} |
|||
... |
|||
\begin{asy} |
|||
Asymptote Code goes here |
|||
\end{asy} |
|||
... |
|||
\end{document} |
|||
}} or {{Code|code= |
|||
⚫ | |||
\documentclass[a4paper,10pt]{article} |
|||
... |
|||
\usepackage{asymptote} |
|||
... |
|||
\begin{document} |
|||
... |
|||
\begin{asy} |
|||
include "AsymptoteFileName.asy"; |
|||
\end{asy} |
|||
... |
|||
\end{document} |
|||
}} |
|||
# Compile the files with the following command lines: {{Code|code= |
|||
$ pdflatex interactivePdf3D.tex |
|||
$ asy interactivePdf3D-*.asy |
|||
$ pdflatex interactivePdf3D.tex |
|||
}} |
|||
# At this point there will be a pdf-3D file: interactivePdf3D.pdf |
|||
# 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. |
|||
<!--T:24--> |
|||
== Related Pages == |
|||
The following videos are in Spanish: |
|||
⚫ | |||
⚫ | |||
⚫ | |||
* [[FreeCAD_Howto_Import_Export]] |
|||
⚫ | |||
* [https://www.youtube.com/watch?v=Q_ufaCN2hb4 A way of generating interactive pdf-3D files. (3/3) (From FreeCAD, Asymptote and LaTeX)] |
* [https://www.youtube.com/watch?v=Q_ufaCN2hb4 A way of generating interactive pdf-3D files. (3/3) (From FreeCAD, Asymptote and LaTeX)] |
||
⚫ | |||
== Related video tutorial == |
|||
⚫ | |||
== Related tutorials == |
|||
</translate> |
|||
{{Mesh Tools navi{{#translation:}}}} |
{{Mesh Tools navi{{#translation:}}}} |
||
{{Userdocnavi{{#translation:}}}} |
{{Userdocnavi{{#translation:}}}} |
Latest revision as of 18:20, 13 April 2024
Description
Asymptote is a vector language for 2D and 3D computer graphics. Asymptote code can be included in LaTeX documents or used to generate PostScript, PDF, SVG, WebGL, and PRC files. Interactive 3D PDF files created from Asymptote code require Acrobat Reader version 9 or higher.
Asymptote support was added in FreeCAD version 0.19.
Exporting
- Optionally assign colors to the faces of the object you want to export with the Part ColorPerFace command.
- Change to the Mesh Workbench.
- Create a mesh from the object with the Mesh FromPartShape command.
- Select the new mesh object.
- Invoke the Mesh Export command.
- Select the *.asy file format in the dialog box.
- Enter a filename.
- Press the Save button.
Converting
You need the Asymptote compiler to convert *.asy files. To convert to PDF a LaTeX system is also required.
The compiler is a command line tool. To covert to PDF you can use this syntax:
PathToAsyExecutable/asy -f pdf AsymptoteFileName.asy
Related
Video tutorials
The following videos are in Spanish:
- A way of generating interactive pdf-3D files. (1/3) (From FreeCAD, MeshLab and LaTeX)
- A way of generating interactive pdf-3D files. (2/3) (From Asymptote and LaTex)
- A way of generating interactive pdf-3D files. (3/3) (From FreeCAD, Asymptote and LaTeX)
Mesh
- Miscellaneous: Import mesh, Export mesh, Create mesh from shape, Regular solid, Unwrap Mesh, Unwrap Face
- Modifying: Harmonize normals, Flip normals, Fill holes, Close hole, Add triangle, Remove components, Remove components by hand, Smooth, Refinement, Decimation, Scale
- Boolean: Union, Intersection, Difference
- Cutting: Cut mesh, Trim mesh, Trim mesh with a plane, Create section from mesh and plane, Cross-sections
- Components and segments: Merge, Split by components, Create mesh segments, Create mesh segments from best-fit surfaces
User documentation
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub