dcs_api.h

<< Click to Display Table of Contents >>

Navigation:  User DLLs > Writing DLLs > Link Libraries >

dcs_api.h

The following code is from dcs_api.h. This file provides some basic type definitions and prototypes of functions that are exported by the 3DCS API that you will need to call in your user-DLL projects. This file will briefly describe each of the definitions/prototypes included in this header file.

 

The definition for dcsDLLExportC is used in your DLL project to export functions that need to be called by 3DCS. The definition for dcsDataPtr is used in your user-routines to pass in the data from 3-Dcs and subsequently converted (cast) to the appropriate structure type (move, tolerance, or measure). The function dcsApiLogWrite gives your routines access to writing to the DCS Log File that is written during every session in the working directory and can be used for error logging. The function dcsApiDisplayHint gives your routines access to writing to the Status Bar and can be used for progress tracking. The function dcsApiDisplayMsg gives your routines access to writing to a pop-up message box GUI for error reporting. However, in general, dcsApiDisplayMsg should not be called in user-routines since this may cause GUI to continually pop up during a simulation run for each sample.

 

The enum definition for dcsCalType is used in your dcsDLLInit and dcsDLLExit functions in dcs_dll.cpp to register and remove your user-DLL routines respectively. You must specify what type of routine you are registering (move, tolerance, or measure) so that 3DCS may recognize your routine as such. The function dcsApiRegisterCalFunc is used to register your routines into 3DCS in dcsDLLInit in dcs_dll.cpp. The function dcsApiRemoveCalFunc is used to remove your routines from 3DCS in dcsDLLExit in dcs_dll.cpp.

 

 

 

#ifndef dcsAPI_FUNCTION_HEADER

#define dcsAPI_FUNCTION_HEADER

 

 

 

// dcs

#include "dcs_defn.h"

 

 

 

#define dcsDLLExportC wpDLLExportC

 

#define dcsDataPtr wpDataPtr

 

 

// write to dcs log file

dcsDLLExportC void dcsApiLogWrite(const char* str);

 

// display hint at left-most status-bar area

dcsDLLExportC void dcsApiDisplayHint(const char* hint);

 

// display 'OK' type message box on screen

dcsDLLExportC void dcsApiDisplayMsg(const char* msg);

 

 

// function register ///////////////////////////////////////////////////

 

enum dcsCalType

{

dcsCalTypeIntern, // internal calculation routine, known name routine

dcsCalTypeMove, // user move routine

dcsCalTypeMoveDlg, // user move dialog routine // added 4/30/02

dcsCalTypeTole, // user tole routine

dcsCalTypeToleDlg, // user tole dialog routine // added 4/30/02

dcsCalTypeMeas, // user meas routine

dcsCalTypeMeasDlg, // user meas dialog routine // added 4/30/02

dcsCalTypeExec // user exec routine

};

 

// calculate function pointer:

typedef void (*dcsCalFuncPtr)(dcsDataPtr* pCalData);

 

///////////////////////////////////////////////////////////////////

 

// register function with dcsCalType { Move, Tole, Meas, Exec, ... }calculating function

dcsDLLExportC void dcsApiRegisterCalFunc(const char* name, dcsCalFuncPtr pFuncPtr, dcsCalType mtmType);

 

// remove function with dcsCalType { Move, Tole, Meas, Exec, ... } calculating function

dcsDLLExportC void dcsApiRemoveCalFunc(const char* name, dcsCalType mtmType);

 

 

///////////////////////////////////////////////////////////////////////////////

 

 

 

#endif /* dcsAPI_FUNCTION_HEADER */