↑top

FreeCAD: How to create solids from 2D image?

Update: May 22, 2021
FreeCAD 0.19

This section describes how to create a solid from imported image file.

Fig. Original image in PNG format
Original image in PNG format
Fig. Created solids
Created solids

Converting a image from bitmap format to SVG format

If the original image file is in PNG or JPEG format, you must first convert it to SVG format. In the following example, PNG image is converted to SVG image with Inkscape (version 1.02).

  1. Start Inkscape and select [File]-[Import...] from the menu. Select an image file in the file dialog to show an import dialog and click OK button to import the file.

    Fig. Selects [File]-[Import...]
    Selects [File]-[Import...]
    Fig. Import dialog (for PNG format file)
    Import dialog (for PNG format file)
  2. Click the loaded image on window to select it, and select [Path]-[Trace Bitmap...] from the menu. In the displayed "Bitmap Trace" dialog, make sure that "Brightness Boundary" is selected, and then click the OK button. After conversion, close the dialog with the close button in the upper right corner of the window.

    Fig. Selects [Path]-[Trace Bitmap...]
    Selects [Path]-[Trace Bitmap...]
    Fig. 'Trace Bitmap' dialog
    "Trace Bitmap" dialog
  3. With these operation, a vector image that overlaps the original image will be generated. Drag the image from the original image and delete the original image.

  4. Select [File]-[Save As...] from the menu and save the image as an SVG file.

    Fig. Selects [File]-[Save As...]
    Selects [File]-[Save As...]

Importing SVG format image and converting it to solids

The SVG format image file is now ready. Then import this file into FreeCAD and convert it to solids.

Fig. SVG format image
SVG format image
  1. Start FreeCAD and make new documentNew Document icon.

  2. Drag&Drop the SVG format file into 3D view to show import dialog. Select "SVG as geometry (importSVG)" and click Select button to import the file.

    Fig. Import dialog for SVG format file
    Import dialog for SVG format file
    Fig. Imported shape
    Imported shape
  3. Switch workbench to Part workbenchWorkbench_Part and select all item on model tree and extrudePart_Extrude them. In the dialog for extruding, select "Custom direction" and set the direction to (0, 0, 1). Then set "Length" to 10 mm and click OK to extrude.

    Fig. Dialog for extruding
    Dialog for extruding
    Fig. Extrusion result
    Extrusion result
  4. We get the created solids into a solid. Select all item on model tree and apply boolean operation (Fuse)Part_Fuse. Then set shape color to (204, 204, 204) at View tab of Combo view.

    Fig. Result of Fuse
    Result of Fuse
    Fig. Sets shape color
    Sets shape color

We have now created solids from the image.