Optimizing Expanded Metal Mesh in FreeCAD

This guide will show how to model sheets of Expanded Metal in FreeCAD, without slowing (or killing) FreeCAD.

Optimizing Expanded Metal in FreeCAD

In our last guide, we looked at how to get a granular view of the size (in bytes) of each layer in a FreeCAD file — so we could figure out which object was causing the file to be so large and slow. We found that 90% of the file’s (uncompressed) MemSize was being caused by just one item: a 95 cm x 68 cm sheet of Expanded Metal.

A photo of a small sheet of expanded metal
Expanded Metal (source). Expanded metal is a type of sheet metal which has been cut and stretched to form a regular pattern (often diamond-shaped) of mesh-like material (source)

Unfortunately, rendering mesh objects (like Expanded Metal) in any CAD software can cause enormous lag in the app.

This article is part of a 2-part series:

Optimization Attempt #1: Array

My first thought was: rather than having one large sheet of Expanded Metal, let’s just simplify this object to its lowest common denominator: a sketch (and extrusion) of a single “diamond”. Then we’ll use arrays to clone the as-simple-as-possible shape in two dimensions, as needed.

Because, FreeCAD should then have some magic to be able to store just the item once, and it’ll make things super small and fast, right?

After some searching on the FreeCAD forums, I was able to find this post, where someone had created exactly that: a simple sketch of a single “link”, and then they used arrays to expand it in both directions. The file with the Expanded Metal sheet modeled in this way was only 56 KB.

I wanted to see how well this idea would scale. My first thought was to create three files:

  1. An expanded metal mesh that’s 1 meter x 1 meter
  2. An expanded metal mesh that’s 10 meters x 10 meters
  3. An expanded metal mesh that’s 100 meters x 100 meters

…but that plan quickly failed. I couldn’t even render the 10 meter x 10 meter expanded metal mesh without my poor computer thrashing (and nearly crashing).

Instead, I created the following:

  1. A FreeCAD file with an expanded metal mesh measuring approximately 10 cm x 10 cm
  2. A FreeCAD file with an expanded metal mesh measuring approximately 20 cm x 20 cm
  3. A file with an expanded metal mesh measuring approximately 40 cm x 40 cm
  4. And one measuring ~ 80 cm x 80 cm

I tried to create one with an expanded metal mesh array measuring 160 cm x 160 cm, but FreeCAD crashed.

While it was obvious that my idea to “optimize” rendering an Expanded Metal Mesh in FreeCAD by using a super-simple sketch + array was NOT going to scale, I wanted to understand how bad this idea was.

The chart below shows the following for each file:

  1. .FCStd Size = The total (compressed) .FCStd file-size on-disk (in MB)
  2. Total MemSize = The total (uncompressed) MemSize of the file (in MB)
File.FCStd Size (MB)Total MemSize (MB)
10cm0.563.75
20cm0.8412.67
40cm0.1343.65
80cm0.22165.01
160cmcrashed

Graphed, it appears the MemSize grows at an exponential rate.

Graph showing MemSize climbing at an exponential rate from (10,10) to (80,160)
Arrays grow exponentially up to 165 MB with a sheet 80 cm x 80 cm

Optimization Attempt #2: Hatch

After further digging, I learned that this is a common issue in all CAD software. Because of this, professional engineers (even those poor souls who have to use AutoCAD) typically do not render (Expanded Metal) meshes. Instead, they put a placeholder solid sheet in its place, with an information fragment added to the drawing that describes the type of material.

But I wondered if there was some middle-ground — some way we could draw a solid and “color” it with some sort of bitmap to make it clear that it’s a placeholder. And I found one: a hatch

A hatch is a simple 2D pattern that gets drawn over a solid. I quickly found that I could draw a “diamond” pattern hatch over the solid with thick silver lines and set the solid to be transparent. The result: you get some sheet that looks like it’s made of some diamond-patterned metal mesh, but the shape and size of the holes is very far from accurate.

To do this, I first created a solid sheet by switching to the “Part” workbench, and clicking Part -> Primitives -> Cube. Then I changed the cube’s dimensions to 20 cm x 20 cm x 3 mm.

To draw the “hatch” on the top plane of our cube/sheet, I then I switched to the Draft Workbench. I then selected the top plane of our cube, and clicked “Drafting -> Facebinder”.

Then I clicked “Drafting” -> “Hatch”. Browse to the FreeCAD progam folder (eg /usr/share/freecad) and select data/Mod/TechDraw/PAT/FCPAT.pat. I chose the “Pattern” = “Diamond”, set the “scale” to “40”, and pressed “OK”.

Next, we can make the non-hatch-lines transparent by selecting the “Cube”, clicking the “View” tab, and changing “Transparency” from “0” to “100”. Do the same for the “Facebinder” object.

And we can make the lines appear “metalic” in color, by selecting the “Hatch”, and setting the “Line Color” to “#cccccc”

And you can make the lines “thicker” by changing the Hatch object’s “Line Width” to “8”.

Screenshot of FreeCAD application shows the object named "Hatch" is highlighted in red, and the "Line Width = 8" option is also highlighted in red, inside the "View" tab.
Increase the Hatch’s “Line Width” to “8”

Finally, we have a 20 cm x 20 cm sheet (that’s 3 cm thick) that looks close-enough to a sheet of expanded metal — but whoose size is magnitudes less (in bytes)

Screenshot of FreeCAD application shows a short cube with a diamond hatch pattern along its top-most face
The final product looks close-enough to expanded metal, yet requires magnitudes less space (in bytes)

You can experiment by changing the hatch’s Scale (the frequency of the lines = the size of the holes in the mesh) and/or by changing the hatch’s Line Width.

As above, I repeated this for different size sheets. Doubling the size of the sheet every time, I was able to make it to a 640 cm x 640 cm sheet. Attempting to create a 1,280 cm x 1,280 cm (12 meter x 12 meter) sheet did, unfortunately, crash FreeCAD.

File.FCStd Size (MB)Total MemSize (MB)
10cm0.0160.110
20cm0.0240.205
40cm0.0400.395
80cm0.0720.780
160cm0.1480.155
320cm0.3083.075
640cm0.6286.141
1,280cmcrashed

The graph shows linear growth, and the MemSize is on the order of three magnitudes smaller

Graph showing MemSize climbing at a liner rate from (0,0) to (620,6.1)
Hatches grow linearly up to 6 MB with a sheet 640 cm x 640 cm

Conclusion

In the end, arrays of expanded metal objects in FreeCAD don’t make sense. It’s better to just make a solid object and “hatch” it.

This is clear when we compare the (compressed) .FCStd file size and the (uncompressed) MemSize of (left) the simplified array model vs (right) the hatched solid model:

Here’s a list of the pros & cons of using a hatch instead of an array to represent an Expanded Metal sheet in FreeCAD:

Pros

  • Smaller (compressed) file sizes
  • Smaller (uncompressed) object MemSize
  • Much easier to render, view, and update in FreeCAD
  • Lowers barrier-of-entry for other collaborators

Cons

  • Imprecise 3D model
  • Requires supplementary specification in object’s documented BOM (Bill of Materials) for actual dimensions of object

Limitations

Obviously using hatches is significantly better than modeling an array of “links” to create a sheet of Expanded Metal in FreeCAD. But there are still limitations..

While I was able to create a 3D sheet of hatched Expanded Metal 6.4 meters x 6.4 meters, FreeCAD does still crash when I try to double it (to 12.8 meters x 12.8 meters).

If you know of a better way to model Expanded Metal in FreeCAD, please let us know.

Further Reading

Who is Eco-Libre?

Eco-Libre is a volunteer-run project that designs libre technology for sustainable communities.

Eco-Libre’s mission is to research, develop, document, teach, build, and distribute open-source technology that sustainably enfranchises communities’ human rights.

– Eco-Libre’s mission statement

We aim to provide clear documentation to build low-cost machines, tools, and infrastructure for people all over the world who wish to live in sustainable communities with others.

If you’d like to help Eco-Libre reach our mission to enfranchise sustainable communities’ human rights with libre hardware, please contact us to get involved 🙂

Please enter your email address below for updates from the Eco-Libre Team.

Leave a Reply

Your email address will not be published. Required fields are marked *