Crigui...
> how can i use mdlLocate_identifyElement and
> please give me some examples
I suggest using mdlState_startModifyCommand , because it provides more functionality and calls the mdlLocate_xxx functions for you.
void crigui_command (void)
cmdNumber CMD_CRIGUI_LOCATE
{
// Set up MicroStation's state machine
mdlState_startModifyCommand (
crigui_command, // <reset> re-starts this command
crigui_stateDatapoint, // Accept (<datapoint>) function NULL, // Dynamic function not required NULL, // Show function not required NULL, // Clean function not required CMD_CRIGUI_COMMAND, // ID of a command message in your msg resource PM_CRIGUI_COMMAND, // ID of a prompt message in your msg resource FALSE, // Don't use selection set 0 // No additional datapoints needed);
// Set a filter function here if you want user to select // only certain types of element crigui_setLocateFilter ; }
void crigui_setLocateFilter (boolean bAllowRefs)
{
static int searchMask = {
CELL_HEADER_ELM,
LINE_ELM,
LINE_STRING_ELM,
SHAPE_ELM,
CURVE_ELM,
ELLIPSE_ELM,
CMPLX_STRING_ELM,
CMPLX_SHAPE_ELM,
ARC_ELM,
};
if (bAllowRefs)
mdlLocate_noElemAllowLocked ;
else
mdlLocate_noElemNoLocked ;
mdlLocate_setElemSearchMask (ARRAY_NMEMBERS (searchMask), searchMask); }
void crigui_stateDatapoint (DPoint3d *pt, int view)
{
int fileNum = -1;
ULong filePost = mdlElement_getFilePos (FILEPOS_CURRENT, &fileNum);
// Do whatever you want with the element at filePos and fileNum
// Start crigui_command again
mdlState_restartCurrentCommand ;
// or stop this state machine
// mdlState_startDefaultCommand ;
}