Stand alone program for direct conversion from Pattern Exchange to CADmatic III/IV/V (recursive)
● To install - copy the cadlink.exe program to the required location
● Check the CADlink security key is plugged in
The format of the command line for CADlink is:-
cadlink filename [destination] [/options]
filename - argument to specify the input file(s) (e.g. c:\V12\import\week1.ptx )
Input files are Pattern exchange files (.ptx .mdb)
Wildcards can be included (e.g. c:\v12import\*.mdb)
If only name and extension are used (e.g. week3.ptx)program assumes current directory as the location
If including a path do not use the relative path format (e.g. ..\)
[ ] - indicates an optional value or argument
Maximum length for filename: 150 characters - within this the name has a maximum length of 50 characters (e.g. c:\v12import\job325-exchangefile-01.ptx )
There are several different types of path:-
Mapped drive c:\v12user1
UNC (Universal naming convention) \\mainsrv\N\v11user1
Relative path ..\V12user1
The program and most dialogs for paths support all these types of path specification. There are restrictions on the overall length of the path and some characters are not allowed in path names.
Paths can include spaces and dots.
\\Testbed09\os (c)\V12\v12exe
destination - argument to specify the path where .saw files are created (e.g. c:\cadv40\data\saw)
Specify path only
Trailing '\' is not required
If no destination is specified the same directory as the input files is assumed
Do not use the relative path format (e.g. ..\)
Program creates path specified if it does not exist
Maximum length for destination: 150 characters
Destination argument is optional
options - settings to control Cadlink operation.
Only specify the options required (if any).
/BACKGROUND[:n]
/DELETE
/HIDE
/RESULT=[path]
/INF=[n-m]
/UDI=[n-m]
/IMPORT_CPOUT=[filename]
/CAD3
/CAD3R
/CAD4
/CAD5
[ ] - indicates an optional value or argument
The following can also be used as an alternative to the filename and destination arguments.
/FILENAME=filename
/DESTINATION=destination
See below for full details for each option.
Example
cadlink c:\v11import\week1.ptx c:\cadv40\data\saw /BACKGROUND:10 /DELETE
Note
If no options are used program looks for '*.ptx' in the current working directory. This allows the program to run just by double-clicking in Windows Explorer.
*.* is allowed - this means *.ptx and *.mdb
CADlink initialisation errors
Irrespective of foreground / background mode, the program must pass certain tests before it can begin processing files. If these tests fail the program terminates with one of the following (negative) exit codes.
-1 No security key
-2 Access denied to source path (read)
-3 Access denied to destination path (write)
-4 Program initialisation error
CADlink error return / result files
When converting a single pattern exchange file CADlink returns the result in the program exit code. The exit code is zero for a successful import or non zero to indicate an error.
If a wildcard is used (e.g. *.ptx) then for each pattern exchange file which matches the wildcard pattern the program creates a result file (<ptx name>.rlt).
A result file is created even if an import is successful.
If all imports are successful, the program exits with code zero otherwise the exit code is the first error encountered. Pattern exchange files which already have a result file in the destination path are ignored.
If the program is running in background mode result files are always created / checked since the program has no exit code. The existence of the .rlt file prevents the program from continuously importing a bad pattern exchange file.
The result file (.rlt) contains three lines as follows:
ASCII PTX
[error number]
[field number]
[line number]
MDB PTX
[error number]
[field number]
[table name]
Successful imports have zeros on all three lines. A line number or table name may not always be applicable, in which case these fields will be zero.
List of error numbers
-1 - No security key (or incorrect modules for mode)
-2 - Access denied to source path (read)
-3 - Access denied to destination path (write)
-4 - Program initialisation error
0 - Import successful
1 - File not found
2 - Bad format
3 - Too many jobs
4 - Duplicate jobs
5 - Too many part types
6 - Too many board types
7 - Too many patterns
8 - Too many cuts
9 - Illegal part index
10 - Illegal board index
11 - Illegal pattern index
12 - Illegal cut index
13 - Illegal Offcut index
14 - Cadplan - Too many parts to optimise
15 - Cadplan - Too many boards to optimise
16 - Cadplan - Optimiser fatal error
17 - Illegal material index
18 - CADmatic 3 - Job name not valid (contains spaces or > 8 chrs)
19 - CADmatic 3 - Part, board or material code too long (> 25 chrs)
20 - CADmatic 3 - Illegal pattern type (no templates allowed)
21 - CADmatic 3 - Illegal recuts. Pattern number in field value
Job naming / multiple jobs
The PTX format allows for multiple jobs so more than one .saw file may be created. Job names are listed in the JOBS record and these names are used to name the saw files.
Note - the program does not attempt to split runs for the saw.
Options
Input files (/FILENAME)
Full path to the input file(s). Format is:-
/FILENAME=filename
e.g.
/FILENAME=c:\V12\import\week1.ptx
Format and restrictions the same as the filename argument (see above)
Input files (/IMPORT_CPOUT)
Use CPOUT files as the input files rather than PTX
Examples:
cadlink /IMPORT_CPOUT CPOUT.*
cadlink /IMPORT_CPOUT *.cpo
When the CPOUT naming convention is used (cpout.nnn or cpout.nnnnn), the result (.rlt) and .saw files are named after the extension.
For example:
CPOUT.005 à 005.rlt, 005.saw
Location for .saw files (/DESTINATION)
Location where .saw files are created. Format is:-
/DESTINATION=destination
e.g.
/DESTINATION=c:\cadv40\data\saw
Format and restrictions the same as the destination argument (see above)
CADmatic 3 saw files mode (/CAD3 or /CAD3R)
Mode to produce either CAD3 or CAD3R saw files rather than the default CAD4 saw files
Examples:
cadlink /CAD3 *.ptx
cadlink /CAD3R *.ptx
Additional errors may occur in the result file (.rlt) when exporting to Cadmatic 3 formats.
CADmatic 4 saw files mode (/CAD4)
Mode to produce Cadmatic 4 format saw files (note that if no mode is entered the program uses this mode as the default)
Examples:
cadlink /CAD4 *.ptx
CADmatic 5 saw files mode (/CAD5)
Mode to produce Cadmatic 5 format saw files
Examples:
cadlink /CAD5 *.ptx
Upper case output filename (/UPPERCASE)
This option forces CADmatic .saw files to be created with UPPER case filenames (including extension) to ensure compatibility with older systems.
Background mode (/BACKGROUND)
In this mode the program does not terminate. It periodically checks the specified path for PTX files which match and automatically converts new files as they are found. To ensure that Cadlink does not consume too much of the processor time there is a configurable 'sleep' time between checks (n seconds). Format is:-
/BACKGROUND[:n]
e.g.
/BACKGROUND
/BACKGROUND:10
If no value follows the /BACKGROUND option the program assumes a default of 5 seconds.
Delete (/DELETE)
Delete successfully imported PTX files. Format is:-
/DELETE
e.g.
/DELETE
This option also deletes any results (rlt) files matching the pattern exchange files.
Results file (/RESULT)
Specify the location for the results (.rlt) file(s). Format is:-
/RESULT=[path]
e.g.
/RESULT
/RESULT=c:\ResultsFiles
If this option is not set the results files are created in the same location as the input files. If the option is set but no path is specified this forces the program to create results files (in the same location as the Input files).
Note - where a single named file is imported the results file is not automatically created as the results are returned in the exit codes (see above).
Run hidden (/HIDE)
Running Cadlink with the /HIDE option runs the program in hidden mode. If Cadlink is also running in background mode (/BACKGROUND) then it can only be terminated via the Windows Task Manager. Format is:-
/HIDE
e.g.
/HIDE
Order and range of information boxes (/INF /UDI)
The pattern exchange format has two forms of part information box:
PARTS_UDI = 60 user defined information boxes
PARTS_INF = 28 fixed fields of information
When the program imports the PTX, information box parameters allow the fields in PARTS_INF to be directed to nominated information boxes. These then take precedence over fields in the PARTS_UDI which would otherwise populate that box.
CADlink does not have the information box settings required to map PARTS_INF fields to specific information boxes. Instead this is done by the following options.
/INF=n-m
/UDI=n-m
Where n=1st field, m = last field
Note - these options also appear in cadlink.ini
The relative order of these commands is important, whether they appear in the .ini file or on the command line. They can be mixed with other arguments but if /INF comes before /UDI then this dictates the order in the final information boxes in the .SAW file.
The internal default is /UDI /INF, so this results in 60 PARTS_UDI fields followed by 28 PARTS_INF.
Note - if no options are specified this results in 60 PARTS_UDI fields followed by 28 PARTS_INF
Examples for /INF and /UDI
/INF /UDI - all 28 PARTS_INF followed by all PARTS_UDI (88 boxes in total)
/INF - all 28 PARTS_INF, no PARTS_UDI
/INF=1-10 /UDI=5-60 - first 10 PARTS_INF followed by PARTS_UDI fields 5-60 (65 boxes in total)
/INF=9 /UDI - PARTS_INF field 9 (only) followed by all PARTS_UDI (61 boxes in total)
Unicode
Use the "/UNICODE=" option in the Cadlink.ini file or as a command line argument to configure the generation of Unicode files. Valid settings are "UTF8" and "UTF16LE".
e.g.
/UNICODE=UTF8
/UNICODE=UTF16LE
Allow options to be entered in CADlink.ini
As an alternative to running with command-line arguments the options can be set up in a file: CADlink.ini. This feature allows CADlink to run from Windows Explorer.
If the program finds CADlink.ini in the program directory (folder containing CADlink.exe), it ignores any command-line options and uses this instead.
Lines in the file are identified by the relevant option keyword (e.g. /FILENAME) and can be in any order.
Each option must occupy a different line in the file.
/FILENAME=filename
/DESTINATION=destination
/BACKGROUND[:n]
/DELETE
/HIDE
/RESULT=[path]
/INF=[n-m]
/UDI=[n-m]
An example CADlink.ini file is shown below:
/FILENAME=c:\import\*.*
/DESTINATION=z:\cadpool\online
/BACKGROUND:15
/DELETE
/HIDE
Notes
Passing supplementary optimising, saw, and destacking parameters to the .saw file
Only a few parameters are given in the .ptx file format (mainly in the MATERIALS record). These are passed directly to the Cadmatic in the .saw file but the saw controller may need additional optimising, saw, and destacking parameters in order to obtain finer control over the cutting patterns and destacking functions.
To facilitate this, if optimising, saw and material parameter filenames are specified in the PTX file, the program searches for these files in the program directory (the folder containing CADlink.exe). Values from these files are passed to the .saw file.
If no parameters are specified in the PTX (the files do not exist or fail to be read) default values are used.
Parameters in the PTX take precedence over supplementary parameters.
Similarly the program attempts to read destacking parameters from the program directory if they are available.
File type Extension / name
Optimising parameters .prm
Saw parameters .spm
Material parameters .mpm
Destacking parameters mdestack.ctl (metric) idestack.ctl (inches)
Supported keys
CADlink can run with the CADplan key. The full list of supported keys is therefore: CADlink, CADplan, Modular and Master keys. Single keys or network keys are supported.
CADplan options
Options for the CADlink program that are only used for CADplan are not covered in this topic.
Tension trims
Specify rip tension trims by using function code '81' in the CUTS record of a PTX file. The dimension specified in these records represents the tension trim dimension (less saw blade thickness) output to the CAD4 SAW file.
e.g. saw blade thickness = 4.8mm, overall width of tension trim = 30mm
CUTS, 1, 1, 1, 0, 0,2550.0, 0, 0, 0,MAIN
CUTS, 1, 1, 2, 5,91, 5.2, 0, 0, 0
CUTS, 1, 1, 3, 5, 1, 725.0, 1, 0, 0,RIP
CUTS, 1, 1, 4, 11,92, 5.2, 0, 0, 0
CUTS, 1, 1, 5, 10, 2,1200.0, 2, 1, 2
CUTS, 1, 1, 6, 9,92, 130.4, 1, 0, 0
CUTS, 1, 1, 7, 4, 1, 20.4, 1, 0, 0,TENSION TRIM
CUTS, 1, 1, 8, 3, 1, 600.0, 1, 0, 0,RIP
CUTS, 1, 1, 9, 8,92, 5.2, 0, 0, 0
CUTS, 1, 1, 10, 7, 2,1250.0, 2, 2, 2
CUTS, 1, 1, 11, 6,92, 30.4, 1, 0, 0
CUTS, 1, 1, 12, 2, 1, 20.4, 1, 0, 0,TENSION TRIM
CUTS, 1, 1, 13, 1,91, 130.0, 1, 0, 0
- If any stand alone commands are to be run directly from the Auxiliary menu, Automatic command files, Saw transfer (program name) or Machining transfer (post transfer program) areas of the software then any equals sign "=" should be replaced with a colon ":".