So while it is impossible to do this using only curves at the moment, there are ways to achieve the desired result. I thought I'd share this info just in case someone doesn't actually know any method other than curves, and they're stuck as a result.
Firstly, I made a free addon that automatically converts a mesh into a curve shape with the corners corrected. You can download the .py and install it how you would normally install an addon, or just put it into the text editor and run it.
https://github.com/MrBlubberBut/MoldingFromCurve
However, before you do anything, know that Blender can get this kind of result using 3D curves:
You simply have to bevel all the vertices a fair amount by pressing Shift
Control
B
. There will still be small distortion, and you have to bear the curvy edges instead of the straight ones.
Also worth mentioning that if you only use 2 dimensions for the curve, then just set the curve to 2D and it won't have any distortion either.
But if you need straight corners and multi-dimensional curves, read on.
There are 2 manual ways to do this. The first I will show using the Shear tool.
Using the shear tool
Let's say this is the path you want the mesh to follow:
Take your mesh, extrude to the first point, and then select the face that needs to be sheared. Put your cursor where you want the center of rotation to be and set the transform pivot point to 3D cursor.
Then, shear. The correct value for the shear is as follows:
Say the angle is 50 degrees.
50 / 2 = 25
90 - 25 = 65
Cotangent of 65 degrees = 0.46630765815
This is what you put into the shear.
Then, the second 50 degree angle is already sheared, but once we get to the end, you have to flatten out the face. To do this, simply scale the face by 0.
Without the shear tool
Maybe you use a 3D program that does not have the shear functionality.
If that is the case, then instead of shearing, simply rotate the face, and scale.
Exact steps are as follows:
Once you get to the first point, rotate the face by from where you want the center of rotation to be, and scale along 2 axes by the correct amount.
Here is the math:
Say the angle is 50 degrees.
50 / 2 = 25
Rotate the face by that amount (25).
Secant of 25 degrees = 1.10337791896
Scale along both axes by that amount (1.10337791896).
If you do not scale, but simply rotate, you get this:
As you can see, it's distorted. Which is why we must scale along, in this case, the Y and the Z by the value calculated earlier. Then simply extrude, and if needed, scale the face by 0 on the correct axis to flatten it back out.
The results should be exactly the same using both the techniques. But once again, I made an addon to expedite this process. So use that if you have a lot of this type of task to do. Hopefully in the future Blender will fix the 3D curve feature and automatically correct for this kind of thing so you won't have to do any of this. But for now, I'm pretty sure these are the only solutions.