MeshKit
Create a finite element or finite volume mesh directly from SketchUp! Add multiple regions, volumes, boundaries and refinement.
MeshKit

MeshKit lets you create models in SketchUp and mesh with a number of quality mesh generators, including:

  • Gmsh
  • Netgen
  • TetGen
  • FRGEN3D
  • SnappyHexMesh for OpenFOAM (under development - coming soon in version 4.x)
  • FoamyHexMesh for OpenFOAM (under development - coming soon in version 4.x)

Create meshes directly from SketchUp suitable for use with finite element, finite volume, or other analysis methods. This makes performing CFD calculations on SketchUp models extremely simple and efficient.

This tool provides a way to very quickly setup models for analysis with any number of numerical methods. I often use MeshKit with the excellent, free and opensource multiphysics package, OpenFOAM, but it also works great with Fluent, Ansys, LS-DYNA, CFX, Star-CCM+, Elmer Multiphysics and others.

 

Video Tutorials and Example Files

Tutorial 1: How to Mesh a Cylinder

How to mesh a cylinder (including, setting boundaries, element sizes) with SketchUp/MeshKit/Gmsh. It should be pretty easy to follow. Links to the geometry from the tutorial (the SketchUp file, the Gmsh file, and the TetGen files):

Tutorial 2: How to Create and Run a CFD Wind Tunnel with SketchUp, Gmsh and OpenFOAM

This tutorial coveres how to use Meshkit, Gmsh, and OpenFOAM to create a simple CFD wind tunnel. Creating geometry, marking boundaries, mesh size and refinement, and running with OpenFOAM are covered. 

Features, Mesh Generators, and Downloads

  • NEW in v3.0+ support for Gmsh, Netgen, Tetgen and FRGEN3D added. 
  • NEW in v3.0+ complex CAD entities like Arcs and Splines are supported.
  • NEW in v3.0+ generate tri, quad, tet and hex meshes with Gmsh.
  • NEW in v3.0+ automatically mesh directly in SketchUp with the QuickMesh tool. 
  • The Mark Regions dialog allows you to mark a group as a region and define the desired mesh refinement level.
  • The Mark Volumes dialog allows you to set a group to be a volume (hole). You can set boundaries on this volume. 
  • The Mark Boundaries tool allows you to assign a boundary number to selected faces. If you have a group selected, then all faces in that group will be assigned that boundary number. Each unique boundary name/number is assigned a randomly generated color. The default boundary number is 0, and any unassigned boundaries will be assigned this number. This is a convenenent way to remove/ignore internal boundaries that you do not want to appear in the final mesh. In general, you should assign any boundary that you with to work with a non-zero integer. You can add boundary refinement to create local refinement. This results in a very nicely refined and graded mesh.
  • The Boundary Info tool simply lists the boundary name assigned to each selected face, or group of faces. The assigned refinement value is also listed.
  • The Save Selected Groups to Smesh tool generates the smesh file from the selected groups. All entities must be in groups, and the groups should be only 1 level deep (ie, not groups of groups, at least for now).
  • Import your mesh in to SketchUp with the option to keep or remove boundary information. 

Note: At present, MeshKit works exclusively with "Groups" - support for "Components" may be added later. 

Information, downloads, installation, and source code related to TetGen can be found here: http://www.tetgen.org

Gmsh can be found here: http://geuz.org/gmsh

Frgen3d information can be found here: http://www.appliedsimulations.com/tools/mesh_over.htm

Netgen can be found here: http://sourceforge.net/projects/netgen-mesher

OpenFOAM information can be found here: http://www.openfoam.org

Elmer Multiphysics information can be found here: https://csc.fi/web/elmer

 

Release Notes - Version 3.3.0 (Current)

Several bug fixes, additional features and improvements, particularly for Gmsh. OpenFOAM STL export format suitable for mesh generation with snappyHexMesh (i.e. named patches are retained).

Release Notes - Version 3.2.0 (Released 27-July-2016)

Added support for 2D meshing (can specify edge/line names for Gmsh). Massively improved support for multi-material/multi-region meshes. Some bug fixes. Scoped tools (only relavent options are shown for a target mesher; target mesher is selected in the config window). All in all, lots of improvements.  

 

Release Notes - Version 3.0.4 (Released 4-Feb-2016)

 Some minor bug fixes for the Windows platform. Improved speed of mesh import/export. 

Release Notes - Version 3.0.1 (Released 20-Nov-2015)

 Some minor bug fixes for tetgen region and volume attributes. 

Release Notes - Version 3.0.0 (Released 13-Nov-2015)

This is a major upgrade. MeshKit now supports export to four mesh generators: Gmsh, Tetgen, Netgen, and FRGEN3D. MeshKit also supports export of all the complex CAD entities that SketchUp supports (like Arcs and Splines) making it one of the most powerful and certainly one of the most easy-to-use preprocessors in existence. 

Thanks for your continued support!

Release Notes - Version 2.1.0 (Released 12-Sept-2015)

We're releasing version 2.1.0 with some substantial speed improvements. In the past, complicated models took quite a while to export. This is no longer the case - even complicated/detailed models export quickly in a matter of seconds.

Thank you sincerely for your support!

Release Notes - Version 2.0.0 (Released 8-July-2015)

We're releasing version 2.0 with some new features. Quite a few users were asking for a way to import meshes back in to SketchUp - now you can!

We're also releasing version 2.0 with different license (free trial/paid use). This is because, well, writing, updating and maintaining code takes tons of time!  But, not to worry, we're only asking for less than ten USD! This will allow us to continue to develop new features and support an ever growing community. 

Thank you sincerely for your support!

Release Notes - Version 1.1.0 (Released 8-Jun-2015)

We're rebranding Sketchy Tetgen Tools as MeshKit/MeshKit Pro. 

Why?  Well, first of all STT was developed and released quite simply because I needed a way to quickly prototype and simulate concepts directly from SketchUp, and I thought it might be useful to all of you. With 600+ users worldwide, I think it's safe to say that it has provided some utility. 

Second, TetGen is fantastic, but we'd like to support more platforms in the future, hence the name change. We hope to have the 2.0 release out soon, and with a ton of new, useful features! Thanks for your support!

Release Notes - Version 1.1.0 (Released 31-Jan-2015)

Version 1.1.0 contains a number of improvements and fixes, the most important of which are listed below.

Support for boundary based refinement.

Added support for face/boundary based refinement. A mtr file will be generated which contains specified refinement options. Refinement is specified as the desired element length along the boundary, and is scaled linearly through the volume. The result is a nicely graded mesh.  To use this option with tetgen, include the -m flag, for example:

$ tetgen -pqAm example.smesh

If the generated example.mtr file is in the same directory, it will be used to generate a mesh with the specified refinement. Note, do not use the -a and the -m flags together (you can, but just be sure you know what you are doing or you may end up with a very large mesh indeed). The -a flag specifies a minimum refinement level in a given volume, and the -m flag at the boundary.

Bux fixes

Fixed a bug where the region point was not converted to the correct units. Units: "m", "mm", "cm", "in", "ft" are supported.

 

Improvements

Much faster when performing node merging operations.

Future

The next release will likely include some significant speed improvements. The motivation behind the 1.x release is to add functionality quickly and fix any major bugs. The 2.x series will focus on improving/refactoring the code base and implementing some targeted speed improvements. The 2.x series will also add significant functionality, as well as support for multiple mesh generation formats. 

Thanks for your support!

Reviews

Laksana G.'s picture

Hi Peter,

I just installed the current verison (3.3.0) on SketchUp Make 2017. I tried to follow your tutorial on Youtube, but it seems the dialogs are different compared to that you used in the video. For example, there is no 'name' and 'compound' column in 'Boundary number and refinement' column. Also, when I click on 'set as volume (hole)' no dialog appeared.

Is that because there are compatibility issues with my system...?

Thanks
Laksana

Peter V's picture

Hi Laksana,
Yes, you're absolutely right - the video shows an earlier version of the plugin (I need to make a new one, I know!).
In general, you select the target mesh generator (tetgen, netgen, gmsh, etc.) in the config dialog (the last one on the tool bar), and the options for all the other tools are changed so that only the relevant ones are shown. So in your case, it might be that a target mesh generator doesn't need/support numbering for volumes/voids.

I'd suggest making sure that gmsh or tetgen is selected in the config (last button) and start with those.

I'm not aware of any compatibility issues with Sketchup 2017 (I use both v2016 and v2017 daily) and the MeshKit extension - the extension is tested on Windows and Mac.

I hope this helps!
Peter

Till G's picture

Hi is ther any chance for the hexmesh soon?
thumbs up

Peter V's picture

Hi Till!
Yes, I know I've been promising this for a while, and it really is coming!! Sorry for the delay - I'll let you know as soon as it gets deployed!
Kind regards,
Peter

Hello Peter,

I'm an architect and have a civil engineering dissertation topic I'm currently working on and I need to set up a wind-tunnel CFD model– very basic. I downloaded the Meshkit for Sketchup,
which looks to be straightforward but I have a few questions. I'm running SketchUp Pro 2017:

What do I need besides the Meshkit to perform a basic wind-tunnel tests? A
specific program?

I saw the tutorial on setting up a basic wind-tunnel: https://www.
youtube.com/watch?v=YL6hP90cT_Y

Now, the first part was straight-forward but then it got into terminal
technics and that is way over my head.. is that needed?

My buttress concept is a trapezoid as opposed to a rectangle in cross-section, I need to alter the geometry here and there to optimize wind flow, and hence link that to precipitation and staining on stone optimizing the angles, shape, etc.

Assistance would be very much appreciated, and if you could do a "shared-screen-scenario" to assist please let me know!

Thank You!

Nick

nickcodyfab@gmail.com

Christopher N's picture

Hi Nick,

I'm just a user who's been using MeshKit for a while now. If you want to run a CFD simulation, then you will most likely need to download and install OpenFOAM. Does the physical problem that you want to model just involve flow of a fairly low-speed gas like air? Low-speed being less than say 100mph?

Dear Christopher,

May be you could clear for me some information:
1) Is Meshkit a cost-free plugin? Because I do not have a "purchase" button, just "Download".
2) I installed the plugin available under this "Download" button into trial version of Sketchup Pro 2017.
The buttons "Mark as region/Solid and Set Properties", "Mark as Void/Volume", "Quickmesh" seem not to make any effect.
However, "Set boundary Properties" and "Export" work. But in the output files I do not have the boundary properties.
So, the question is: "What could go wrong?"

Thank you!

Christopher N's picture

Hi Vanja,

This is a free plugin. Have you watched the video tutorials that are linked to at the top of the page? These should clarify the process of marking boundaries and exporting surface mesh data.

Hi Christopher,

Thank you for your reply!
I watched the video tutorials, some buttons did not produce any effect, that is why I asked the questions. I could only "Set boundary properties" (numbering the surfaces) and export files. But the exported .stl file did not have those surfaces separated, the file contained only 1 surface of the whole geometry.
It seems I do something wrong. Will try to reinstall the program.

Christopher,

I greatly appreciate the assistance. I will download OpenFOAM. It works on Mac OS X I presume... I simply want to model airflow, yes, and then I will link it to precipitation in regards to vortices. My issue is in the tutorial I saw on this site, is that the first half was clear, but then the second half was coding, of which, I'm a luddite... Indeed, it would be less than 100mph and I would model it flowing against a rectangular cross-section, and then a trapezoidal one, comparing velocities, pressures, etc..

Thanks so much, and feel free to contact me via email if you wish.

Regards,

Nick Fabrikant www.fabrikant.co

Till G's picture

Hi Peter,
Is there any chance for the hexmesh soon?
regards

Fernando C.'s picture

Dear Peter,

Are you planning to release a version of your plugin compatible with SketchUp 2017?

Thanks,

Fernando

Peter V's picture

Hi Fernando,
It works with 2017. There is an issue (which will be patched in the next release, and there is an easy workaround) with the QuickMesh tool, but other than that it should be 100% functional with Sketchup 2017 (I'm using it right now).
Kind regards,
Peter

Michał P's picture

Hmm, I think I'm doing everything according to the video but the mesh doesn't create at all. Maybe there's some common mistake people do using this plugin?
I run SU 2016.

Tim B's picture

TimB
yes i am having the same problem. I am using it on SU2016. I can get to the point where you click on quick mesh. Nothing happens - no mesh appears??

Peter V's picture

Hi Tim,
Thanks for bringing this up. There will be a patch forthcoming - sorry for any inconvenience! In the meantime, I can suggest a workaround:

1) Export your mesh in Gmsh (or whichever mesh generator you want to use) format.
2) Mesh as normal in the mesh generator, and save the output in "Medit" (.mesh) format.
3) Use the MeshKit import button to load the mesh in to SketchUp.

The QuickMesh tool simply automates this process anyway :-)

Please let me know if this helps, and I'll let everyone know when the next update is released!

Kind regards,
Peter

Michał P's picture

Exactly.

Peter V's picture

Hi Michal,
Thanks for bringing this up. There will be a patch forthcoming - sorry for any inconvenience! In the meantime, I can suggest a workaround:

1) Export your mesh in Gmsh (or whichever mesh generator you want to use) format.
2) Mesh as normal in the mesh generator, and save the output in "Medit" (.mesh) format.
3) Use the MeshKit import button to load the mesh in to SketchUp.

The QuickMesh tool simply automates this process anyway :-)

Please let me know if this helps, and I'll let everyone know when the next update is released!

Kind regards,
Peter

Andrew W.'s picture

This is a really promising plugin -

Are there any future plans to be able to set up an entire openfoam case from within this plugin? This would be an awesome addition.

Thanks for the development and making it available.

Peter V's picture

Hi Andrew,
Yes, definitely!
Full support for OpenFOAM (at least for mesh generation and boundary condition specification) is under development. You can use the "OpenFOAM-STL" export option in the current version to create snappyHexMesh compatible STL files, but the upcoming release should have support to automatically generate snappyHexMeshDict (input) files with region and surface refinement options specified directly in SketchUp.
Thank you again for using the plugin and for sending feedback - very much appreciated!
Kind regards,
Peter

Philippe N.'s picture

Hi Peter

Maybe more a thing on the wishlist or to keep track of...

In my daily work I need to handle volumes within a volume which in a later stage are extracted. So in meshkit terms it is not a void/volume it is just a volume/volume. The volumes share surfaces - the inner surface of the overall volume is the outer surface/shell of the inner volume. As both volumes need to be defined and subsequently the surfaces for both volumes need to be selectable I always run into the problem that as soon as one volume is grouped it surfaces are not available anymore for use in meshkit. Hence the surface, e.g. of the inner volume, needs to be redrawn or copied moved avay and later moved back or whatever.
In your opinion, is there a good strategy for dealing with these kind of problems? Maybe this is dead simple and I just overlooked something.

Regards and many thanks for your thinkings...

Philippe

PS: My strategy is to copy the inner volume, move it away, generate the outer volume, move the inner one back in place, generate the inner one. This can get quite complex as generally the inner volume is not just a brick or a cylinder.

Peter V's picture

Hi Philippe,

Thanks for the suggestion - much appreciated!

I think you should be able to accomplish all your objectives with SketchUp Meshkit "out-of-the-box". If I understand correctly, you're looking to accomplish three things:
1) To generate a mesh which has multiple volumes (or "materials/regions/domains/etc..."), one inside the other, where the mesh is conformal at the volume/volume interface.

2) And you'd also like to be able to access the shared interface surface (I assume for some kind of fluid-structure interaction problem, or conjugate heat transfer, etc..)?

3) You want to access the faces once they are grouped in SketchUp, and modify the boundary conditions.

Regarding (1): SketchUp Meshkit should handle that already. Just place "region-2" inside "region-1" set the following options:
"region-1": has_subregion => true, subregion_number => 2
"region-2": is_subregion => true
That should be all you need. If you export to GMSH format and generate a mesh, you should find a compound volume has been generated, with regions 1 and 2 still accessible and the internal boundary respected.

Regarding (2): This is really mesher/solver-dependent. So, for example, if I use SketchUp Meshkit and GMSH with OpenFOAM to do an FSI/CHT problem - I use the OpenFOAM preprocessing utilities to split the mesh in to separate domains based on the region/volume marker generated by SUMK/GMSH. The preprocessor basically adds a surface at the interface that you can assign boundary conditions to.

Regarding (3): Even after you've grouped your solid, you can still set/modify/update boundary properties. There are two ways. First, if you have the group selected and apply a boundary option, it will be applied to all faces/edges/vertices in that group. If you double-click the group, and select an individual face - then boundary options will only be applied to the selected face.

I hope this answers your questions? If not, please let me know!

Kind regards,
Peter

PS: If the strategy for (2) doesn't work with your solver/preprocessor, let me know and I'll add an option to automate what you've been doing by hand for the next release (i.e., generate discrete regions that retain interface surfaces).

Till G's picture

Hi Peter when is the snappymesh comin? ;) good work!

Hi Till,
Coming really soon!
It's in the testing phase at this point, mainly adding better blockMesh support so that it will be a complete, end-to-end capability.
I think it should be just a couple weeks!
Thanks,
Peter

Andrew W.'s picture

Really looking forward to this release - thank you for your work.

Will there be an ability to set up the entire openfoam case at some point? Including patches and turbulence models etc?

Philippe N.'s picture

Hi Peter

Any plans for some sort of a manual?
I use meshkit together with tetgen and allways struggle with the refinements where I newer really know what the refinement values mean and how the apply together - face refinement and volume refinement.
Can you give some general hints?

Many thanks and regards (great tool)

Philippe

Peter V's picture

Hi Philippe,
Yes, absolutely!
This has been on the list for a while now... but, you're right - it's time to put out some documentation :-)

Regarding setting refinements (volume/surface). The way that TetGen (and Gmsh) handle refinements is by assigning a weight (desired edge length) to each point in the solid. These are then linearly interpolated during meshing to (hopefully) get a smoothly graded mesh with the desired refinements. As far as I know, the refinement values you set on the surfaces control the volume mesh refinement.

In general, if I'm making a multi-material mesh, and I want each region to have a different refinement level (but I don't necessarily care about refining near a particular surface or how the mesh is graded), I'll just assign region-wise refinement. A call to tetgen for this would look like:
$ tetgen -pqAg example.smesh

If I do care about refining near a particular surface, or I want smooth gradation between mesh sizes, I'll just use surface refinements (and forget about region-wise refinement entirely since it will be "automatically" taken care of). In order to do this, tetgen needs another file which has the weights (edge lengths) for each node. (the .mtr file). Meshkit generates both files anyway, so in order to use tetgen this way:
$ tetgen -pqAgm example.smesh

I hope this helps a bit!
Kind regards,
Peter

Hi,

Any plans for linux version?

Peter V's picture

Hi,
SketchUp only officially runs on Windows/OSX, however, some users have had success running SketchUp (and the MeshKit plugin) on linux using Wine. I'd give that a shot!
Kind regards,
Peter

Hello,

I just discovered MeshKit, and I find that extension for Sketchup great!

I just have one question : is it possible to declare physical lines directly with MeshKit? because Im working in 2D... It seems easy to declare and name physical surfaces and volumes but can we do the same with lines?

Thanks
Regards

Peter V's picture

Hi Marie,
I'm glad you like it!
At the moment, with MeshKit version 3 it's not possible... however, this will likely be a new feature in version 4!
MeshKit4 should be released in early September. Until then, you can (assuming you are using Gmsh) just add a line like:

Physical Line ( "some_name" ) = { 1,2 ... line_numbers_to_include_in_physical_group };

I hope this helps!
Kind regards,
Peter

Yes that's what I did! So I'm waiting for version 4!

Thank you!
Regards,
Marie

Peter V's picture

Hi Marie,
I just released a new version (3.2) and added some basic support for Physical Lines - so give it a shot and let me know how it goes!
Kind regards,
Peter

Hi Peter,
I just saw your answer. Thanks a lot!! Im gonna try it and I'll tell you how it goes!
Regards
Marie

Ahmed A.'s picture

Hi Peter,
Thank you for all support. I was trying to draw my model in the same way with your files but for my dimensions.
The following links showing the SketchUp file and the smesh file
https://www.dropbox.com/s/h7rea29i5j50m0x/my%20model.skp?dl=0
https://www.dropbox.com/s/yw6s5f359qg2wxx/mymodel.smesh?dl=0

when I wanted to mesh with tetgen, the following error messege was shown. Could you assist me please. Thank you for your time.
Best Regards
Ahmed

