Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
New featureScript: Voronoi face lattice

Hi everyone,
This is my first post here, so let me start by introducing myself. I’ve been a professional Onshape user since 2019 and have been creating FeatureScripts from the very beginning. My background is in aerospace engineering, composite material science, and robotics. In my day job, I’ve had the privilege of working on some truly exciting engineering projects, but up until now my FeatureScripts have always lived strictly inside our Onshape Enterprise environment. That said, I’ve long wanted to share some of my work with the wider community. So, during my summer holiday, I finally took the chance to build something for fun for myself, but also for all of you! I hope you’ll find it useful.
The only required input for the FeatureScript is a flat face or sketch surface, everything else is optional. On that face, it creates a Voronoi lattice, an organic-looking structure you’ll recognize from patterns in nature, biology, physics, architecture, and even consumer product design.
I’ve also implemented a random pattern generator, adapted from Philip Thomas’s Random Surface Perturbator, based on earlier work by Maximilian Schommer and Ilya Baran.
To demonstrate usage, I’ve included examples showing how the flat-face limitation can be worked around using wrap features, though I’m sure the community will find other creative ways to apply it. A version that works directly on more complex surfaces may come later.
Key Features
- User-selected or pseudo-random Voronoi points (with seed input)
- Choice between bezier-curve or polyline cells
- Option to truncate circular concave/convex edges for cleaner bezier outputs
- Cell offset control for wall thickness
- Short-edge filtering to avoid overly sharp bezier artifacts
- Option to output only 2D geometry (useful for wraps or other downstream features)
- Blind extrude with boolean and composite part options
Known Limitations / Future improvements
- Currently works only on flat faces and sketch surfaces, option for general surface would be nice
- Polyline output limited to 2D surfaces (sketch option disabled for now)
- Extrude is blind-only (future: up-to, two-sided, etc.)
- Editing logic function addition to pre-select the extrude direction upon creation would be nice.
- Truncation could be extended to non-circular curves
- Short-edge filter can misbehave if set too high
- Large offsets may break the feature (error handling would help)
See it here: Voronoi face lattice.
If you discover any bugs, have ideas for improvements, or would like to collaborate, please reach out. If you like the tool, I’d love for you to use it, share it, and even improve upon it, just please give credit and share your work under the same license (CC BY-SA).
Comments
You certainly took your implementation a lot further than I did. Mine also isn't random seeded voronoi but the deterministic version based on the delaunay mapping of a given face. I'll have to set aside time to polish mine up and make it a real feature instead of just a thought experiment at some point. The one thing I might suggest adding to your implementation is a caching function by shoving some of the heavier calculation work into an editing logic step. My implementation has a lot of edge flipping operations that start to build up regen time the more I have but once the map is made the actual drawing steps are super snappy, so I did some reworking to make it build the geometry maps while the user is editing the feature but not during normal rebuild.
I was looking at your script, super impressive! I've been meaning to have a look into that caching trick, it seems incredibly powerful. I think your explanation here means I have a better chance to grasp the concept. Thanks for explaining the principles!
@wille_j Thanks for sharing this! I've been interested in writing one for a while, but never got around to it! Very nice feature.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
Cool! Nice to meet you. 😎 And ty for sharing!
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