Mesh generationΒΆ

This notebook can be downloaded here.

For the following, the package has to be installed using pip install pyrigi[meshing].

from pyrigi import Graph, Framework

Method Framework.generate_stl_bars() allows one to generate simple bars of a framework that can be 3D printed.

We start by creating a Graph and a Framework.

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']})
F.plot()
../../_images/ea512400210dde9c48cc675416b928a1854372d63fac4c742f5d623cc84b5167.png

The method Framework.generate_stl_bars() generates bars in the working directory in STL format. The naming scheme consists of the prefix bar_ and the two indexes of the vertices of an edge.

Sometimes we wish to alter the design of the bars, especially scale them up or down, and change the file names or output directory (relative to working directory).

F.generate_stl_bars(scale=20, filename_prefix='scaled_bar_', output_dir='my_bars')
STL files for the bars have been generated in the chosen folder.

The other parameters that can be passed to the method Framework.generate_stl_bars() alter the design of the bars. The default values are:

  • width_of_bars = 8 mm

  • height_of_bars = 3 mm

  • holes_diameter = 4.3 mm

The 3D printed bars can be assembled as shown in the figure below. For the dimensions above, standard M4 screws and stop-nuts are suggested.

Assembled Framework