web_header.gif

GBRUnion DLL Functions

ACS_Gbrunion_Init

Syntax

int ACS_Gbrunion_Init (GBRUNION_INIT_STRUCT *ptr);

Description

This function is called to initialize the DLL. It should be the first function called. This function checks out the license. Failure to obtain a license is a common reason for this function to fail.

Arguments

GBRUNION_INIT_STRUCT *ptr -- executable path and window handle
                             to window of program's dialog

Return

0       : success
nonzero : failure

Data Structure

typedef struct
{
  char execPath[_MAX_PATH]; -- executable path to gbrunion.dll
  void *vParent;            -- handle to program dialog using gbrunion.dll
}GBRUNION_INIT_STRUCT;



ACS_Gbrunion_Setup

Syntax

int ACS_Gbrunion_Setu (argc, *argv[]);

Description

This function is called to define command line options. This should be called before ACS_Gbrunion_Open

Arguments

argc       -- Argumment count

*argv[]    -- Argument list

Return

0       : success
nonzero : failure



ACS_Gbrunion_Open

Syntax

int  ACS_GBRUNION_LIB_API ACS_Gbrunion_Open();

Description

Unionizes and places the unionized polygon coordinates into an internal database.

Arguments

None

Return


0       : success
nonzero : failure




ACS_Gbrunion_GetFileInfo

Syntax

void ACS_Gbrunion_GetFileInfo ( ACS_GBRUNION_FileInfo *pFileInfo );

Description

Contains information about the internal database's units after importing and unionizing the Gerber data. (INCHES or MM) and the resolution. Typically a Gerber file is either in INCHES or MM and because of the union operation a Gerber file with 4 places of accuracy will be converted internally into a database with more precision. . It may only be called after ACS_Gbrunion_Open

Arguments

ACS_GBRUNION_FileInfo *pFileInfo   --  pointer to a data structure

Return

None

Data Structure

typedef struct
{
  char libname[_MAX_PATH];  -- internal name generated from opening input Gerber file
  char unit[32];            -- units of input Gerber file
  int  igrid;               -- integer grid of input Gerber file
} ACS_GBRUNION_FileInfo;



ACS_Gbrunion_GetPolygons

Syntax

int ACS_Gbrunion_GetPolygons ( ACS_GBRUNION_Polygon **ppolylist, int *ppolycnt);

Description

Generates a list of unionized polygons and returns a list of polygons. May only be called after ACS_Gbrunion_Open.

Arguments

ACS_GBRUNION_Polygon **ppolylist --  returned list of polygons which may or
                                     may not contain holes.
                                       

int *ppolycnt                    -- returned polygon count

Return


0       : success
nonzero : failure

Data Structure Details

Each polygon (or Leonov polygon) in the list will use this structure:

typedef struct
{
  int    Layer;             -- required for embedding level output
  int    VSize;             -- 5 if circular ON, 2 if not
  int    VCnt;              -- Vertex count of single or container polygon
  double *XY;               -- XY data of single or container polygon
  int    HoleCnt;           -- Number of holes in container polygon
  int    *HoleVCnts;        -- list of vertex counts for each contained hole
  double **HoleXYs;         -- list of XY data for each contained hole
} ACS_GBRUNION_Polygon;

Vsize - indicates vertex data size. If 2, each XY point is described by 2 data elements. If 5, then a polygon contains circular data (i.e. arcs) and each vertex requires 5 elements as described below:

- [0] Starting Point X
- [1] Starting Point Y
- [2] Center X
- [3] Center Y
- [4] Radius : if Radius is 0, then it is NOT an ARC 

Note that a polygon with circular data can be a circle or a polygon with arcs. The value of the radius defines:

radius > 0   clockwise arc
radius < 0   counter-clockwise arc
radius = 0   line segment

Detailed Illustration




ACS_Gbrunion_FreePolygons

Syntax

void ACS_Gbrunion_FreePolygons (ACS_GBRUNION_Polygon *polylist, int polycnt); 

Description

Frees memory allocated to list created by ACS_Gbrunion_GetPolygons.

Arguments


ACS_GBRUNION_Polygon *polylist -- list of polygons generated by
                                  ACS_Gbrunion_GetPolygons

int polycnt -- polygon count of list of polygons generated by
               ACS_Gbrunion_GetPolygons

Return

None




ACS_Gbrunion_SetProgressCallbackFn

Syntax

void ACS_Gbrunion_SetProgressCallbackFn( ACSGbrUnionProgressCbFnPtr callbackFnPtr );

Description

Called to set call back function which is to process progress information provided by the GbrUnion DLL. If not called, a the DLL will display its own dialog showing the progress. Call this prior to ACS_Gbrunion_Open.

Argument

ACSGbrUnionProgressCbFnPtr callbackFnPtr -- pointer to user defined function to be 
                                            used for display progress



ACS_Gbrunion_GetErrCode

Syntax

void ACS_Gbrunion_GetErrCode (ACS_GBRUNION_ErrorStruct *pError);

Description

Call this when you get a non zero return code from other functions in order to obtain details about the nature of the failure.

Argument

ACS_GBRUNION_ErrorStruct *pError -- returned error code and associated error text message

Data Structure

typedef struct
{
  int errcode;              -- error code set from function returning error
  char msg[8192];           -- error message set from function returning error
} ACS_GBRUNION_ErrorStruct;



ACS_Gbrunion_Close

Syntax

void ACS_Gbrunion_Close ( );

Description

Called after use of this DLL is done. Releases the license and releases any memory that it allocated.

Arguments

None

Return

None