SOLVESPACE -- parametric 2d/3d CAD

(you are viewing a thread; or go back to list of threads)

"Twisted Surface" CAD challange (?) (by Marcel)

I spent the last couple of days to get to know Solvespace. I have to say, I really like it.

For a model I designed in OpenSCAD several years ago, I need a "twisted surface". This was quite a hard task.

Find a model of the twisted surface (as well as my attempt on a hirth joint, for which I needed this twisted surface) here: .

When I later learned FreeCAD, I tried to design it there as well. Although I needed quite a lot of reference geometrics, it was possible to do it in FreeCAD as well.

Now I wonder, if and how such a model can be acomplished in SolveSpace.

Actually, I didn't find a way to do it yet. Can you think of a way to design that part in SolveSpace?

Thank you in advance!


Mon Jun 3 2019, 12:36:34, download attachment twisted surface.stl
(no subject) (by Andrew)
If the surfaces can be modeled by a lathed element, you can create them modelling a section of the solid of rotation. A cone is easy, but you also have bezier curves for more subtle cross sections.Note, draw in 3D can be used to set up construction geometry for the rotation axis and drawing plane.
Mon Jun 3 2019, 16:23:15
Thank you (by Marcel)
Thank you, Andrew!

Actually, I don't think that it would be possible to model that with a lathed element - at least I didn't find a way to do that in OpenSCAD or FreeCAD.

But please let me know if you find a way...
Mon Jun 3 2019, 17:58:19
(no subject) (by Andrew)
You use the lathed solid to remove material from a block, so its intersection with a block defines the surface that you want, and its volume outside the block does not matter.
Mon Jun 3 2019, 18:13:30
(no subject) (by Andrew)
Here is a quick sketch illustrating the approach. Hope this helps.
Mon Jun 3 2019, 18:34:35, download attachment curved_face.slvs
(no subject) (by Marcel)
Thank you for your model!

I just had a quick look at it and it looks very impressive.

However, I doubt that this would solve the problem of my model.

I am currently at work. When I am back home I will try to add another sketch to make my problem more clear.
Tue Jun 4 2019, 04:37:30
(no subject) (by Marcel)
Ok, I'm back home and modeled a sketch of my problem.

Basically, I want to connect two triangles of different size being parallel to each other.

I (easily) can manage to make a wire frame of this model (the one I attached to this message). However, I cannot find a way to construct a mesh or a "body" of this wire frame.

All I get is the message, that not all points are coplanar (and indeed they are not). However, it is possible to design (or at least approximate) such a model in OpenSCAD and FreeCAD, so I wonder if it is also possible in SolveSpace...

Thanks again for your help!
Tue Jun 4 2019, 13:01:46, download attachment hirthJoint.stl
(no subject) (by Marcel)
sorry, this was the wrong attachment.

This one is correct
Tue Jun 4 2019, 13:03:30, download attachment Hirth Problem.slvs
(no subject) (by Andrew)
If the surface between the triangles can be approximated by a conic section, (on a diagonal across the face?), then that is the way to go. Alternatively, how were such joints machines in industry, which would give a tool shape and path. Such joints are old enough that a straight line tool path approach probably exists, and this can be modeled with an extrude.

A side note, an extrude, and a lathe operation, can use an arbitrary line in 3d as the axis or the path. For an extrude, this gives a solid with a cross section of the projection on the plane normal to the path, i.e an elliptical cross section from a circle sketch.

(Oh for a twist, or rotate in the extrude, with Openscad the solution to your problem is easy, a linear extrude of a rectangle, with a twist gives a cutter for for the face);
Tue Jun 4 2019, 15:59:25
(no subject) (by Marcel)
Hi and thanks again for your answer!

I think a conic section won't do (if I understand that correctly) as a second rotated tooth should fit on the twisted side wall without any gap or overlap. As a conic section is always concave or convex, this is probably not possible...

Actually, I don't even think it is possible to make such a joint with "traditional" industrial methods. The original hirth joint looks different: It has straight (non twisted) side walls that shift downwards from the outside to the center of the circle (see here: I don't really know if this is just done for practical reasons (easier to manufacture) or if there are also advantages with this approach (a user in the FreeCAD forum is convinced that the original version is better:;f=3&t=28038&start=10).

For me it doesn't matter. I have 3d printed "my style" of a hirth joint before and have very good results. Also, I want to model it in SolveSpace is just for training purpose and out of curiosity if it is possible.

There are other models with the same problematic surface...

Without the help of the OpenSCAD user group I wouldn't have been able to solve it there as well. If you are interested in the OpenSCAD code, it looks like this:

