![]() Explore other programs too if your not set on openscad (it is my favorite but sometimes there is an easier way). I have been using sagemath lately for almost everything - well, math. We also found a way to get matlab to give a graph thickness and export as STL - worked - but again cumbersome. Eventually - we won - but it was a battle. I explored this with a student who wanted to create mathematical knots with OpenSCAD - at the time it was very difficult and little out there in the way of help. I haven't tried this one but it's the first to show up on search: What you want to look for is 'extrude along path' or 'sweep path' with openscad. I believe (and hope) there has been some development so that it is easier now. This only works when the tangent of the curve never comes close to the upright vector (or its negation), but one can presumably always find an upright vector that satisfies that constraint. In my code, I do this by having the caller specify an "upright" vector, and then aligning the y-axis of the cross-section with the upright vector. ![]() It would be really helpful if there were a variant of hull() that worked only along a particular vector.īy the way, a geometric challenge in all this sweeping is aligning the cross-section at right angles to the curve's tangent while avoiding spurious rotations. But of course hull() will destroy a non-convex section. You can just make thin polyhedra and weld them with hull(). With a convex section, it all becomes a lot easier. And if one does this with full generality, as I am trying to, where the cross-section can change along the sweep (an eventual goal is to generate boomerangs with airfoils, for instance), one has to triangulate many times, and I don't know that OpenSCAD will be fast enough to handle that (I don't know that pure Python is either, though pypy may help). It's easier to write it in a mainstream language and then just generate an SCAD file. Writing triangulation code within OpenSCAD's functional language would, I think, be quite a nuisance. Of course, when generating an STL surface mesh, if I did sweeps along an open curve, I'd also need to triangulate the cross-section, but currently the code only does sweeps along a closed curve.Īll this would be harder to do in OpenSCAD directly. I think roundoff error makes them look not coplanar to OpenSCAD.) (Why can't I just generate polygonal caps, feed them into the polyhedron(faces=) and let OpenSCAD's CGAL worry about triangulating? I tried that, but OpenSCAD gives CGAL errors complaining about non-coplanar polygons. The problem with the solid segment approach is that it needs to triangulate the cross-section for the endcaps, and currently I just have naive triangulation code for convex or star-shaped polygons. The script has two ways of building the knot: simply by generating an STL surface mesh, which will self-intersect if one isn't careful in setting parameters, or by generating an OpenSCAD file that makes a bunch of short solid segments.
2 Comments
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |