[Gmsh] Boolean operations with stl files (OpenCASCADE - Gmsh )

Nicolás Biocca biocca.nicolas at gmail.com
Mon Feb 4 21:05:01 CET 2019


did you try without OpenCASCADE kernel or it's madatory using it? The below
lines should do the trick.

*Merge "Box.stl" ;    *
*Physical Surface("Box") = {1};*

*Merge "Sphere.stl";*
*Physical Surface("Sphere") = {2};*


*Surface Loop(1) = {1};  // Box surface*

*Surface Loop(2) = {2};  // Sphere surface*


*Volume(1) = {1,2};*

*Physical Volume("Volume") = {1};*

Best regards
Nicolás Biocca

On Mon, Feb 4, 2019 at 4:00 PM Christophe Geuzaine <cgeuzaine at uliege.be>
wrote:

>
> An STL is a just a mesh - so no, there are no boolean operations available.
>
> CG
>
> > On 4 Feb 2019, at 17:47, Octavio Castillo Reyes <
> ocastilloreyes at gmail.com> wrote:
> >
> > Dear gmsh team,
> >
> > I am trying to create meshes with topography (including bathymetry and
> other complex embedding bodies). I have made several experiments:
> >
> > * Boolean operations with meshes (not supported by gmsh)
> > * Create flat surfaces and then interpolate them to a given topography
> (works well but is only valid for a physical material/group).
> >
> > The above led me to try the OpenCASCADE kernel. I am learning to use it
> and I have modified one of its examples:
> >
> >          SetFactory("OpenCASCADE");
> >          Mesh.CharacteristicLengthMin = 0.5;
> >          Mesh.CharacteristicLengthMax = 0.2;
> >          Box(1) = {0, -1, -1, 2, 2, 2};
> >          Sphere(2) = {0, 0, 0, 1.};
> >          BooleanDifference(3) = { Volume{1}; Delete; }{ Volume{2};
> Delete; };
> >
> > However, my input topography is given as a STL file. Therefore,I would
> like to know if it is possible to carry out operations such as the
> following:
> >
> >          SetFactory("OpenCASCADE");
> >          Merge "Box.stl" ;        // Volume 1
> >          Merge "Sphere.stl";     // Volume 2
> >          Mesh.CharacteristicLengthMin = 0.5;
> >          Mesh.CharacteristicLengthMax = 0.2;
> >          BooleanDifference(3) = { Volume{1}; Delete; }{ Volume{2};
> Delete; };
> >
> > Or something like:
> >
> >         SetFactory("OpenCASCADE");
> >          Merge "Volume_Topo.stl" ;         // Volume 1
> >          Merge "Volume_No_Topo.stl";     // Volume 2
> >          Mesh.CharacteristicLengthMin = 0.5;
> >          Mesh.CharacteristicLengthMax = 0.2;
> >          BooleanDifference(3) = { Volume{1}; Delete; }{ Volume{2};
> Delete; };
> >
> > Is it possible to import STL files and perform boolean operations? How
> to define a volume from Boolean operations between two STL files
> (previously created)? Actually, the gmsh error is the following:
> >
> > Unknown OpenCASCADE entity of dimension 3 with tag 1
> > .... Could not apply boolean operator
> >
> > I am very interested in knowing about the best strategy to perform this
> task. Unfortunately, until now it has not been clear to me how to solve my
> problem.
> >
> > Thank you for your time and support
> >
> > Best regards!
> >
> > _______________________________________________
> > gmsh mailing list
> > gmsh at onelab.info
> > http://onelab.info/mailman/listinfo/gmsh
>
>> Prof. Christophe Geuzaine
> University of Liege, Electrical Engineering and Computer Science
> http://www.montefiore.ulg.ac.be/~geuzaine
>
>
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190204/81d4ffbe/attachment-0001.html>


More information about the gmsh mailing list