translate([20,0,0]) {
rotate([0,-90,0]) {
linear_extrude(height = 20,center = false, twist = 0, scale = [1,1e-308], slices = 50) {
points=[[10, 0],[0, 10],[0, -10]],

(or find the whole model here:

I hope I didn't miss any information in your last post (sorry, if I did). But as far as I get it, this problem is not solved (or solveable) yet, or is it? Maybe I just missed a part...
Tue Jun 4 2019, 18:43:49
(no subject) (by Andrew)
Based on the outline you gave, you can subtract from a block to form the faces by using a linear extrude of a rectangle, with a twist to accommodate the angle between the two ends. Obviously you need to rotate and align the extrude but something like:

linear_extrude(height = 150,twist = -20,$fn=200)

will follow the outside of one side of the diagram you gave.
(sizes and angles are no necessary correct, but you should get the idea by looking at the result). Use mirror for the other side.

Unless the faces are a conic section, and my geometry is not up to determining that, I think you are out of luck for what you want. However modelling older manufactured version should be possible, because they would be designed to be created with a from tool moving on a straight path.
Tue Jun 4 2019, 19:20:16
(no subject) (by Marcel)
Yes, using a twisted rectangle instead of a the "scale solution" above would work as well. However, finding the correct parameters for the twist would likely be more difficult or at least involve some trigonometrics.

And yes, the traditional version should be perfectly possible in SolveSpace.

As my problem seems to be unsolveable, is it worth to open an issue in Github for that? I've seen another issue about helix forms that is near to be resolved as it seems. In my humble understanding, this is already very similar to what it needs to solve my issue.
Wed Jun 5 2019, 03:13:10
(no subject) (by Paul)
>> However, finding the correct parameters for the twist would likely be more difficult or at least involve some trigonometrics.

The Helix function for SolveSpace is a work in progress. The surface generation code works, but the UI and solver work has not begun. This thread raises a question about that feature. One way Helix might work is to create a sketch, select a rotation/translation axis (both motions use the same axis) and then drag/constrain the newly created end. Would that be sufficient to do what you're trying here? You would be constraining the twisted/translated end of an extrusion to whatever you need and the solver would figure out the displacement and twist needed to get it there, saving you the trigonometric calculations. Does that seem like it would work for this construction problem? Can you define the axis, or is that unknown too?
Wed Jun 5 2019, 09:49:19
(no subject) (by Andrew)
It is probably better to allow the rotation angle to be specified, as that allow for rotation of more than 360%.
Wed Jun 5 2019, 10:38:34
(no subject) (by Paul)
@Andrew the rotate (repeating) function allows dragging the angle through more than 360 degrees. That's what's used in the new Revolve and you can drag it around through multiple revolutions (though you can't see any difference past 360). Having said that, we talked about having both options for Helix. I just wondered if the feature in that form could create the object desired here with minimal effort.
Wed Jun 5 2019, 14:19:50
(no subject) (by Andrew)
For the joint hirth joint example. The top is a known line, and the start and end angles are know, easily calculated, or even obtained by a reference constraint on the angle. A drag and rotate would work.

Why I mentioned more that 369 rotation is that it is useful for ornamental features, such as twisted Iron work, where more than one rotation in the length is required. Also a rotation extrude that can be sent along a spiral path would be useful. That is a lathe that also extrudes.

OpenScad has linear extrude, with a twist that solves the hirth problem. and a rotation-extrude which is the lath operation. While screw thread and knurls can be modeled in that program, it is painful because they use bit by bit approximations, which are viable because they are created by a program, but which generate hundreds of objects and slow the program down. Spiral extrude would probably best be dealt with by allowing extrude along a circle, and adding a pitch parameter.Drag the circle up to set the length, and have a pitch entry in the group properties.
Wed Jun 5 2019, 15:56:23
(no subject) (by Paul)
You mention a linear extrude with twist, as well as a lathe that translates while going around. I used to think those were different, but the only difference is whether the rotation/translation axis is in the plane of the sketch or perpendicular to it.

I like the idea of doing an extrude and then grabbing the end and twisting it. I also like the idea of specifying a pitch and just extruding to a desired length while the revolutions follow on their own. This is what I'm struggling with - the useful variations in how we might use this, and how to implement them.

There is nothing wrong with programmatic model creation, but that is totally the opposite of the solvespace way ;-) I want to have as much done on-drawing as possible, but it has to behave well. Thoughts on how to do that are most welcome. I think I know what the first try will be..
Wed Jun 5 2019, 18:11:46
UI (by Marcel)
Sorry for responding so late. I am not an UI expert (neither am I experienced with developing a CAD tool), so the question of a useful interface has been on my mind for quite some time.

As far as I understand things, the CAD engine needs the following information to perform a "twisted extrusion"

- base model
- extrusion direction
- extrusion length
- pitch
- rotation point

From this information, only pitch and rotation point are different to an ordinary extrusion. The question is: how can the user conveniently specify the pitch and the rotation point?

The most trivial UI approach would be to let the user directly specify those two dates (I'll call this approach A). There are some benefits with this approach: it should be easier to implement than any other solution and it is "feature complete", which means that any thinkable twisted extrusion is possible (as Andrew said also multiple rotations, like a screw thread).

The downside is, that the user often would have to calculate things "by hand" - something that computers are very good at which is why we normally would want to let them do this. If you take my Hirth Joint example, the calculation is relatively easy but still involves several trigonometric steps (I can post a sketch of the calculation, if you are interested). There might be more sophisticated examples where these calculations would be much harder.

To compensate that, you could add another feature that allows to specify X and Y scale (instead or in addition to pitch). This approach (A1) would be similar to the OpenSCAD solution I posted earlier. Still, for the user things would be more difficult than they would need to be (if they want to calculate everything themselves, they could right away use OpenSCAD and drop SolveSpace).

A different approach (B) is similar to what Paul suggested. An ordinary extrusion can be seen as a special case of a twisted extrusion (precisely an extrusion with pitch=0). So, the extrusion functionality could be extended with a feature to twist the extruded object. One way to map that in the UI would be the following:
1. draw a sketch
2. extrude the sketch
3. Currently, Solvespace would implicitly assume a parallel constraint of the start point of the extrusion (the sketch) and the end point of the extrusion (a "copy" of that sketch). This constraint should be made explicit and visible for the user
4a. The user could remove the parallel constraint of the sketch and its copy and rotate the sketch to twist it. The user would need to specify a rotation point.
4b. The copy of the sketch could be edited, so that not only twisted extrusion but also other transformations are possible. For example, the user could also skew the extrusion with that. However, I don't know if the CAD core of Solvespace would support a "morph" from the original sketch to all the possible operations (e.g. make a hexagon out of a square) a user could do to the copied sketch. One possibility would be that every point in the original sketch must be mapped to a point on the copied sketch and the sequence of all points in the original sketch (po1, po2, po3, ...), must be the same in the copied sketch (pc1, pc2, pc3, ...).

However, it is not entirely clear how to cope with twists bigger than 360 degrees. It would be possible to rotate the sketch two or three times, in order to have multiple twists, but this seems silly. Alternatively a model could consist of multiple twisted sketches, stacked upon each other. For more than two or three rotations (e.g. a screw thread) it would be necessary to add a repeat feature for twisted elements (or extend the existing translated repeat feature).

Finally, I can think of one more approach (C): The wireframe model I posted in this thread before (Hirth Problem.slvs) is very easy to sketch. In principle, this sketch could be enough to explain SolveSpace what the user wants. At least SolveSpace could try to make a body out of a convex wire frame in 3D space. However, this solution would possibly break some of the principles SolveSpace is built upon (I don't actually know if this is the case).

I think approach A/A1 definitely has a legitimation, e.g. when it comes to screw threads. Approach B would be very handy for a lot of other cases. If you go for approach B with bullet point 4b (at least at some point in the distant future) this would come very near to the loft function that other CAD tools offer (actually, I think that would be even better than a regular loft, as the user could precisely control how the loft is done). Approach C would be very convenient for the user, but I don't know if it is possible to combine that with "the parametric CAD way" of modeling.

So finally, I think A should be implemented anyway. In a lot of cases, B would be very useful in addition to A. I am not sure about C, but it might be worth to at least consider and talk about this solution.
Thu Jun 6 2019, 08:45:22
(no subject) (by Andrew)
@The wireframe model I posted in this thread before (Hirth Problem.slvs) is very easy to sketch. In principle, this sketch could be enough to explain SolveSpace what the user wants

It is incomplete as a description as to what is wanted, as different straight line orientations, vertical/horizontal, or diagonal across the frame result in different surfaces. Sketch lines at various orientations on the wire frame and you will see that not all crossing lines intersect each other. Lines at the same angle represent a surface that could be created by say a hot wire cutter and the sketch as guide lines.

For rotations, the number of turns including fractions, or rotation angle could be specified in the properties of the group, or an ability to specify a pitch. Both are useful, as sometimes you know the pitch, and sometimes you know the rotation, and you can only go from one to the other when the length is fixed. I see no harm is allowing the user to select one, or the other.

Sometimes there is no easy graphic way of specifying something, and that is where properties in the property browser are useful, so long as sensible defaults are set.

The hirth joint instance length and rotation could be set by drag and a point constraint, so long as the top line is the axis of rotation, and the constraining point is the other end of the bottom line. The top and bottom lengths are different, with the bottom being longer, and the overhang does not matter when the extrude is the object being subtracted. Use the bottom edge as the axis, and there is no longer a point at the right distance to constrain the rotation.

Stacking single turn objects, by say step translate, is more work, and likely less efficient from the constraints solution and graphics rendering viewpoint, than allow multiple turn, and awkward if n and a bit turns are required, as the bit has to be provides by a separate sketch and extrude.

Also, for a thread type extrusion, there is an occasional need to create it on a solid of revolution that is some form of conic, such a a fusee for a clock. Also, there are occasions for a variable pitch with length, such as extrusion screws for injection molding. These are edge cases, but worthwhile if easily implemented when dealing with the more general case.
Thu Jun 6 2019, 11:18:52
Comment to UI (Marcel) - Pitch (by Geert Hospers)
Marcel said
"As far as I understand things, the CAD engine needs the following information to perform a "twisted extrusion"

- base model
- extrusion direction
- extrusion length
- pitch
- rotation point"

I would like Pitch then to be variable along extrusion direction. Could that be given by a formula?
Fri Jul 5 2019, 06:58:01
Post a reply to this comment:
Your Name:
Your Email:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2018 SolveSpace contributors. Most recent update Nov 22 2018.