Weighted Lattice Generator
Version 1.0 (44.1 KB) by Kelsey
Create Weighted Lattice STLs Suitable for Printing on Resin Printers
Updated 10 Feb 2022
This code creates lattice STLs that are suitable for additive manufacturing. The code has the ability to make unique lattices that meet fill fraction targets and avoid stress concentrations. The user can select a lattice type (octet, octahedral, etc) and desired parameters (size of certain type of struts/joints/fill fraction). The code then creates a lattice that meets the design requirements and outputs as an STL. This code was initially developed for the KAB Lab at Boston University's Mechanical Engineering Department.
The code allows several different base lattice types, and it is possible to add more in the future. Currently, the following features are supported:
1. Select among 5 different lattice types:
2. Move mass from different types of struts or joints while maintaining a constant fill fraction.
3. Add support structure and base that gets the lattice off the build plate, increasing printability on resin printers.
4. Vary fill fraction vertically. For example, struts and joints have more mass at the bottom and less at the top.
5. Distort struts into ovals.
It also comes with the following code features designed to increase speed:
1. Takes advantage of 3 fold symmetry of many lattices. Therefore, it calculates one eighth of the lattices and then mirrors it to the other 8 octants.
2. When using batch mode, it orders your list into the order that requires the least amount of calculations. Essentially, lattices that share base matrices can be computed much quicker in sequence than lattices that have different base matrices.
3. Down samples unit cell and then duplicates across lattice.
Note, there are likely many optimizations still to be done. However, this was designed primarily for small lattices (e.g. 4x4x2). If you want lattices that are comprised of thousands of unit cells, this program will probably bog down.
This lattice generation method was heavily inspired by the work of Dr. Raymond C. Rumpf from the University of Texas El %Paso. While ultimately it uses a different principle (combining weighted lattices vs. using Fourier series decomposition) to make the lattices, many of the variable names and coding conventions were copied from his excellent work. A few scripts are borrowed in whole or in part from his work, and these scripts are noted accordingly in their separate header. For more information, please check out his websites:
This work also uses STLWrite, a Matlab script created by Sven Holcombe and available on the Matlab File Exchange.
Kelsey (2023). Weighted Lattice Generator (https://github.com/KelseyEng/WeightedLatticeGenerator/releases/tag/v1.0), GitHub. Retrieved .
MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform CompatibilityWindows macOS Linux
Inspired by: stlwrite - write ASCII or Binary STL files
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.