For the complete documentation index, see llms.txt. This page is also available as Markdown.

Materialization

The aim of this tutorial is to convert a RhinoVault session (a JSON file with a scene data structure) into solid geometry to facilitate the creation of simple physical models. This step is often used for teaching purposes when building models or small prototypes. The tutorial uses the Rhino ScriptEditor Python interface to extract data from a RhinoVault session file, attached below. Multiple mesh-based operations are then used to transform the geometry into solid blocks with shear keys and indices.

If you want to directly run all scripts of this page, you can download them from here:

archive · 75KB
Open

Rhino Script Editor and RhinoVault Session

Create a folder where you will store the rhinovault_session.json file as well as python example files. Then open Rhino Script Editor. Add a new python file named 000.pattern.py. Then run the code below that extracts the 2D mesh pattern from the session file.

The session file employs the compas.scene data structure for storing: Pattern, FormDiagram, ThrustDiagram, and ForceDiagram. It also stores general settings for drawing and thrust-network analysis. We will use two attributes: Pattern and ThrustDiagram for mesh transformation into solid blocks. The scene also helps to visualize COMPAS items (geometry & data structures).

The first three comments are specific to Python in Rhino, indicating: a) python3 specifies the language used, b) the code is written in the brg-csd environment, and c) compas_rv is a library requirement that must be installable from the Python Package Index (PyPI).

1. Mesh from Thrust Diagram

Let's create file called 001_thrust_diagram.py in the script editor. The thrust diagram's mesh attribute is used as the base mesh for materialization. We need to delete mesh faces with the attribute _is_loaded==False, marked in red. After deletion, we will split the list of boundary vertices by support vertices and store them in the borders attribute. We will also store support points in the supports attribute. Be aware that the script does not handle multiple boundaries, and you may need to make your own modifications for other cases if the mesh topology is different. Finally, the mesh is serialized into JSON file called 001_mesh.json.

2. Remesh

The thrust mesh is remeshed to achieve a uniform triangulated topology and obtain a 3-valence mesh for the dual. If we were to create a dual mesh from the original quad mesh, the result would be a quad mesh, which is unsuitable for our chosen fabrication method. Three-valence meshes are easier to assemble and may have fewer tolerance issues when multiple blocks meet at the same edge or corner. Originally the mesh was remeshed using CGAL library in Visual Studio Code, but for the purpose of demonstration we are using COMPAS remesh method in Rhino ScripEditor.

3. Dual

The dual is created from a triangular mesh. Note the boundary faces with an additional 2-valence boundary vertex. This vertex is removed in the next step to achieve cleaner polygonal blocks.

4. Dual Corners

To improve the structure of the dual mesh, a process is carried out to reconnect its corners. First, a KD tree is constructed to efficiently search for the nearest neighbors. Then, the closest vertices in the dual mesh to the supports of the original mesh are identified. These vertices are then adjusted to match the exact locations of the supports. Finally, the corresponding vertices are marked as "corners" to maintain structural integrity. This ensures a more stable and precise dual mesh.

5. Dual Simplification

This script processes a dual mesh by identifying and collapsing unnecessary 2-valent boundary edges. It iterates through the boundary vertices, checking if they have exactly two neighbors. If the angle between the two edges is close to 180°, the vertex is removed, merging the edges while ensuring that any "corner" attributes are preserved.

6. Dual Boundary Smoothing

This script performs boundary smoothing on a dual mesh. It begins by loading the original (001_mesh.json) and dual (005_mesh.json) meshes. It then identifies corner vertices and segments the boundary into separate borders. For each border, a NURBS curve is generated using interpolation to create a smoother boundary shape. The script then adjusts the positions of boundary vertices by snapping them to the closest points on their respective curves.

7. Dual Edge Collapse

This script performs edge collapse operations on a dual mesh to simplify its boundary. It identifies boundary edges that are not connected to corner vertices and checks if they belong to quadrilateral faces. If so, it selects pairs of opposite edges for collapse. The selected edges are collapsed, reducing the number of boundary edges while maintaining the mesh structure.

8. Dual Borders

This script processes the borders of a dual mesh by identifying and marking support edges. It detects corner vertices to segment the boundary into smaller borders. If a border has fewer than five vertices, its vertices and edges are marked as "supports." The identified support edges are visualized as green cylinders in the scene.

9. Dual Thickness Data

This script interpolates and assigns thickness values to a dual mesh using a grid-based method. It starts by loading the original (001_mesh.json) and dual (008_mesh.json) meshes. Key support points and midspan vertices are identified based on height, with predefined thickness values assigned to them. Using SciPy's griddata, thickness values are interpolated for all dual mesh vertices. The updated thickness values are stored in the mesh, and the result is visualized with red spheres representing the assigned thickness at each vertex.

10. Blocks

This script generates 3D block representations of a dual mesh by extruding its faces based on thickness values. It iterates through its faces to construct block geometries. For each face, vertex normals and thickness values are used to create bottom and top surfaces, with the top surface adjusted to fit a best-fit plane. The sides of the block are then generated to enclose the volume. Support attributes are assigned to relevant faces, and top and bottom frames are computed for each block. The blocks are visualized with color-coded support faces and frame markers.

11. Chamfer

This script applies chamfering to the edges of a dual mesh to refine its geometry. It iterates through internal vertices, identifying neighboring edges and checking their angles. If the angle between adjacent edges is below a set threshold (145°), a chamfering operation is applied using a cutting plane offset by 2 units. The modified blocks replace the original ones. The final result is visualized, displaying the adjusted blocks.

12. Shear Keys

This script modifies a dual mesh by adding spherical joinery at edge intersections between adjacent blocks. It first converts each face block into a Brep for more stable Boolean operations. Then, for each edge shared by two faces, it creates two spheres along the edge at 30% and 70% of its length. The first set of spheres (2.5 radius) is subtracted from one block, while a slightly smaller set (2.3 radius) is added to the other, forming a complementary joinery system. Finally, the updated blocks are visualized along with the dual mesh.

13. Index and Packing

This script generates 3D index labels for each block, displaying their positions directly in Rhino. Additionally, it packs the blocks into a grid layout, making them easier to visualize, organize, and manufacture. The result is a structured, fabrication-ready representation of the geometry. The joinery is regenerated in this script because serialization to a JSON file is not currently supported for BRep—only the STEP format allows it.

14. Scaffolding Mesh

This script demonstrates how to extract the bottom mesh using the mesh vertex thickness attribute. The extracted bottom mesh can then be used to generate scaffolding for assembling the structure.

Last updated