Request a Personalized Demo

Learn how to accurately convert your designs with Scan2CAD

  • This field is for validation purposes and should be left unchanged.
  • Join thousands of happy customers worldwide

Repeat commands

 

The following repeat commands are available for use in a Command File.

 

RepeatForRastersInDirectory

Rasters Folder containing raster images to be processed
Vectors Folder where vector files will be stored

2 arguments.

Place this command at the start of a sequence of commands that are to be repeated for all the raster files in the Rasters folder. Place the RepeatEnd command at the end of the repeat sequence.

If any of the SaveVector commands are used within the repeat sequence, the vector files will be saved to the Vectors folder. If no SaveVector commands are used within the repeat sequence, set the Vectors folder to be the same as the Rasters folder.

If any of the SaveRaster commands are used within the repeat sequence, the raster files will be saved to the Rasters folder.

The following commands must not be used within the repeat sequence:

RepeatForRastersInDirectory

RepeatForVectorsInDirectory

BatchByDirectory

LoadRaster (The RepeatForRastersInDirectory command automatically identifies and loads all valid raster files in the Rasters folder.)

LoadVector

SaveAsRaster

SaveAsVector

 

The following example code converts all the raster images in the Rasters folder to vectors and stores the vectors in the Vectors folder:

* Set vectorization settings and OCR settings

* This assumes that all the images you want to convert are similar and that the same

* vectorization settings and OCR settings will suit all the images.

TYPEARCHITECT

OCRSETTINGS

54        

6

10

4

1

0

0

1

1

0

0.7

REPEATFORRASTERSINDIRECTORY

c:\users\username\documents\scan2cadv8\Rasters

c:\users\username\documents\scan2cadv8\Vectors

* Smooth and despeckle

SMOOTH

REMOVESPECKLES

6

* Vectorize

RUNALL

* Save the vectors

SAVEVECTOR

REPEATEND

* Exit Scan2CAD

EXIT

 

The following example code converts all the raster images in the Rasters folder to packbits compressed TIFF files. The TIFF files are stored back into the Rasters folder.

* Note that the Vectors folder is set to the same as the Rasters folder

* because no SaveVector commands are used in the file

REPEATFORRASTERSINDIRECTORY

c:\users\username\documents\scan2cadv8\Rasters

c:\users\username\documents\scan2cadv8\Rasters

* Save as packbits compressed TIFF

SAVERASTERTIFPACKBITS

REPEATEND

* Exit Scan2CAD

EXIT

 

The following example code cleans and rotates all the raster images in the Rasters folder.

* Note that the Vectors folder is set to the same as the Rasters folder

* because no SaveVector commands are used in the file

REPEATFORRASTERSINDIRECTORY

c:\users\username\documents\scan2cadv8\Rasters

c:\users\username\documents\scan2cadv8\Rasters

SMOOTH

ROTATE

-90

REMOVESPECKLES

4

REMOVEHOLES

2

* Save the cleaned raster image

* This command will overwrite the original raster files

SAVERASTER

REPEATEND

* Exit Scan2CAD

EXIT

 

If the Rasters folder contains PDF files, these will be processed as follows:
If the PDF file contains a single raster image, it will be processed in the same way as any other raster file.
If the PDF file contains multiple raster images, only the first raster image within the PDF file will be processed.
If the PDF file contains no raster images, or contains a raster image of a type that Scan2CAD does not support, the Scan2CAD screen will be maximized and an information message will appear. Click OK to continue processing files.

 

RepeatForVectorsInDirectory

Vectors Folder containing vector images to be processed
Rasters Folder where raster files will be stored

2 arguments.

Place this command at the start of a sequence of commands that are to be repeated for all the vector files in the Vectors folder. Place the RepeatEnd command at the end of the repeat sequence.

If any of the SaveRaster commands are used within the repeat sequence, the raster files will be saved to the Rasters folder. If no SaveRaster commands are used within the repeat sequence, set the Rasters folder to be the same as the Vectors folder.

If any of the SaveVector commands are used within the repeat sequence, the vector files will be saved to the Vectors folder.

The following commands must not be used within the repeat sequence:

RepeatForRastersInDirectory

RepeatForVectorsInDirectory

BatchByDirectory

LoadRaster

LoadVector (The RepeatForVectorsInDirectory command automatically identifies and loads all valid vector files in the Vectors folder.)

SaveAsRaster

SaveAsVector

Please note that Scan2CAD only reads those elements in a DXF file that it supports.

 

The following example code converts all the vector files in the Vectors folder to DXF. The DXF files are stored back into the Vectors folder.

* Note that the Rasters folder is set to the same as the Vectors folder

* because no SaveRaster commands are used in the file

REPEATFORVECTORSINDIRECTORY

c:\users\username\documents\scan2cadv8\Vectors

c:\users\username\documents\scan2cadv8\Vectors

* Save as DXF

SAVEVECTORDXF

REPEATEND

* Exit Scan2CAD

EXIT

 

The following example code converts all the vector files in the Vectors folder to BMP files and stores the BMP files in the Rasters folder.

REPEATFORVECTORSINDIRECTORY

c:\users\username\documents\scan2cadv8\Vectors

c:\users\username\documents\scan2cadv8\Rasters

* Rasterize

RASTERIZE1BIT

* Save as raster

* By default rasterized images will be saved as BMP if you use the SaveRaster command

SAVERASTER

REPEATEND

* Exit Scan2CAD

EXIT

 

RepeatEnd

No arguments.

This command ends a repeat sequence started by RepeatForRastersInDirectory or RepeatForVectorsInDirectory.

 

Have questions on this topic? Talk to us