# [Gmsh] Cutting a hole out of a surface with BooleanDifference

Matthew Herman m.w.herman at uu.nl
Wed Sep 19 16:43:35 CEST 2018

```Hello,

I am running Gmsh 4.0.1 and trying to use Boolean operators to subdivide
(potentially complex) surfaces.
As a simple test, I am cutting a circular hole through a surface. The
following .geo file produces exactly what I expect (a hole in a square,
planar surface):

Mesh.CharacteristicLengthMin = 0.1;
Mesh.CharacteristicLengthMax = 0.1;
Point(1) = {0,0,1};
Point(2) = {3,0,1};
Point(3) = {3,3,1};
Point(4) = {0,3,1};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(100) = {1,2,3,4};
Plane Surface(100) = {100};
Cylinder(200) = {1.5, 1.5, -2, 0, 0, 6, 0.5, 2*Pi};
BooleanDifference{Surface{100};Delete;}{Volume{200};Delete;}

In general, though, my surfaces are nonplanar, so I changed the coordinate
of Point(1) and Plane Surface -> Surface in the .geo file:

Mesh.CharacteristicLengthMin = 0.1;
Mesh.CharacteristicLengthMax = 0.1;
Point(1) = {0,0,1.2};
Point(2) = {3,0,1};
Point(3) = {3,3,1};
Point(4) = {0,3,1};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(100) = {1,2,3,4};
Surface(100) = {100};
Cylinder(200) = {1.5, 1.5, -2, 0, 0, 6, 0.5, 2*Pi};
BooleanDifference{Surface{100};Delete;}{Volume{200};Delete;}

When I make this change, the Boolean difference operator no longer cuts a
hole out of the curved surface. Gmsh also does not indicate any errors.
Can someone please explain what is causing this behavior? Thanks!

matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180919/93a2b56b/attachment.html>
```