Introduction
The ODB++2GBR translator is supplied as a library. The API for the library is shown below.
This call is used to initialize the library. It is mandatory and is always the first call made when using the library. This function also makes several checks to insure that the ODB++ structure is valid by checking for the presence of the matrix folder/file, step folders and layer folders.
int ACS_openODB ( char * odbName, char * workingDir, struct ODB_InputParam * odbInitPtr );
Arguments
name of the odb file/structure (the library can read a compressed tgz file or if a path name is supplied this is assumed to be the top of the job directory hierarchy)
workingDirIf not NULL and 'workingDir' is a valid path this will be set as the working directory; if NULL or invalid, the working dir will be set to the value of the TEMP, TMP or TMPDIR environment variable (whichever is found first in their respective order); if the working_dir cannot be set, this function will fail.
odbInitPtrthis is a reserved param; its elements are:
ExecPath: the executable path
argc: number of additional arguments
argv: list of additional arguments.
The possible additional args are:
-dbg
turns on additional debug data recorded to the log file
-keep_tmpfiles
keeps intermmediate files instead of cleaning them up upon closing
-thrnum:<thrnum_int_val>
sets the max number of concurrent threads
Return Values
0=successful; 1=fail
Returns the path of the output directory.
char * ACS_getODBWorkingDir();
Return Values
string containing the path of the output directory
null if fail
This is used to determine what the library considers to be the working directory. Note that the working directory is often specified when opening the library; however it is allowable not to specify the working dir when opening the library and in such a case one would want to know where the library considers its working dir to be located.
char * ACS_getODBWorkingDir();
Return Values
string containing the path of the working directory
null if fail
This function is used to get the most recent error generated by the library. The callling program would do this in order to display an error message for the end user or to take some sort of action when an error is encountered.
char * ACS_getODBLastErr(int * errCode);
Arguments
errCode the error code for the last error message thrown by the library or 0 if there is none.Returns
the last error message and its associated error code
NULL if there is none.
Used to find out the number of "steppings" present in the ODB++ file.
int ACS_getODBStepCount();
Returns
the number of steps in the ODB or -1 if it failed
a detailed list of the steps present in the ODB++ file; stepList[0] will be set to the first array element in stepList; stepCount will be set to the number of steps in stepList
int ACS_getODBStepInfoList (ODB_StepInfo ** stepList, int * stepCount);
Arguments
Returns
0=successful; 1=fail
stepList must be freed after it is no longer needed
Returns the name of the step when provided with the step's index.
char * ACS_getODBStepName(int stepIdx);
Return
Either the step's name or NULL if the call fails.
Returns the index of the step when provided with the step's name.
int ACS_getODBStepindex(char * stepName);
Returns
the step's index in stepList or -1 if the call fails
This call examine's the step's profile (which is one or more polygons) and generates the extents from that information. It appears that not all steps have a profile so this call should be used carefully. However if the profile is present the amount of computation using this call should be much faster than the calls that run through the entire database to calculate the data extents.
int ACS_getODBStepNameProfileExtent (char * stepName, double * extent);
Arguments
stepName - the name of the step for which the calling program wishes to obtain data extents
extent - Xmin, Xmax, Ymin and Ymax coordinates.
Return
0=success; 1=fail
This call examine's the step's profile (which is one or more polygons) and generates the extents from that information. It appears that not all steps have a profile so this call should be used carefully. However if the profile is present the amount of computation using this call should be much faster than the calls that run through the entire database to calculate the data extents.
int ACS_getODBStepIdxProfileExtent (int stepIdx, double * extent);
Arguments
stepIdx - the index ID of the step for which the calling program wishes to obtain data extents
extent - Xmin, Xmax, Ymin and Ymax coordinates.
Return
0=success; 1=fail
Use to determine the number of layers in this ODB++ file.
int ACS_getODBLayerCount();
Returns:
the number of layers in the ODB
Use to obtain a list of layers and the number of layers in the ODB++ database.
int ACS_getODBLayerInfoList (struct ODB_LayerInfo ** layerList, int * layerCount );
Arguments
ODB_LayerInfo - the data structure to contain the layer information
layerList - the list of layers
layerCount - number of layers
Returns
0=success; 1=fail
layerList[0] will be set to the first array element in layerList
layerCount will be set to the number of layers in layerList
The data structure layerList should be freed after it is no longer needed
Returns the name of the specified layer.
char * ACS_getODBLayerName(int layerIdx);
Arguments
layerIdx - layer's index in layerList (starts with 0)
the layer name or NULL if it failed
Returns the index of the specified layer
int ACS_getODBLayerIndex(char * layerName);
Arguments
layerIdx - layer's index in layerList (starts with 0)
Returns
the layer's index in layerList or -1 if it failed
Returns a list of all the user defined symbols in the ODB.
int ACS_getODBSymbolInfoList ( struct ODB_SymbolInfo ** symbolList, int * symbolCount );
Arguments
ODB_SymbolInfo - data structure containing
symbolList
symbolCount - integer holding the number of symbols in the list
Returns
0=success
1=failure
symbolList[0] will be set to the first array element in symbolList
symbolCount will be set to the number of symbols in symbolList
**NOTE
symbolList must be freed after it is no longer needed
Returns a string of the ODB info for the specified step/layerlist combination.
char * ACS_printODBTree ( char * stepName, char ** layerList, int layernum, int traverse );
where
Name/Rule Combinations
Return: 0=success; 1= fail
Returns the ODB info for the specified step/layerlist combination.
int ACS_getODBInfo (char * stepName, char * layerList[], int layernum, struct ODB_StepInfo * stepInfo );
Arguments
Step/Layer Combinations
Return:
0=success; 1= fail
stepInfo will be set to the ODB_StepInfo of the specified step
stepInfo will contain step_index, extent, profile extent and a list of ODB_LayerInfo (as specified).
each layerInfo in stepInfo will contain layer_name, layer_index, context, type, extent, polarity, startname, endname, addtype, color
Converts the ODB and creates a file for each of the step/layerlist combination.
int ACS_convertODBInput ( char * stepName, char ** layerList, int layernum, char * outputName, int argc, char ** argv );
Arguments
stepName step's name
layerList list of layer names
outputName output path and filename
If no full path, output will be placed in the working directory; if there are several output layers, then the layer name and number will be appended to the output.
argc number of additional arguments
argv list of additional arguments. The possible additional args are:
-unit:<inch or mm> set the unit of conversion
-scale:<scale_dbl_val> set the scale of conversion
-arcres:<res_dbl_val> set the arcres of conversion
-arcsag:<sag_dbl_val> set the arcsag of conversion
-odb_symbols keep the user defined symbols as a macro
-step_repeat enable step repeat command in Gerber output
Step/Layer Combinations
Return:
closeODB - Closes the ODB internal database and cleans up.
int ACS_closeODB();
Returns