ChatGPT is an AI large language model (LLM) which specializes in conversation. While using it, [Gil Meiri] discovered that one way to create models in FreeCAD is with Python scripting, and ChatGPT could be encouraged to create a 3D model of a plane in FreeCAD by expressing the model as a script. The result is just a basic plane shape, and it certainly took a lot of guidance on [Gil]’s part to make it happen, but it’s not bad for a tool that can’t see what it is doing.
The first step was getting ChatGPT to create code for a 10 mm cube, and plug that in FreeCAD to see the results. After that basic workflow was shown to work, [Gil] asked it to create a simple airplane shape. The resulting code had objects for wing, fuselage, and tail, but that’s about all that could be said because the result was almost — but not quite — completely unlike a plane. Not an encouraging start, but at least the basic building blocks were there. Continue reading “ChatGPT Makes A 3D Model: The Secret Ingredient? Much Patience”
What if instead of defining a mesh as a series of vertices and edges in a 3D space, you could describe it as a single function? The easiest function would return the signed distance to the closest point (negative meaning you were inside the object). That’s precisely what a signed distance function (SDF) is. A signed distance field (also SDF) is just a voxel grid where the SDF is sampled at each point on the grid. First, we’ll discuss SDFs in 2D and then jump to 3D.
SDFs in 2D
A signed distance function in 2D is more straightforward to reason about so we’ll cover it first. Additionally, it is helpful for font rendering in specific scenarios. [Vassilis] of [Render Diagrams] has a beautiful demo on two-dimensional SDFs that covers the basics. The naive technique for rendering is to create a grid and calculate the distance at each point in the grid. If the distance is greater than the size of the grid cell, the pixel is not colored in. Negative values mean the pixel is colored in as the center of the pixel is inside the shape. By increasing the size of the grid, you can get better approximations of the actual shape of the SDF. So, why use this over a more traditional vector approach? The advantage is that the shape is represented by a single formula calculated at many points. Most modern computers are extraordinarily good at calculating the same thing thousands of times with slightly different parameters, often using the GPU. GLyphy is an SDF-based text renderer that uses OpenGL ES2 as a shader, as discussed at Linux conf in 2014. Freetype even merged an SDF renderer written by [Anuj Verma] back in 2020. Continue reading “Signed Distance Functions: Modeling In Math”
It’s been at least a couple of months since we’ve seen a different 3D modeling language project, so here’s [Lukasz Janyst] with GhostSCAD: a take on creating OpenSCAD models, using the Go language as the front end, bringing all the delights this modern modular language has to offer (and a few of its own idiosyncrasies.) As [Lukasz] says in the blog, from a programmer’s viewpoint, openSCAD has a number of failings that make it not necessarily hard, just kinda annoying to work with, due to the way the geometry tree works. The OpenSCAD way of working ends up with the programmer requiring knowledge of the internal workings of sub-modules, in order to work at the top level (assembly) which is not an ideal situation from a code reuse perspective.
A programmer would describe this problem as “abstraction leakage” and it doesn’t make modular, reusable coding easy to do without a lot of extra work. [Lukasz] says regarding the example GhostSCAD project, that some parts were modeled in a way that knowledge was needed of some mounting points of sub-modules, but those sub-modules had no way to expose this information to the outside world. GhostSCAD enables the programmer to define parts that expose specific parameters to the world that can be queried, for example, to produce a joining part, or an exploded assembly diagram. These properties can be interpreted without the querying module having any knowledge of the internal structure of the thing it’s working with. GhostSCAD provides a Java3D-like API for defining the geometry tree, which may be familiar to some.
Continue reading “GhostSCAD: Marrying OpenSCAD And Golang”
Software-defined radio is all the rage these days, and for good reason. It eliminates or drastically reduces the amount of otherwise pricey equipment needed to transmit or even just receive, and can pack many more features than most affordable radio setups otherwise would have. It also makes it possible to go mobile much more easily. [Rostislav Persion] uses a laptop for on-the-go SDR activities, and designed this 3D printed antenna mount to make his radio adventures much easier.
The antenna mount is a small 3D printed enclosure for his NESDR Smart Dongle with a wide base to attach to the back of his laptop lid with Velcro so it can easily be removed or attached. This allows him to run a single USB cable to the dongle and have it oriented properly for maximum antenna effectiveness without something cumbersome like a dedicated antenna stand. [Rostislav] even modeled the entire assembly so that he could run a stress analysis on it, and from that data ended up filling it with epoxy to ensure maximum lifespan with minimal wear on the components.
We definitely appreciate the simple and clean build which allows easy access to HF and higher frequencies while mobile, especially since the 3D modeling takes it a step beyond simply printing a 3D accessory and hoping for the best. There’s even an improved version on his site here. To go even one step further, though, we’ve seen the antennas themselves get designed and then 3D printed directly.
For those who model CAD models regularly, a pair of calipers is essential as it allows reasonably accurate measurements to fit a specific part. However, [Jason Harris] is taking that concept to the next level with a signed distance function-based CAD tool, SDFX.
For those who don’t know, Signed Distance Functions can tell you from a given point how close the nearest part of the model is. The model is represented as a single function that offers some exciting benefits. For instance, chamfering and fileting are often quite complex in traditional CAD programs and trivial in an SDF setting. SDFX is a golang library that allows you to write golang programs to describe the model. OpenSCAD is a favorite of Hackaday as it is a beautiful parametric code-first CAD package. But the syntax and language are somewhat cludgy, to say the best. The advantage of using golang rather than a DSL is that you can use all the niceties that a full-featured language brings. For example, you can export multiple objects, make network requests, and interface with GUI libraries to recreate something like the customizer for OpenSCAD.
Objects are rendered to STL using Marching squares. Then, they can be printed in whatever slicing software suits your fancy. It’s an excellent project with a great API and almost a hundred examples.
The code is available on GitHub under an MIT License.
3D printers have made a lot of things possible that were either extremely difficult or downright impossible with traditional tooling. Certain shapes lend themselves to 3D printing, and materials and tooling costs are also generally greatly reduced as well. One thing that may not be touched on as often, though, is their ability to rapidly prototype solutions to complex mathematical problems, in this case taking the form of a 3D printed maze, known as a dodecahedral holonomy maze, with an interesting solution.
The puzzle presents itself as a sphere composed of various inlaid hexagons which form a track for the puzzle piece, or “rook”. The tracks create the maze for the rook to travel, as some paths are blocked when the rook is oriented in certain ways. To solve the puzzle, the player must rotate the rook by moving it around the hexagons in such a way that its path isn’t physically blocked by any of the pegs in order to successfully reach the exit. This might seem like a fun toy to have on its surface, but the impressive thing about this is that the solutions are designed to reduce the likelihood of solving the puzzle with any “brute force” methods while at the same time having more than one path that will reach the exit as well as several bottlenecks that the puzzle solver must traverse as well.
There are actually many possible puzzles that can be produced in this size and shape, and all have predetermined solutions with cleverly chosen paths. This might seem like a lot but when you realize that the entire build from concept to 3D modeling to implementation was done by [Henry Segerman] and a group of other mathematicians at Oklahoma State University it starts to become more clear how the puzzle was so well-designed. In fact, we’ve featured some of his other mathematically-modeled builds in the past as well.
Thanks to [Inne] for the tip!
Continue reading “Complicated Calculated Solution To 3D-Printed Puzzle”
Now, we know what some of you are going to say — “Oh man, not another programmatic CAD tool, what’s wrong with OpenSCAD?” — and you may be right, but maybe hold on a bit and take a look at this one, because we think that it’s now pretty awesome! OpenSCAD is great, we use it all the time round these parts, but it is a bit, you know, weird in places. Then along comes CadQuery, and blows it out of the water ease-of-use and functionality wise. Now, we’ve seen a few mentions of CadQuery over the years, and finally it’s become a full-blown toolset in its own right, complete with a graphical frontend/editor, CQ-editor. No odd dependencies on FreeCAD to be seen! That said, installing FreeCAD is not a bad thing either.
The goal is to have the CadQuery script that produces this object be as close as possible to the English phrase a human would use.
Continue reading “CadQuery Comes Of Age”