|
| 1 | +{ |
| 2 | + "metadata": { |
| 3 | + "language_info": { |
| 4 | + "codemirror_mode": { |
| 5 | + "name": "ipython", |
| 6 | + "version": 3 |
| 7 | + }, |
| 8 | + "file_extension": ".py", |
| 9 | + "mimetype": "text/x-python", |
| 10 | + "name": "python", |
| 11 | + "nbconvert_exporter": "python", |
| 12 | + "pygments_lexer": "ipython3", |
| 13 | + "version": "3.8.5-final" |
| 14 | + }, |
| 15 | + "orig_nbformat": 2, |
| 16 | + "kernelspec": { |
| 17 | + "name": "python38564bit803274702961490c8f23f97c39496878", |
| 18 | + "display_name": "Python 3.8.5 64-bit" |
| 19 | + } |
| 20 | + }, |
| 21 | + "nbformat": 4, |
| 22 | + "nbformat_minor": 2, |
| 23 | + "cells": [ |
| 24 | + { |
| 25 | + "source": [ |
| 26 | + "# Simplicial surface remeshing of boundary representation\n", |
| 27 | + "\n", |
| 28 | + "The goal is to remesh a surface boundary representation as defined here: https://docs.geode-solutions.com/datamodel.\n", |
| 29 | + "The `Lines` and `Surfaces` will be remeshed according the input mesh sizes while keeping the topology (meaning the relationships between the model components) and the conformity (meaning the mesh element boundaries are geometrically identical) of the model.\n" |
| 30 | + ], |
| 31 | + "cell_type": "markdown", |
| 32 | + "metadata": {} |
| 33 | + }, |
| 34 | + { |
| 35 | + "source": [ |
| 36 | + "## Import modules\n", |
| 37 | + "\n", |
| 38 | + "You need to import OpenGeode and Geode-SimplexRemesh modules." |
| 39 | + ], |
| 40 | + "cell_type": "markdown", |
| 41 | + "metadata": {} |
| 42 | + }, |
| 43 | + { |
| 44 | + "cell_type": "code", |
| 45 | + "execution_count": null, |
| 46 | + "metadata": {}, |
| 47 | + "outputs": [], |
| 48 | + "source": [ |
| 49 | + "# Fix to better handle import since Python 3.8 on Windows\n", |
| 50 | + "import os, sys, platform\n", |
| 51 | + "if sys.version_info >= (3,8,0) and platform.system() == \"Windows\":\n", |
| 52 | + " for path in [x.strip() for x in os.environ['PATH'].split(';') if x]:\n", |
| 53 | + " os.add_dll_directory(path)\n", |
| 54 | + "\n", |
| 55 | + "import opengeode\n", |
| 56 | + "from geode_simplexremesh import surface # only the \"surface\" part of the package is needed" |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "source": [ |
| 61 | + "## Remeshing at constant mesh size\n", |
| 62 | + "\n", |
| 63 | + "In this section, we will see how to remesh a model using a constant mesh size." |
| 64 | + ], |
| 65 | + "cell_type": "markdown", |
| 66 | + "metadata": {} |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "code", |
| 70 | + "execution_count": null, |
| 71 | + "metadata": {}, |
| 72 | + "outputs": [], |
| 73 | + "source": [ |
| 74 | + "# Load a model and remesh it\n", |
| 75 | + "brep = opengeode.load_brep(\"brep_to_remesh.og_brep\")\n", |
| 76 | + "mesh_size = 42\n", |
| 77 | + "remeshed_brep, mappings = surface.homogeneous_brep_remeshing(brep, mesh_size) \n", |
| 78 | + "# the second return value \"mappings\" is for advanced usage and can be discarded\n", |
| 79 | + "opengeode.save_brep(remeshed_brep, \"remeshed_brep.og_brep\")" |
| 80 | + ] |
| 81 | + } |
| 82 | + ] |
| 83 | +} |
0 commit comments