Repository: mne-tools/mne-python

Issue:
[DOC] Adding an example of a new way of fixing intersecting meshes in Blender
Hi, I found a way of nicely fixing intersecting meshes in Blender. I've created a figure to explain it and would like to add it to the [Editing BEM surfaces in Blender tutorial](https://mne.tools/stable/auto_tutorials/forward/80_fix_bem_in_blender.html). The solution is especially useful when you want the correction to follow the curvature of the outer surface (I've hower chosen to use a simpler case for the example).

Please let me know if it is clear enough.

The procedure is the following:
(1) Select the surface that is creating the problem. (2) In _Edit Mode_, press _C_ to use the circle selection tool to select the vertices that are outside.(3-5) In the _Object Data Properties_ tab use the _+_ button to add a _Vertex Group_ and click _Assign_ to assign the current selection to the group. (6-8) In the _Modifiers_ tab go to _Add Modifier_ add a _Shrinkwrap_ modifier and set it to snap _Inside_ with the outer surface as the _Target_ and the _Group_ that you created before as the _Vertex Group_. You can then use the _Offset_ parameter to adjust the distance. (9) In _Object Mode_ click on the downpointing arrow of the _Shrinkwrap_ modifier and click on _Apply_.



![example_fix_bem](https://user-images.githubusercontent.com/39155887/139230677-ffb0cf66-d13c-47c7-964b-dea2cd56d66c.jpg)


@wmvanvliet
@mkadwani  





Discussion:
really nice trick! Let's add it to the tutorial.
Very useful information! Thanks for sharing!

Manorama

On Thu, Oct 28, 2021, 7:09 AM Marijn van Vliet ***@***.***>
wrote:

> really nice trick! Let's add it to the tutorial.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/mne-tools/mne-python/issues/9912#issuecomment-953743233>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ANA5GLRDS3CTHT2HNBU4ADTUJE4PTANCNFSM5G4OYNZQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>


Resolving patch:
diff --git a/tutorials/forward/80_fix_bem_in_blender.py b/tutorials/forward/80_fix_bem_in_blender.py
--- a/tutorials/forward/80_fix_bem_in_blender.py
+++ b/tutorials/forward/80_fix_bem_in_blender.py
@@ -207,6 +207,28 @@
 # mne.write_head_bem(op.join(head_dir, 'sample-head.fif'), coords, faces,
 #                    overwrite=True)
 
+# %%
+# Blender editing tips
+# ~~~~~~~~~~~~~~~~~~~~
+#
+# A particularly useful operation is the *Shrinkwrap* functionality, that will
+# restrict one surface inside another surface (for example the Skull inside the
+# Outer Skin). Here is how to use it:
+#
+# (1) Select the surface that is creating the problem. (2) In *Edit Mode*,
+# press :kbd:`C` to use the circle selection tool to select the vertices that
+# are outside. (3-5) In the *Object Data Properties* tab use the ``+`` button
+# to add a *Vertex Group* and click *Assign* to assign the current selection to
+# the group. (6-8) In the *Modifiers* tab go to *Add Modifier* add a
+# *Shrinkwrap* modifier and set it to snap *Inside* with the outer surface as
+# the *Target* and the *Group* that you created before as the *Vertex Group*.
+# You can then use the *Offset* parameter to adjust the distance. (9) In
+# *Object Mode* click on the down-pointing arrow of the *Shrinkwrap* modifier
+# and click on *Apply*.
+#
+# .. image:: ../../_static/blender_import_obj/blender_import_obj4.jpg
+#    :alt: Shrinkwrap functionality in Blender
+
 # %%
 # That's it! You are ready to continue with your analysis pipeline (e.g.
 # running :func:`mne.make_bem_model`).


Test patch: