Hi all,

Could anyone please help me with linking custom Dll plugin with SurfCam? I tried running the sample code, ChainingSample under API folder of SurfCam but always ended up getting link error. I added the path of the dll in SurfCam.INI file but with no success.

Any help in this area would be greatly useful.

Below is the Sample Code:

// Chaining Example project
// This API project demonstrates operation selection, chaining, accessing operation parameters,
// and modifying an operation's associativity to selected geometry.
// The application will prompt the user to select a pocket operation, then prompt the user
// to provide a new chain selection. This chaining selection is written back into the
// operation and the operation is regenerated with the new selection.
#include "../../../../ExpFunc.h"
#include <windows.h> /// Needed for messagebox


pSCFuncs *ut_p_pSCFuncs;


extern "C" __declspec(dllexport) long
UserApp_nCallback(
pSCFuncs *p_pFuncs)
{
/// Set the global API function pointer to simplify the syntax when calling SURFCAM API functions.
ut_p_pSCFuncs = p_pFuncs;


/// Operations are accessed by their name - store the operation name in this string.
char sOpName[256];


PacketDBHandle hPacketDB = 0;


int level = scApp_GetProductLevel();


if (!(level & dll_nc_mode_bit(NC_MODE_2AXIS)))
MessageBox(scApp_GetWindowHandle(), "SIM does not support 2Axis product", "Chaining Example", MB_OK);


int opType = NCOP_TYPE_OTHER;


/// Loop until the user selects a pocket operation, or cancels out.
while (opType != NCOP_TYPE_2AXIS_POCKET)
{
/// Just a plain 'ol Win32 messagebox to provide simple instructions.
MessageBox(scApp_GetWindowHandle(), "Please select a 2Axis pocket operation", "Chaining Example", MB_OK);


/// Bring up the operation selection dialog. Returns FAIL if user hits the cancel button.
if (scNCOp_SelectNCProjectItem(sOpName, FALSE, FALSE) == FAIL)
return 0;


/// Assign the packet database handle for the selected operation.
/// Note that this returns a raw pointer to the exisitng packet database object, so
/// no packet database object is created by this call (and no object needs to be freed).
hPacketDB = scNCOp_GetItemPacketHandle(sOpName);


/// Get the type of the operation.
scPacketDB_GetInteger(hPacketDB, PID_OPERATION_TYPE, 0, &opType);
}


/// Create an empty operation geometry object to hold operation geometry selection data.
HSC_ContourGeometry hContourGeom = scContourGeom_Init(hPacketDB);


/// Fill the operation geometry object with existing selection information from the operation.
scContourGeom_ReadFromPacketDB(hPacketDB, hContourGeom);


/// Create a chain array to hold the user's chain selection.
HSC_ChainArray hChain = scChainArray_Init();


/// Prompt the user to select a chain.
scApp_ChainSelectMenu(hChain, CHAIN_DEFAULT_OPTIONS, CHAIN_MODE_2D, 0);


/// Write the chain selection to the operation geometry object.
scContourGeom_SetPartChains(hContourGeom, hChain);


/// Write the updated operation geometry object back to the original operation.
scContourGeom_WriteToPacketDB(hPacketDB, hContourGeom);


/// Regenerate the operation using the updated chains.
scRegenerateOperationNoUI(sOpName);


/// Free memory for objects no longer used.
scChainArray_Free(hChain);
scContourGeom_Free(hContourGeom);


return 0;
}

Regards
Natar