{ "cells": [ { "cell_type": "markdown", "id": "dfe4a8ad", "metadata": {}, "source": [ "# Any Mesh\n", "This module allow user to draw any custom geometry.\n", "\n", "The following example shows how to draw mesh using vertices and faces.\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "932b5173", "metadata": {}, "outputs": [], "source": [ "from weas_widget import WeasWidget\n", "viewer = WeasWidget()\n", "data = [\n", "{\n", " \"name\": \"tetrahedron\",\n", " \"color\": [0.0, 1.0, 0.0, 1.0],\n", " \"material\": \"Standard\",\n", " \"position\": [-5.0, 0.0, 0.0],\n", " \"vertices\": [0.0, 1.0, 0.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0],\n", " \"faces\": [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1, 1, 4, 3, 3, 2, 1],\n", " \"showEdges\": True,\n", "},\n", "{\n", " \"name\": \"cube\",\n", " \"color\": [1.0, 0.0, 0.0, 0.5],\n", " \"material\": \"Standard\",\n", " \"vertices\": [-3.0, -3.0, -3.0, -3.0, -3.0, 3.0, -3.0, 3.0, -3.0, -3.0, 3.0, 3.0, 3.0, -3.0, -3.0, 3.0, -3.0, 3.0, 3.0, 3.0, -3.0, 3.0, 3.0, 3.0],\n", " \"faces\": [0, 1, 2, 1, 3, 2, 4, 6, 5, 6, 7, 5, 4, 5, 0, 5, 1, 0, 6, 2, 7, 2, 3, 7, 0, 2, 4, 2, 6, 4, 1, 5, 3, 5, 7, 3],\n", " \"showEdges\": True,\n", "}\n", "]\n", "viewer.any_mesh.settings = data\n", "viewer" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }