CAM Library
API Reference
Add Functions

Available Add Functions used by CAM Library. More...

Functions

int camlib_Add_Polygon (int nLayer)
 Add a Polygon to the active cell. May be used after camlib_ActivateCell and Point Array Functions. More...
 
int camlib_Add_Line (int nLayer)
 Add a 0-Width Line to the active cell. May be used after camlib_ActivateCell and Point Array Functions. More...
 
int camlib_Add_Path (int nLayer, float fWidth, int nPathType)
 Add a Path to the active cell. May be used after camlib_ActivateCell and Point Array Functions. More...
 
int camlib_Add_Arc (int nLayer, float sx, float sy, float ex, float ey, float cx, float cy, int dir, float fWidth)
 Add an Arc path to the active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Text (int nLayer, char *textvalue, char *textstyle, float x, float y, float height, float angle, int mirror, char *align)
 Add Text to the active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Flash (int nLayer, float x, float y, int dcode)
 Add a flashed Pad to active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Flash_Circle (int nLayer, float x, float y, float od, float id)
 Add a flashed Circle or Donut Pad to active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Flash_Rectangle (int nLayer, float x, float y, float width, float height, float corner_radius, float angle)
 Add a flashed Rectangle Pad to active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Component (char *part_side, float x, float y, float width, float height, float angle, char *ref_des, char *part_name, char *part_description, float part_height)
 Add a Component to active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_Insert (char *insertname, float x, float y, float angle, int mirror, int rows, int cols, float rowdist, float coldist)
 Add an Insert to active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_SetCompositeLevel (int nCompositeLevel)
 Set active composite level to newly added figures. May be used after camlib_ActivateCell. More...
 
int camlib_Add_SetPurpose (int nPurpose)
 Set active purpose number to newly added figures. May be used after camlib_ActivateCell. More...
 
int camlib_Add_NC_Drill (int nLayer, float x, float y, float diameter, int plated)
 Add NC drill hit to the active cell. May be used after camlib_ActivateCell. More...
 
int camlib_Add_NC_Rout (int nLayer, float diameter)
 Add a Rout path to the active cell. May be used after camlib_ActivateCell and Point Array Functions. More...
 

Detailed Description

Available Add Functions used by CAM Library.

Function Documentation

◆ camlib_Add_Arc()

int camlib_Add_Arc ( int  nLayer,
float  sx,
float  sy,
float  ex,
float  ey,
float  cx,
float  cy,
int  dir,
float  fWidth 
)

Add an Arc path to the active cell. May be used after camlib_ActivateCell.

Parameters
nLayerLayer number to place Arc path.
sxStart point of arc (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
syStart point of arc (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
exEnd point of arc (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
eyEnd point of arc (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
cxCenter point of arc (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
cyCenter point of arc (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
dirDirection of arc. Direction Type, CAM_ArcDirectionType
fWidthWitdh of path (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Clockwise Arc with start point of 0,0; End Point of 1,1; Center 0.5,0.5; line width of 0.1 inches
camlib_Add_Arc( 3, 0.0, 0.0, 1.0, 1.0, 0.5, 0.5, CAM_DIRECTIONTYPE_CLOCKWISE, 0.1 );

◆ camlib_Add_Component()

int camlib_Add_Component ( char *  part_side,
float  x,
float  y,
float  width,
float  height,
float  angle,
char *  ref_des,
char *  part_name,
char *  part_description,
float  part_height 
)

Add a Component to active cell. May be used after camlib_ActivateCell.

Note
Does not require a footprint. This function makes it much more quick to add components.
Parameters
part_sideLayer to place component. Must be either "top" or "bottom".
xInsert point (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
widthHorizontal size of the component (value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
heightVertical size of the component (value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
angleRotation angle of Component in degrees. Default value should be 0.
ref_desComponent Reference Designator. Should be Unique per job.
part_nameComponent Part identification. Typically this part_name will be referenced in other sources like the BOM file, etc.
part_descriptionComponent Part description. Default is empty string ""
part_heightActual Part Height (value in user units). (i.e Component Thickness or Z value used to calculate enclousre fit). Default value should be 0.
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Component R122 at coordinats (2.0, 0.1) on Top side.
camlib_Add_Component( "top", 2.0, 0.1, 0.2, 0.1, 0, "R122", "ERA3AEB123V", "Res Thin Film 0603 12K Ohm 0.1% 1/10W" );
//Adds Component U23 at coordinats (3.225, 2.1) with 45 degree rotation on Bottom side.
camlib_Add_Component( "bottom", 3.225, 2.1, 0.95, 0.95, 45, "U23", "N80C188-16", "MCU CISC 16-Bit 16MHz 68-Pin PLCC", 0.175 );

◆ camlib_Add_Flash()

int camlib_Add_Flash ( int  nLayer,
float  x,
float  y,
int  dcode 
)

Add a flashed Pad to active cell. May be used after camlib_ActivateCell.

Parameters
nLayerLayer number to place flashed pad.
xInsert point (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
dcodeDcode number of Aperture.
Returns
Returns 0 if successful, else -1.
Note
The internal point array must have 2 or more points.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Flash using Dcode 22 on layer 2
camlib_Add_Flash( 2, 2.0, 3.3, 22 );

◆ camlib_Add_Flash_Circle()

int camlib_Add_Flash_Circle ( int  nLayer,
float  x,
float  y,
float  od,
float  id 
)

Add a flashed Circle or Donut Pad to active cell. May be used after camlib_ActivateCell.

Note
Does not require an existing aperture or Dcode. This function makes it much more natrural to add pads.
Parameters
nLayerLayer number to place flashed pad.
xInsert point (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
odOutside diameter of circle (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
idInside diameter of circle (in user units). Default value should be 0. If greater than 0 will result in a Donut. Value must be less than od. To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Circle Flash with diameter of 0.055" on layer 2
camlib_Add_Flash_Circle( 2, 2.0, 3.3, 0.055, 0 );
//Adds Donut Flash with outside diameter of 0.155" and inside diameter of 0.055 on layer 7
camlib_Add_Flash_Circle( 7, 0.0, 3.3, 0.155, 0.055 );

◆ camlib_Add_Flash_Rectangle()

int camlib_Add_Flash_Rectangle ( int  nLayer,
float  x,
float  y,
float  width,
float  height,
float  corner_radius,
float  angle 
)

Add a flashed Rectangle Pad to active cell. May be used after camlib_ActivateCell.

Note
Does not require an existing aperture or Dcode. This function makes it much more natrural to add pads.
Parameters
nLayerLayer number to place flashed pad.
xInsert point (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
widthWidth of flash (i.e. horizontal size in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
heightHeight of flash (i.e. vertical size in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
corner_radiusCorner radius of rectangle (in user units). Default value should be 0. If greater than 0 will result in either a Rounded Rectangle or Oblong shape (depending on radius value used).
angleRotation angle of flash in degrees. Default value should be 0.
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Rectangle Flash with width of 0.1" and height of 0.01" on layer 2
camlib_Add_Flash_Rectangle( 2, 2.0, 0.1, 0.01, 0, 0 );
//Adds Rectangle Flash with width of 0.1" and height of 0.01" on layer 2 rotated 45 degrees.
camlib_Add_Flash_Rectangle( 2, 2.0, 0.1, 0.01, 0, 45.0 );
//Adds Round-Rectangle Flash with width of 0.155" and height 0.1" and corner radius 0.01" on layer 7
camlib_Add_Flash_Rectangle( 7, 0.0, 3.3, 0.155, 0.1, 0.01, 0 );
//Adds Oblong Flash with width of 0.255" and height 0.1" on layer 7. This is oblong because corner radius is 1/2 smallest dimension.
camlib_Add_Flash_Rectangle( 7, 0.0, 3.3, 0.255, 0.1, 0.05, 0 );

◆ camlib_Add_Insert()

int camlib_Add_Insert ( char *  insertname,
float  x,
float  y,
float  angle,
int  mirror,
int  rows,
int  cols,
float  rowdist,
float  coldist 
)

Add an Insert to active cell. May be used after camlib_ActivateCell.

Parameters
insertnameLayer number to place flashed pad.
xInsert point (X value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
angleAngle to use for insert (in degrees).
mirrorMirror insert horizontally (1 = yes, 0 = no mirror)
rowsThe number of rows (default is 0)
colsThe number of columns (default is 0)
rowdistSpacing between of rows of an arrayed insert (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
coldistSpacing between of columns of an arrayed insert (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Add Insert "myCell" at location 2,3.3 with 90 degree rotation
camlib_Add_Insert( "myCell", 2.0, 3.3, 90, 0, 0, 0, 0, 0 );
//Add Arrayed Insert "myCell" at location 5,5. 3 Rows with spacing 2.3, 5 Columns with spacing 1.2
camlib_Add_Insert( "myCell", 5.0, 5.0, 0, 0, 3, 5, 2.3, 1.2 );

◆ camlib_Add_Line()

int camlib_Add_Line ( int  nLayer)

Add a 0-Width Line to the active cell. May be used after camlib_ActivateCell and Point Array Functions.

Note
Point Array functions such as camlib_PointArray_Append must be used to create an internal point array.
Parameters
nLayerLayer number to place line.
Returns
Returns 0 if successful, else -1.
Note
The internal point array must have 2 or more points.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
camlib_PointArray_Empty(); //Clears internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 2,0 to internal point array
camlib_PointArray_Append( 1.0, 1.0 ); //Add 2,2 to internal point array
camlib_PointArray_Append( 0.0, 0.0 ); //Add 0,0 to internal point array (i.e. close)
camlib_Add_Line( 8 ); //Add a line to layer 8.

◆ camlib_Add_NC_Drill()

int camlib_Add_NC_Drill ( int  nLayer,
float  x,
float  y,
float  diameter,
int  plated 
)

Add NC drill hit to the active cell. May be used after camlib_ActivateCell.

Parameters
nLayerLayer number to place drill. Must be a layer type defined as Drill or Rout.
xInsert point (X value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
diameterNC Tool diameter (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
platedSet to 1 for plated. Set to 0 for non-plated.
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Plated Drill hit with diameter 0.055" layer 2
camlib_Add_NC_Drill( 2, 2.0, 3.3, 0.055, 1 );
//Adds Non-Plated Drill hit with diameter 0.025" layer 8
camlib_Add_NC_Drill( 8, 5.0, 1.3, 0.025, 0 );

◆ camlib_Add_NC_Rout()

int camlib_Add_NC_Rout ( int  nLayer,
float  diameter 
)

Add a Rout path to the active cell. May be used after camlib_ActivateCell and Point Array Functions.

Note
Point Array functions such as camlib_PointArray_Append must be used to create an internal point array.
Parameters
nLayerLayer number to place Rout path.
diameterWitdh of path (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
Returns
Returns 0 if successful, else -1.
Note
The internal point array must have 2 or more points.
Sample Code C++:
camlib_SetUserUnits( "millimeter" ); // Sets activation user units to millimeter
camlib_PointArray_Empty(); //Clears internal point array
camlib_PointArray_Append( 0.0, 0.0 ); //Add 0,0 to internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 2,0 to internal point array
camlib_PointArray_Append( 1.0, 1.0 ); //Add 2,2 to internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 0,0 to internal point array
camlib_Add_NC_Rout( 5, 0.093 ); //Add Rout Path with 0.093" width to layer 5.

◆ camlib_Add_Path()

int camlib_Add_Path ( int  nLayer,
float  fWidth,
int  nPathType 
)

Add a Path to the active cell. May be used after camlib_ActivateCell and Point Array Functions.

Note
Point Array functions such as camlib_PointArray_Append must be used to create an internal point array.
Parameters
nLayerLayer number to place path.
fWidthWitdh of path (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
nPathTypeChoose Path Type. For more information see, CAM_PathType
Returns
Returns 0 if successful, else -1.
Note
The internal point array must have 2 or more points.
Sample Code C++:
camlib_SetUserUnits( "millimeter" ); // Sets activation user units to millimeter
camlib_PointArray_Empty(); //Clears internal point array
camlib_PointArray_Append( 0.0, 0.0 ); //Add 0,0 to internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 2,0 to internal point array
camlib_PointArray_Append( 1.0, 1.0 ); //Add 2,2 to internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 0,0 to internal point array
camlib_Add_Path( 3, 0.01, CAM_PATHTYPE_ROUND ); //Add Round Path with 0.01mm width to layer 3.

◆ camlib_Add_Polygon()

int camlib_Add_Polygon ( int  nLayer)

Add a Polygon to the active cell. May be used after camlib_ActivateCell and Point Array Functions.

Note
Point Array functions such as camlib_PointArray_Append must be used to create an internal point array.
Parameters
nLayerLayer number to assign copied figures
Returns
Returns 0 if successful, else -1.
Note
The internal point array must have more than 3 points.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
camlib_PointArray_Empty(); //Clears internal point array
camlib_PointArray_Append( 0.0, 0.0 ); //Add 0,0 to internal point array
camlib_PointArray_Append( 2.0, 0.0 ); //Add 2,0 to internal point array
camlib_PointArray_Append( 1.0, 1.0 ); //Add 2,2 to internal point array
camlib_PointArray_Append( 0.0, 0.0 ); //Add 0,0 to internal point array (i.e. close)
camlib_Add_Polygon( 1 ); //Add Polygon (i.e. triangle) to layer 1.

◆ camlib_Add_SetCompositeLevel()

int camlib_Add_SetCompositeLevel ( int  nCompositeLevel)

Set active composite level to newly added figures. May be used after camlib_ActivateCell.

Note
For more information about composites please see, Composite 101
Parameters
nCompositeLevelComposite Level (i.e. Dark/Clear) to use for the following figures added using CAM Library API.
Returns
Returns 0 if successful, else -1.
Note
This Comppste Level setting remains current until changed by camlib_Add_SetCompositeLevel, or export has started.

◆ camlib_Add_SetPurpose()

int camlib_Add_SetPurpose ( int  nPurpose)

Set active purpose number to newly added figures. May be used after camlib_ActivateCell.

Parameters
nPurposePurpose number to use for the following figures added using CAM Library API.
Returns
Returns 0 if successful, else -1.

◆ camlib_Add_Text()

int camlib_Add_Text ( int  nLayer,
char *  textvalue,
char *  textstyle,
float  x,
float  y,
float  height,
float  angle,
int  mirror,
char *  align 
)

Add Text to the active cell. May be used after camlib_ActivateCell.

Parameters
nLayerLayer number to place Text.
textvalueText string to use.
textstyleText style to use (can be Truetype name or SHX font file name)
xInsert point (X value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
yInsert point (Y value in user units) To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
heightHeight of arc (in user units). To change user units see, camlib_SetUserUnits or camlib_GetUserUnits
angleText angle (in degrees)
mirrorMirror text horizontally (1 = yes, 0 = no mirror).
aligntext alignment. Default is "lowerleft". Choose from the following:
  • "upperleft" = Upper Left Alignment
  • "centerleft" = Center Left Alignment
  • "lowerleft" = Lower Left Alignment
  • "uppercenter" = Upper Center Alignment
  • "centercenter" = Center Center Alignment
  • "lowercenter" = Lower Center Alignment
  • "upperright" = Upper Right Alignment
  • "centerright" = Center Right Alignment
  • "lowerright" = Lower Right Alignment
Returns
Returns 0 if successful, else -1.
Sample Code C++:
camlib_SetUserUnits( "inch" ); // Sets activation user units to Inches
//Adds Text with style of "arial" at 1,1 with 0.5 inch height
camlib_Add_Text( 3, "My Sample Text #1", "arial", 1.0, 1.0, 0.5, 0.0, 0, "lowerleft" );
//Adds Text with style of "txt.shx" at 1,3 with 0.3 inch height, 90 degree rotation
camlib_Add_Text( 3, "My Sample Text #2", "txt.shx", 1.0, 3.0, 0.3, 90.0, 0, "centerleft" );
camlib_PointArray_Empty
int camlib_PointArray_Empty()
Clear internal point array. May be used after camlib_ActivateCell.
camlib_Add_Flash
int camlib_Add_Flash(int nLayer, float x, float y, int dcode)
Add a flashed Pad to active cell. May be used after camlib_ActivateCell.
camlib_Add_Polygon
int camlib_Add_Polygon(int nLayer)
Add a Polygon to the active cell. May be used after camlib_ActivateCell and Point Array Functions.
camlib_Add_Insert
int camlib_Add_Insert(char *insertname, float x, float y, float angle, int mirror, int rows, int cols, float rowdist, float coldist)
Add an Insert to active cell. May be used after camlib_ActivateCell.
camlib_Add_Line
int camlib_Add_Line(int nLayer)
Add a 0-Width Line to the active cell. May be used after camlib_ActivateCell and Point Array Function...
camlib_Add_Flash_Rectangle
int camlib_Add_Flash_Rectangle(int nLayer, float x, float y, float width, float height, float corner_radius, float angle)
Add a flashed Rectangle Pad to active cell. May be used after camlib_ActivateCell.
camlib_Add_NC_Rout
int camlib_Add_NC_Rout(int nLayer, float diameter)
Add a Rout path to the active cell. May be used after camlib_ActivateCell and Point Array Functions.
CAM_DIRECTIONTYPE_CLOCKWISE
Clockwise direction of the arc.
Definition: CamLib.h:91
camlib_Add_Arc
int camlib_Add_Arc(int nLayer, float sx, float sy, float ex, float ey, float cx, float cy, int dir, float fWidth)
Add an Arc path to the active cell. May be used after camlib_ActivateCell.
camlib_PointArray_Append
int camlib_PointArray_Append(float x, float y)
Add point to internal point array. May be used after camlib_ActivateCell.
camlib_SetUserUnits
int camlib_SetUserUnits(char *value)
Set the active user units to be used with CAM Library API's.
camlib_Add_Flash_Circle
int camlib_Add_Flash_Circle(int nLayer, float x, float y, float od, float id)
Add a flashed Circle or Donut Pad to active cell. May be used after camlib_ActivateCell.
camlib_Add_NC_Drill
int camlib_Add_NC_Drill(int nLayer, float x, float y, float diameter, int plated)
Add NC drill hit to the active cell. May be used after camlib_ActivateCell.
camlib_Add_Text
int camlib_Add_Text(int nLayer, char *textvalue, char *textstyle, float x, float y, float height, float angle, int mirror, char *align)
Add Text to the active cell. May be used after camlib_ActivateCell.
camlib_Add_Path
int camlib_Add_Path(int nLayer, float fWidth, int nPathType)
Add a Path to the active cell. May be used after camlib_ActivateCell and Point Array Functions.
CAM_PATHTYPE_ROUND
This style results in an extension with a radius equal to one-half the Path width.
Definition: CamLib.h:74
camlib_Add_Component
int camlib_Add_Component(char *part_side, float x, float y, float width, float height, float angle, char *ref_des, char *part_name, char *part_description, float part_height)
Add a Component to active cell. May be used after camlib_ActivateCell.