I'm taking my first steps in the topic of SDS-programming and have encountered a problem with the 'sds_cmd' statement. I want to select a polyline on screen and use the MEASURE command to get point along the line. I'm testing the Delphi-interface to SDS from ADEKO to do the job but I think the following code will be understandable also for C-programmers.
if (sds_entsel('\nPick an object: ', entname, pt) <> SDS_RTNORM) then
result := SDS_RTERROR;
//ShowMessage(IntToStr(result));
listbuf := sds_buildlist(SDS_RTSTR, '_measure', SDS_RTENAME, entname,
SDS_RTREAL, 0.5, 0);
sds_retlist(listbuf);
if (listbuf <> nil) then
if (sds_cmd(listbuf) <> SDS_RTNORM) then
result := SDS_RTERROR;
ShowMessage(IntToStr(result));
if (sds_relrb(listbuf) <> SDS_RTNORM) then
result := SDS_RTERROR;
//ShowMessage(IntToStr(result));
if (sds_entdel(entname) <> SDS_RTNORM) then
result := SDS_RTERROR;
I don't get any errormessage but also no points.
Any help available?
Thanks
Alf
#2
Hi Alf,
I inspected the listbuf variable after the sds_buildlist call, and it was nil.
I have had trouble with the sds_buildlist function as well. I gave up on that function and just build my lists manually with sds_newrb. Instead of your sds_buildlist call try this:
//setup the first list entry
listbuf:= sds_Newrb(SDS_RTSTR);
listbuf.resval.rstring:= AllocMem(Length('_measure')+1);
strPCopy(listbuf.resval.rstring, '_measure');
//setup the ename entry
listbuf.rbnext:= sds_newrb(SDS_RTENAME);
listbuf.rbnext.resval.rlname[0]:= entname[0];
listbuf.rbnext.resval.rlname[1]:= entname[1];
//setup the real value entry
listbuf.rbnext.rbnext:= sds_newrb(SDS_RTREAL);
listbuf.rbnext.rbnext.resval.rreal:= 0.5;
//setup the last entry
listbuf.rbnext.rbnext.rbnext:= sds_newrb(SDS_RTNONE);
When I passed this listbuf value to sds_cmd, the points were created. It looks pretty awkward, but you could declare a "next" variable to traverse the list structure. Just make sure you keep the original listbuf pointer so that you can release the memory properly with sds_relrb.
Good luck,
-Rick Francken
I inspected the listbuf variable after the sds_buildlist call, and it was nil.
I have had trouble with the sds_buildlist function as well. I gave up on that function and just build my lists manually with sds_newrb. Instead of your sds_buildlist call try this:
//setup the first list entry
listbuf:= sds_Newrb(SDS_RTSTR);
listbuf.resval.rstring:= AllocMem(Length('_measure')+1);
strPCopy(listbuf.resval.rstring, '_measure');
//setup the ename entry
listbuf.rbnext:= sds_newrb(SDS_RTENAME);
listbuf.rbnext.resval.rlname[0]:= entname[0];
listbuf.rbnext.resval.rlname[1]:= entname[1];
//setup the real value entry
listbuf.rbnext.rbnext:= sds_newrb(SDS_RTREAL);
listbuf.rbnext.rbnext.resval.rreal:= 0.5;
//setup the last entry
listbuf.rbnext.rbnext.rbnext:= sds_newrb(SDS_RTNONE);
When I passed this listbuf value to sds_cmd, the points were created. It looks pretty awkward, but you could declare a "next" variable to traverse the list structure. Just make sure you keep the original listbuf pointer so that you can release the memory properly with sds_relrb.
Good luck,
-Rick Francken