To extract coordiantes of begin en end point of an linear element you can use the function:
mdlElmdscr_extractEndPoints
In the mdl documentation you can read the parameters.
this functiuon works on every linear element alxs complex ones like b-spline curve, cmplx-LineString etc.
Look at this little code example
Olaf Giezenaar
Private void accept(DPoint3d *ptP, int view)
{
ULong fPos;
int fNum;
MSElementDescr *elDP=NULL;
DPoint3d ptBegin, ptEnd;
fPos = mdlElement_getFilePos(FILEPOS_CURRENT,&fNum);
mdlElmdscr_read(&elDP,fPos,fNum,FALSE,NULL);
if (mdlElmdscr_extractEndPoints(&ptBegin,NULL,&ptEnd,NULL,elDP,1.0) == SUCCESS) { // ptBegin and ptEnd are filled with the coords } else { mdlDialog_openInfoBox("Wrong type element"); } if (elDP) mdlElmdscr_freeAll(&elDP); }
Private void reset(void)
{
mdlState_clear;
}
Public int locate_funtion(void)
{
mdlLocate_allowLocked;
mdlLocate_init;
mdlState_startModifyCommand(reset,accept,NULL,NULL,NULL,0,0,FALSE,0); return SUCCESS; }
(foo) wrote:
You can use MDL function 'mdlState_startModifyCommand' to select a elem in dgn file and then in its 'acceptFunc', the selected elem (must simple elem) is in global variable 'dgnBuf'. You can use MDL function 'mdlLinear_extract' to extract curve or line coordinates.
Foo.