you don't need the data sized, scaled or otherwise transformed.
Functions
Initialize the GBRUnion Library
You have to start by initializing the library. You set up a pointer to a structure that contains the path to the library along with a handle. In this case the path to the library is: C:\wcad\Gbrunion DLL\artwork
Checking the Return Code
Check the return code and use the function ACS_Gbrunion_GetErrCode to determine the problem. The most likely problem at this stage is failure to check out a license. This may mean: the license files (acs.key and flexlm.lic) are not present or correctly formatted; the license hostid doesn't match the machine's hostid, the license server can't be found or the license server is not issuing a license due to no product available.
Setup the Parameters for Data Extraction
Before you can call the function that returns your polygons you have to set up the parameters using:
int ACS_Gbrunion_Setup (argc, *argv[]);
Basically you prepare a data structure holding what would be command line arguments (as if you were using the executable) and then call the setup function.
Here are our desired control settings:
input file: C:\wcad\GBRUnion DLL\EXAMPLES\icsxceed.gbr
working directory: C:\GBUnion DLL\EXAMPLES\work
number of threads: 4
arc resolution: 45
arc sag: 0.0005
polygon format:leonov
Then our string *argv[], holding the arguments would look like:
"C:\wcad\GBRUnion DLL\EXAMPLES\icsxceed.gbr"
"-wdir:C:\wcad\GBRUnion DLL\EXAMPLES\work"
-thrnum:4
-arcres:45
-arcsag:0.0005
-polyformat:leonov
and argc, the number of arguments = 6
Opening the Gerber File
Now that our parameters are set up we open the Gerber file using the function:
int ACS_GBRUNION_LIB_API ACS_Gbrunion_Open();
The return code should be checked to insure it opened correctly.
Information about the Gerber File
Gerber files come in units of inches and mm and the resolution can vary depending on the source. To obtain the units and data resolution call this function:
void ACS_Gbrunion_GetFileInfo ( ACS_GBRUNION_FileInfo *pFileInfo );
Setup Display of Progress
For large files, extracting and unionizing the polygons might take a while and the user should be notified of the progress of this operation. If you wish to use the built in progress window then do nothing. However if you want to display progress in your own way, then setup a call back function that communicates with the library.
void ACS_Gbrunion_SetProgressCallbackFn( ACSGbrUnionProgressCbFnPtr callbackFnPtr );
Generating the Polygons
Now we can generate our polygons using the function:
int ACS_Gbrunion_GetPolygons ( ACS_GBRUNION_Polygon **ppolylist, int *ppolycnt);
The program will return a list of polygon coordinates and polygon vertex counts. The calling application can now do whatever processing it needs to with this geometric data: sizing, corrections, rasterization and such.
Releasing the Memory
Once you are done with the polygons generated by the library you should release the memory using:
void ACS_Gbrunion_FreePolygons (ACS_GBRUNION_Polygon *polylist, int polycnt);
Closing Up Shop
When the calling application is done with the library, it should be properly closed. Not only does this release the license but it also frees any memory that the DLL allocated.
void ACS_Gbrunion_Close ( );