Openscad extrude along path
I would argue that OpenSCAD's boolean operations are its primary interface and certainly waaay more accessible than using functions to generate point lists. The concat() operator would help, because you could construct your point set with functions, but this is still a very unintuitive way of creating 2D shapes compared to the ease of constructing shapes with the boolean operators. With them, it would be possible to create much more generic, simple and reusable The polyhedron approach is fine if you have preexisting shapes, but if you want to construct the 2D shapes parametrically, by using the 2D subsystem and boolean operations, then you can't use the polyhedron approach since you have no way to access the point info from the 2D shape. The single most helpful change to the core language would be support for function variables though. I hacked together something that basically works for this, but it could use some more work.
#Openscad extrude along path code
The only thing we would need native code for is to handle self-intersecting geometry, for example to allow rotate_extrude() circle() to generate a sphere.
With that, you have all the vertices of your mesh and all you need to do is to triangulate the sides and possibly the end caps and feed everything to a single polyhedron() call. The path for the extrusion is quite easy to define as a parametric affine or projective 3d transformation (allowing an arbitrary composition of rotation, scaling, translation, shearing, etc). From that, you can easily define any morphing/blending function. Point associativity between two shapes of equal length would just be based on position in the array. The (experimental) concat() function is highly recommended though.īasically, you define a 2D shape as an array of points (2d or 3d). On the other hand, what you want to accomplish is already kind of easy to do in client code as long as your resulting extrusion has no self-intersections. Even if they have the same number, n, of vertices (which in itself is hard to guarantee in the general case), just finding which of the n different solutions to associate vertices with is not obvious.
#Openscad extrude along path how to
Then, once you have a way to algorithmically/parametrically express general paths in space, you could load a 2d representation of your desired perpenicular section and extrude it along that given I agree that morphing/connecting different shapes like that could be useful, but given how shapes (2d polygons) are represented in OpenSCAD, I have no idea how to automatically handle linking of the two shapes. t would be a value ranging from 0 to 1 determining the point along the path where the folding operation would happen and v would be a vector indicating the direction of the folding axis and the intensity of the folding in terms of degrees, just like the parameter used in the rotate() operator. fold(t, v) - to fold the path at a certain point the same way you would phisically fold a metal wire at a given point. union() - to join two path representations arc(r, start, end) which draws an arc with radius=r starting at angle=start and ending at angle=end line(p1, p2) where p1 and p2 are points in space (x,y,z) The construction primitives we have in openscad deal with 2d shapes in a plane (the 2D subsystem) and 3D primitives (cubes, cylinders, etc.) What we would need is a set of: One thing we should consider is an API for modeling arbitrary paths in 3dimensional-space.