This example uses nanoCAD Raster to trace contours from a scanned winter wind protection map and use them as the basis of a surface.
Many drawing archives are still on paper. Lines fade, colors change, and sheets deform in storage. Scanning can introduce skew or stretching, while uneven backgrounds make faint linework harder to distinguish.
The Raster module includes tools for correcting these problems directly in the drawing.
Raster is a raster image editor and vectorizer that runs on nanoCAD Platform. Its tools range from simple image adjustments to selective tracing of complex linework.
We’ll crop and clean the map, trace its contours, and assign elevations to the resulting polylines. The example illustrates both interactive tracing and automatic text recognition.
The source map is a TIFF. The Raster module also supports .tif, .tiff, .bmp, .jpg, .jpeg, .png, .pcx, .gif, and .ecw files.
1. Use IMAGEATTACH to attach the source image to a DWG drawing.
Set the insertion point to 0,0,0 and click OK.
2. Only part of the image contains the contours we need. Crop it with CROPBYRECT.
3. Convert the color image to monochrome for tracing. In the Binarization dialog, use the Range tab to isolate the features you want to keep.
Choose Pick Color and sample the contour lines in model space. Sample several locations to account for variations in the scan. The preview updates as you work.
If you sample the wrong color, remove it with Remove Color. Click Apply when the preview looks right. The monochrome image lies directly over the original. Select the color image and move it aside with MOVE.
4. Features drawn in the same color as the contours may survive binarization. Use the Trace command in Erase Raster mode to remove them manually.
Erase the unwanted marks while preserving the contours.
Raster offers automatic and semiautomatic vectorization. Automatic conversion applies your settings across the image. Interactive tracing gives you control over the path of an individual vector. Here we’ll trace contour polylines onto layer 0, then use automatic recognition to place the labels on a separate Text layer.
5. Run R2VSetup to configure the conversion.
On the Recognition tab of the R2V conversion options, select Polylines and Text Areas [OCR]. Polylines make it easier to edit the contours after tracing.
Adjust the tracing settings on the Options tab.
On the Trace tab, enable automatic vector extension. On the Texts tab, allow arbitrary text orientation, text overlapping graphics, and isolated characters. Set the output text height to 0.2, approximately the height in the scan. Add the %D pattern to recognize digits only.
6. In the Trace window, enable the mode that creates vectors and erases the corresponding raster linework. Choose Trace Polylines and pick one contour at a time. Press Enter to finish each object. If tracing follows the wrong branch, use Back_step to undo the last segment.
Use Draw_Segment to bridge gaps. Each contour needs to be continuous.
7. Run QSELECT to select all the polylines. In Properties, set Global Width to 0.
8. Copy the scanned image and move the copy aside to inspect what remains after tracing. Some isolated marks are still visible.
Use SpeckleRemover to remove those marks.
Use the maximum-size measurement tool to sample the largest speck you want to remove. Apply that threshold to the image and erase any remaining marks manually.
Run R2VSetup again and select only Text Areas [OCR] on the Recognition tab. Check rotated numbers carefully, as OCR may misread them.
Select the image and run R2VConvertor. Correct any misread characters manually. If the text is missing altogether, proceed to the next step.
10. Run STYLE and set the default text style to Standard. Use RTEXTEDITCMD for text that OCR missed.
Remove the raster images when the linework and labels are complete.
11. Set each contour polyline’s Elevation property to its correct elevation.
The contours are now vector geometry with elevations. All of the image preparation and tracing took place inside nanoCAD.
This example covers the Raster tools most relevant to scanned maps. The module’s online help describes the other image editing and recognition tools.


