Examples
Export "monkey" from Blender
This is a short description of the file 02_blender_monkey_script.py
in the ITA21 repo.
Blender has a sample mesh that is quite useful for testing scripts. It is the head of a monkey, called "Suzanne" (don't ask me why). With the script below, we
create the monkey mesh as a
bmesh
and then convert it to a mesh data block,extract the vertices and faces of the mesh,
make a COMPAS mesh from the extracted vertices and faces,
(optional) subdivide the COMPAS mesh,
(optional) visualize the COMPAS mesh with an artist, and
export the COMPAS mesh to a JSON file.
The result of this script should be something like this.
Add a box and visualize with View2
This is a short description of the file 03_view2_box-the-monkey.py
in the ITA21 repo.
The exported monkey mesh can now be opened in any other environment for visualization or further processing. The script below can be executed in VS Code. The code has the following steps.
load the mesh data from the JSON file
(optional) subdivide the mesh
compute the bounding box and add as a geometric shape
(optional) visualize with the viewer
export the mesh and the box to a new JSON file
The result should be something like this.
Last updated