Hey there 👋
It’s Robin from CFD Engine & my quest to find an open-source wrapper may finally be at an end 🙌
I’ve written about shrink-wrapping a couple of times, but it always felt a bit off as I was using a pre-release Rhino version & most people couldn’t try it out.
Well, I’ve finally had the chance to play with an open-source alternative & it’s pretty-darn good.
So, if you like the idea of wrapping overly-complex CAD assemblies to save time on your geometry prep, but don’t have Rhino, then this is for you.
Shrink-wrapping
In case you missed it, shrink-wrapping is just like it sounds, wrapping a complex model in a simple watertight skin so that it’s almost the same size & shape, but with a fraction of the detail.
It’s great for tidying up complex mechanical CAD assemblies, especially if they aren’t the primary focus of your model, but are too important to leave out.
There are plenty of good commercial tools that can wrap, but I didn’t know any open-source ones…until now.
Say hello to 3D Alpha Wrapping, part of the CGAL project 👋
CGAL
The Computational Geometry Algorithms Library is a huge C++ toolkit that can handle all sorts of geometry-related tasks.
You might have seen it before (it’s a requirement if you’re building OpenFOAM) but if not, just think of it as a pile of building blocks that developers can use to implement tricky geometry stuff in their own projects.
3D Alpha Wrapping was added last July, & this image really got my attention.
Chuck in the the source code for a command-line tool that can read a mesh, wrap it & save the result & it was too good to miss.
But there’s a catch…
Where’s the catch?
CGAL is a code library & the example is source code – you have to build it yourself 🤦♂️
That might be enough to put you off, but I’m not a developer & even I managed it. I’ve uploaded a few notes on what I did – maybe they’re enough to get you started?
A little test
Here’s the kind of output you can expect if you give it a go…
The code only has two parameters, alpha
(essentially the level of detail) & offset
(how tightly the wrap fits). In my tests, the wraps took anywhere from a couple of seconds to a couple of mins – easily quick enough to iterate & find your optimum settings.
The documentation has more detail, but this chart gives you a good idea of how the main parameters interact.
Possible Workflow
I could see it sitting in-between CAD & snappyHexMesh, something along the lines of…
- Export your complex CAD assembly as an STL/OBJ;
- Wrap it using Alpha Wrap;
- Optional: Reduce the face count in MeshLab;
- or extend your version to use CGAL mesh simplification 🤓
- Mesh the output with SHM 🙌
Plus it’s a command-line tool, so you could even script it up, if you like.
Thoughts?
I’ll (probably) stop going on about wrapping soon. I reckon it’s a great option for simplifying overly-complex geometries & I’m even more bullish now that there’s an open-source option available.
I don’t imagine this will be my last mention of the CGAL project though. Wandering through their package list has given me all sorts of app ideas.
Do you think you’ll take this for a spin? Or is building it too much hassle?
I reckon it would make a great addition to OpenFOAM – there’s already a CGAL dependency & it would sit quite nicely with their other mesh prep tools 🤔
Let me know what you think, my inbox is always open.
Until next week, stay safe,