$ tetgen -pqAag mymodel.smesh
Opening mymodel.smesh.
Opening mymodel.mtr.
Constructing Delaunay tetrahedralization.
Delaunay seconds: 0.015
Creating surface mesh.
Recovering boundaries.
Error: Invalid PLC! A point and a subface intersect
Point 17. Subface (#199) (90, 89, 87)
Program stopped.

Andrew W.'s picture

Hi, I have followed the example tube video exactly, but when I click quick mesh, I get a breif flickr of something, and nothing happens?

Any ideas?

Peter V's picture

Hi Andrew,

Thanks for checking out the extension!

So, a couple possibilities spring to mind:
1) Make sure the gmsh path in Meshkit (the right-most button) is set to wherever you have gmsh installed. It should look something like this for Mac: /Applications/Gmsh.app/Contents/MacOS/gmsh or this for Windows: C:\Users\Andrew\Desktop\gmsh.exe

2) Make sure the object that you want to mesh is in a Group (not a Component) and that it is selected when you click "QuickMesh"

If these don't solve the issue, just open the ruby console, try again, and copy the output to a text file. Then, if you could share a Dropbox (or equivalent) folder with the text output and the sketchup model - I'll take a look.

Thanks!

Andrew W.'s picture

Hi Peter,

Thanks for the advice - I have the correct path and made sure the object was a group -

I get this result in the Ruby panel ...

Using planar surfaces only.
Invalid argument - \615afacba62626eb74f3a233aa254c4c.geo

thanks, Andrew

Peter V's picture

Hi Andrew,

Could I also ask what OS (Mac, Windows 7,10,etc...) you are using? Meshkit writes a temporary gmsh file in the "temp" directory, but for some reason it doesn't seem to be finding the temporary directory path on your system. If you could let me know, that would be very helpful!

In the mean time (I know it's not as convenient), you can still import meshes from Gmsh in to SketchUp. Steps:
1) Export to gmsh format as normal;
2) Mesh your geometry;
3) Save the mesh with the *.mesh extension (in "Medit" format);
4) Use the Import Mesh button on Meshkit (third from the right) to load the mesh in to the SketchUp model.

Thanks again for your help!
Peter

Andrew W.'s picture

Hi Peter,

Thanks for the reply.

I am using Windows 10 64bit (fully up to date) With Sketchup 2016 (again, latest patch version)

Your comment gave me an idea, so I ran Sketchup in Administrator mode, it now works!

Thanks!

Andrew W.'s picture

Hi Peter,

Now that I can get quickmesh to work by starting Sketchup in Admin mode, can I be bold enough to ask a request!?

Is it possible to automate the number assignation? Us wannabe geeks don't have enough brain power to remember what the last number we assigned was, especially with lots of parts, it would be great if the plugin automatically remembered what your last selection was numbered, then added one automatically.

This would also save time having to highlight and type it in every time as well.

Thanks for the great plugin though!

Peter V's picture

Hi Andrew,

Absolutely, that sounds like a great idea and I'll try to work it in to the next release! And if you have any other suggestions/feature requests/bugs/etc. as you continue to use the plugin - don't hesitate to ask!

Thanks,
Peter

Andrew W.'s picture

Hi Peter,

I may have stumbled upon the reason why the plugin couldnt write to my computer, I just looked at the top level of my hard drive and found loads of mesh files, I don't have a tmp or temp folder in there either, perhaps this is the reason? The plugin is trying to write to the top level and not a tmp folder perhaps?

Peter V's picture

Hi Andrew,
I suspect that Windows 10 (or at least the latest patch) handles the temp directory path a bit differently than previous versions.

So, here is what is happening. Meshkit handles writing temp files in two parts. First it finds the path to the temp directory, and then it creates a unique file name for the current geometry to be meshed. These are concatenated to form the fully qualified path to the temporary geo/mesh file, but since the first part isn't being found, all that is left is the top level directory (i.e. \filename.geo).

I believe I have this fixed for Windows 10 users and this fix will come out with the next release (probably within the next 10 days).

Thanks for your help identifying and diagnosing this bug - very much appreciated!
Peter

Andrew W.'s picture

Hi Peter,

Thanks for checking it out and glad to be of some assistance here, even if it was in a blind stumbling kind of a way!

Thanks again for the great utility!

Andrew

Christopher N's picture

Hi Peter,

Thank you so much for all of the work that you have put into this tool. It's one of the best ones that I use. I have a small bug that may be related to how Sketchup fits surfaces to bounding geometry.

