Skip to content

alessandro-zomparelli/mesh_sync

Repository files navigation

MeshSync

MeshSync is commincation system that can be used in order to connect tools like Blender and GH via .txt files containigin the mesh information. This is an early version and a lot of things can be improved. It was mainly developed for connecting Blender and Grasshopper in order to take advantages fo the best qualities of both softwares, but feel free to report different uses of it for other tools that allow you to read or write information using .txt files.

Blender

After installing the python file mes_sync.py, MeshSync will appear in the Object Data panel, if a Mesh Object is selected.

Exporting

Synchronize mesh object exporting or importing data as txt files. Chose a folder and a prefix name (eg. "//MyMesh_") and manually pres "Export".

Blender Export

According to the chosen settings the following files can be created:

myMesh_vertices.txt - Containing the informations about Vertices (eg. "0.0, 0.0, 0.0")

myMesh_edges.txt - Containing the informations about Edges (eg. "1 2")

myMesh_faces.txt - Containing the informations about Faces (eg. "1 2 3 4")

Additionally other files can be generated:

myMesh_weight.txt - Containing on each line (for each Vertex) one value for each Vertex Group. (eg. "0.25 0.75")

myMesh_verts_neighbors.txt - Indexes of neighbors vertices (eg. "0 1 2 3")

myMesh_face_neighbors.txt - Indexes of neighbors faces (eg. "0 1 2 3")

Importing

While importing a mesh the only mandatory file is a Vertices file, all the other are mandatory. Neighbors are not used while importing inside Blender.

Blender Import

Grasshopper

You can find the .ghpy files and copy in the Grasshopper's Libraries folder.

GH Components

Export

Check the GH examples for exporting. The process is quite straightforward, plug a mesh, a destination folder and a Boolean Button for export the mesh data. It will automatically create the Vertices and Faces files.

Optionally, some values from 0 to 1 can be exported as well as Weight file. Make sure that the number of vertices and values match.

GH Export

Import

While importing three different components can be used, according to how much informations you want to import. The Advanced component allow to read all possible data.

GH Import