The overall goal is to create a print of the liberty bell. No clapper is needed. The support beam is not needed. I am just looking to mimic the outside shape of the bell. After an application of Google-fu I found this image. It has been cleaned up and cropped a bit.

enter image description here

In OpenScad the surface function was applied to the png to generate a height model. I subtracted out a few cubes, and eventually got it down to a layer of about .1 height.

My Evil (pun intended) plan is to get it down to a 2d model. Then by shifting a copy of model from itself, and subtracting the two. That should leave just the curve. Then rotate_extrude the curve to generate the actual bell at the desired thickness.

I see the problem coming. If the model is layered down to zero height it will vanish. Leaving me nothing to rotate.

So on to the question.

Is there any tool or technique to turn the image into a 2d openscad object or failing that is there another way to approach the problem?

The direction that fred pointed me at is viable. I didn't use the actual image shown here, but a manually generated one from OpenScad. As a proof of concept the technique works well.

  • 2
    $\begingroup$ This sounds like what you're asking for is a 2D drawing file of a 3D part in a given plane? If so, Solidworks, Solid Edge, and Autocad are all fantastic at this, not sure about OpenSCAD though. $\endgroup$
    – Diesel
    Apr 16 '17 at 18:45

As you are already familiar with OpenSCAD, consider to use the projection() function to accomplish your goal.

If you allow for an interpretation that one can cast a shadow of the part on a surface below, it becomes a 2D representation of the part. This is effectively how projection works in OpenSCAD.

Note that the part image below is centered in x, y, z and the cut/projection action takes place at the z = 0 plane:

sample model image

When the function is applied to this model, the result is a non-contiguous 2d image:

projected cut image

When the cut parameter is ignored or set to false, the image which results is effectively an orthogonal shadow of the entire object, rather than a selected slice:

flat shadow image

It gets better, of course. In OpenSCAD, the translate, rotate and scale functions apply. One can tip a model over, resize it, spin it around, combine with the cut parameter and get any combination of 2d image from the original model:

rotated model image

shadow rotated model

It's important to note that OpenSCAD does provide non-zero thickness to these projections when rendered, or maybe when previewed. I always get those two swapped around. As your objective is a 2D result, you may be able to select from PNG (save as image) or Export as DXF or SVG.

Re-reading your post, I also missed part of a more useful answer. Once you have the profile you desire, you can use the rotate_extrude function on the profile you generate. Despite the non-zero thickness, it uses the zero-thickness aspect to create the model from that function.

That aspect of the answer is left as an exercise for the reader, as the options are many and results can be complex.

  • $\begingroup$ Clearly it is time to review all of the open scad functions. $\endgroup$
    – EvilTeach
    Apr 16 '17 at 18:39

Two options:

  1. Use TRACE2SCAD (http://aggregate.org/MAKE/TRACE2SCAD)
  2. For the more adventurous: Dig up the old pull-request for the suggested trace() module: https://github.com/openscad/openscad/pull/1110
  • $\begingroup$ Thank you Marius. I will be taking a look at trace2scad as another arrow in my quiver. $\endgroup$
    – EvilTeach
    Apr 16 '17 at 20:08

You could have done that with OpenSCAD, there are instructions for extruding.

Personally, I'd just do a 1 altitude copy with Image 2 STL 2 Heightmap Mesh Converter Generator, then rotate in OpenSCAD. It's called rotate_extrude() and is used for seashells.

In MeshLab you can use Laplacian Smooth to depixelate/antialias it.

  • $\begingroup$ interesting. I did the whole thing in openscad. $\endgroup$
    – EvilTeach
    Apr 18 '17 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.