There are many different ways to generate 3D geometry from 2-dimensional or planar objects such as those shown in your image, depending on the result that you desire.
For example, given an arbitrary centreline:

You can extrude the centreline perpendicular to the plane of the geometry to yield an extruded 3D solid:

Alternatively, you can first offset the centreline to both sides in the same plane by a given amount:

...and then extrude both offsets perpendicular to the plane, before performing a boolean operation to subtract the central solid from the outer solid, yielding the following result:

But note that you are not limited to an extrusion operation perpendicular to the plane of the centreline, for example, you could alternatively construct an arbitrary closed profile, such as the circle in the following example:

...and then sweep the profile along the centreline to obtain a 3D solid:

Finally, you could even revolve the centreline about an arbitrary axis, by an arbitrary angle, to yield a 3D solid such as the following demonstrates:

All of the above were generated using AutoCAD.