- UID
- 21404
- 积分
- 43
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-12-21
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
如何将TEXT文字拆分成单字(ARX方法)?我通过acdbEntMake函数编写了一个程序,可运行到strcpystrcpy(la->resval.rstring,temp)时CAD死了!不知为何?
我的代码如下:
//====拆分文字=======================================================
void exptxt(ads_name text)
{
struct resbuf *la,*ed,*ep;
ads_real texthz,textwz,textrz;
char temp[4],*txtstr=" ";
ads_point pick;
int i,len,count=0;
ed=acdbEntGet(text); //取得实体参数集
ep=ed;
la=entitem(ed,40);
texthz=la->resval.rreal;
la=entitem(ed,41);
textwz=la->resval.rreal;
la=entitem(ed,50);
textrz=la->resval.rreal;
la=entitem(ed,10);
pick[0]=la->resval.rpoint[0];
pick[1]=la->resval.rpoint[1];
la=entitem(ed,1);
strcpy(txtstr,la->resval.rstring);
acdbEntDel(text);
len=strlen(txtstr);
count=0;
for(i=0;i<len;i++)
{
temp[0]=txtstr[count++];
if(isascii(temp[0])==0)
{
temp[1]=txtstr[count++];
temp[2]='\0';
temp[3]='\0';
i++;
}
else
{
temp[1]=txtstr[count];
if (temp[0]=='%' && temp[1]=='%')
{
temp[2]=txtstr[++count];
temp[3]='\0';
count++;
i=i+2;
}
else
{
temp[1]='\0';
temp[2]='\0';
temp[3]='\0';
}
}
la=entitem(ep,1);
strcpy(la->resval.rstring,temp);
la=entitem(ep,10);
la->resval.rpoint[0]=pick[0];
la->resval.rpoint[1]=pick[1];
la->rbnext=NULL;
acdbEntMake(ep); //更新实体参数集
pick[0]=pick[0]+1.0*texthz*textwz*cos(textrz);
pick[1]=pick[1]+1.0*texthz*textwz*sin(textrz);
}
acutRelRb(ed);
}
//=================================================================== |
|