First draw a cylinder by making a circle and extruding the surface by using the 'push' tool. Then take the cylinder and put it completely inside of a cubic box. Then delete a surface at one of the ends of the cylinder. Then re-draw the end surface by connecting two points on the bounding circle together using the line tool. Give the box and the cylinder surfaces some markers. Export the box+cylinder geometry to tetgen format and try to mesh. Tetgen will complain about self-intersecting facets on that surface.

I don't know if it is related to how Skechup chooses to re-fit a surface to the bounding geometry of the circle on the end of the cylinder. I thought it might be something that you would find interesting. If nothing can be done at least we have a record of the issue for other users. The workaround is to simply avoid deleting any surfaces of a geometry that you may need to re-add later.

-Chris N.

Peter V's picture

Hi Chris,
Glad to hear that it has been useful! Thanks!

So, I tried to reproduce this potential bug as you described. I've tried a few variations (setting region numbers vs not, etc.) but I'm not able to reproduce this.

Are the cylinder and box intersecting (touching) anywhere?

If so, this can cause tetgen to complain about self intersecting geometry. The reason is, is that you need to build a valid "piecewise linear complex" or "PLC" from the SketchUp geometry. Meshkit helps do that, but sometimes there are circumstances where it needs a bit of help :-) The TetGen page has a short description of how this works: http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual002.html#sec%...

For example, if you place cylinder inside the box, and the bottom of the cylinder is in contact with the bottom of the box, then you need to make sure that all of the edges of the part of the cylinder that are in contact are also drawn on the bottom face of the box, as well.

Usually you can do this by selecting both the grouped cylinder and the ungrouped bottom face of the box and using SketchUp's "Intersect Faces -> With Selection" tool (right click). Alternatively you can Copy/Paste the bottom face of the cylinder directly on to the bottom face of the box. The bottom face of the box will actually have multiple faces now (a circle matching the bottom of the cylinder, and the rest of it). If you have other lines/edges then these need to be there too.

Please let me know if this helps! If not, then maybe you could share your SketchUp model with me and I can try to reproduce it directly.

Good luck!
Peter

Ahmed A.'s picture

Thank you Peter for posting the cylinder mesh, it is very impressive.

Ahmed A.'s picture

Hi Peter,
I am trying to make a cylinder in Sketchup and then open the .1.mesh file in Gmesh. I got the following run message:
$ tetgen -pqAag cyl.smesh
Opening cyl.smesh.
Constructing Delaunay tetrahedralization.
Delaunay seconds: 0.003
Creating surface mesh.
Recovering boundaries.
Boundary recovery seconds: 0.004
Removing exterior tetrahedra.
Warning: Detecting an open face (25, 2, 19).
Hole seconds: 0.002
Repairing mesh.
Repair seconds: 0.002
Adding Steiner points to enforce quality.
Quality seconds: 0.001
Optimizing mesh.
Optimize seconds: 0.002
Jettisoning redundants points.

Writing cyl.1.node.
Writing cyl.1.mesh.

Output seconds: 0.024
Total running seconds: 0.038

Statistics:

Input points: 48
Input facets: 92
Input segments: 138
Input holes: 1
Input regions: 0

Mesh points: 0
Mesh tetrahedra: 0
Mesh faces: 0
Mesh edges: 0
Mesh boundary faces: 0
Mesh boundary edges: 0

nd based on that the Gmesh can not open such file, could you please advise me how to deal with a cylinder and how to set regions and boundries.
Thank you for your time Peter

Peter V's picture

Hello Ahmed,

I think you're best bet will be to use TetGen for this application. TetGen handles multiregion meshes very well! Just mark each region with a different number, for example give #1 to the ground, #2 to your column, and #3 to the surrounding air. Set your boundaries, export, and mesh with tetgen (just make sure that your geometry forms a valid piecewise linear complex (PLC) (http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual006.html).

Here is a quick example sketchup file with your geometry, the exported tetgen smesh file, and a (very) coarse mesh showing that it works: https://www.dropbox.com/sh/i3y26zh38nisfqn/AABTS5JQf8o7aa88U6iS8BYCa?dl=0

Also, if possible, if you have questions that you would like to ask in the comments, could you please put your files/output/etc. in a dropbox (or similar) folder and just paste the link, please? I think that would help keep the comments section clean, and also be better for debugging/testing etc... Thanks!

I hope this helps!

Kind regards,
Peter