Export

This module provides exports for frameworks.

pyrigi.framework._export.export.generate_stl_bars(framework, scale=1.0, width_of_bars=8.0, height_of_bars=3.0, holes_diameter=4.3, filename_prefix='bar_', output_dir='stl_output')[source]

Generate STL files for the bars of the framework.

The STL files are generated in the working folder. The naming convention for the files is bar_i-j.stl, where i and j are the vertices of an edge.

Parameters:
  • framework (FrameworkBase)

  • scale (float) – Scale factor for the lengths of the edges, default is 1.0.

  • width_of_bars (float) – Width of the bars, default is 8.0 mm.

  • height_of_bars (float) – Height of the bars, default is 3.0 mm.

  • holes_diameter (float) – Diameter of the holes at the ends of the bars, default is 4.3 mm.

  • filename_prefix (str) – Prefix for the filenames of the generated STL files, default is bar_.

  • output_dir (str) – Name or path of the folder where the STL files are saved, default is stl_output. Relative to the working directory.

Return type:

None

Examples

>>> G = Graph([(0,1), (1,2), (2,3), (0,3)])
>>> F = Framework(G, {0:[0,0], 1:[1,0], 2:[1,'1/2 * sqrt(5)'], 3:[1/2,'4/3']})
>>> generate_stl_bars(F, scale=20)
STL files for the bars have been generated in the folder `stl_output`.
pyrigi.framework._export.export.to_tikz(framework, vertex_style='fvertex', edge_style='edge', label_style='labelsty', figure_opts='', vertex_in_labels=False, vertex_out_labels=False, default_styles=True)[source]

Create a TikZ code for the framework.

The framework must have dimension 2. For using it in LaTeX you need to use the tikz package. For more examples on formatting options, see also Graph.to_tikz().

Parameters:
  • framework (FrameworkBase)

  • vertex_style (str | dict[str, Sequence[Vertex]]) – If a single style is given as a string, then all vertices get this style. If a dictionary from styles to a list of vertices is given, vertices are put in style accordingly. The vertices missing in the dictionary do not get a style.

  • edge_style (str | dict[str, Sequence[Edge]]) – If a single style is given as a string, then all edges get this style. If a dictionary from styles to a list of edges is given, edges are put in style accordingly. The edges missing in the dictionary do not get a style.

  • label_style (str) – The style for labels that are placed next to vertices.

  • figure_opts (str) – Options for the tikzpicture environment.

  • vertex_in_labels (bool) – A bool on whether vertex names should be put as labels on the vertices.

  • vertex_out_labels (bool) – A bool on whether vertex names should be put next to vertices.

  • default_styles (bool) – A bool on whether default style definitions should be put to the options.

Return type:

str

Examples

>>> G = Graph([(0, 1), (1, 2), (2, 3), (0, 3)])
>>> F = Framework(G,{0: [0, 0], 1: [1, 0], 2: [1, 1], 3: [0, 1]})
>>> print(to_tikz(F))
\begin{tikzpicture}[fvertex/.style={circle,inner sep=0pt,minimum size=3pt,fill=white,draw=black,double=white,double distance=0.25pt,outer sep=1pt},edge/.style={line width=1.5pt,black!60!white}]
    \node[fvertex] (0) at (0, 0) {};
    \node[fvertex] (1) at (1, 0) {};
    \node[fvertex] (2) at (1, 1) {};
    \node[fvertex] (3) at (0, 1) {};
    \draw[edge] (0) to (1) (0) to (3) (1) to (2) (2) to (3);
\end{tikzpicture}
>>> print(to_tikz(F, vertex_in_labels=True))
\begin{tikzpicture}[fvertex/.style={circle,inner sep=1pt,minimum size=3pt,fill=white,draw=black,double=white,double distance=0.25pt,outer sep=1pt,font=\scriptsize},edge/.style={line width=1.5pt,black!60!white}]
    \node[fvertex] (0) at (0, 0) {$0$};
    \node[fvertex] (1) at (1, 0) {$1$};
    \node[fvertex] (2) at (1, 1) {$2$};
    \node[fvertex] (3) at (0, 1) {$3$};
    \draw[edge] (0) to (1) (0) to (3) (1) to (2) (2) to (3);
\end{tikzpicture}