{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import meshutil\n", "import stl.mesh\n", "import numpy" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "c = meshutil.cube(open_xz=False)\n", "mesh_fname = \"cube_test.stl\"\n", "c2 = meshutil.cube_distort(0.3)\n", "c2.v = c2.v/2 + [0,1,0]\n", "c = c.concat(c2)\n", "m = c.to_stl_mesh()\n", "\"\"\"\n", "c1 = meshutil.cube_distort(0.3)\n", "c1[\"vectors\"] = c1[\"vectors\"]/2 + [0,1,0]\n", "c2 = meshutil.cube_distort(0.3)\n", "c2[\"vectors\"] = c2[\"vectors\"]/2 + [0.5,1,0]\n", "c3 = meshutil.cube_distort(0.3)\n", "c3[\"vectors\"] = c3[\"vectors\"]/2 + [0,1,0.5]\n", "c4 = meshutil.cube_distort(0.3)\n", "c4[\"vectors\"] = c4[\"vectors\"]/2 + [0.5,1,0.5]\n", "\"\"\"\n", "m.save(mesh_fname)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#d = numpy.concatenate([c,c1,c2,c3,c4])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import trimesh" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "face_normals didn't match triangles, ignoring!\n", "/home/hodapp/.local/lib/python3.6/site-packages/IPython/core/display.py:694: UserWarning: Consider using IPython.display.IFrame instead\n", " warnings.warn(\"Consider using IPython.display.IFrame instead\")\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = trimesh.load_mesh(mesh_fname)\n", "m.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 4 }