jslinzx 发表于 2015-9-24 12:18:16

文字内容的问题

ads_point pt;//定义点起点类型
ads_point pt1;//定义点起点类型
ads_point pt4;//定义点起点类型
acedGetPoint(NULL,"\n_确定标高位置:",pt);//鼠标确定起点
acedGetPoint(NULL,"\n_确定标高位置:",pt1);//鼠标确定起点
acedGetPoint(NULL,"\n_确定文字位置:",pt4);//鼠标确定起点
AcGePoint3d pt2(pt,pt,pt);
AcGePoint3d pt3(pt1,pt1,pt1);
double m;
m=fabs(pt2.z-pt3.z);
char fmtval;
acdbRToS(m,2,2,fmtval);
acutPrintf("\n结果形式为%4s\n",fmtval);
const char*text=("井深:%s米",fmtval);
AcGePoint3d ptInsert(pt4,pt4,pt4);//确定文字位置
AcDbObjectId style = AcDbObjectId::kNull;
double height=3;//设置字高
double rotation=0;//设置字体旋转高度
AcDbText *pText = new AcDbText(ptInsert,text, style, height,rotation);
在这句const char*text=("井深:%s米",fmtval);出的结果只有数字没有文字。如何解决。谢谢

jslinzx 发表于 2015-9-30 08:27:18

ads_point pt;      //定义点起点类型
ads_point pt1;      //定义点起点类型
ads_point pt4;      //定义点起点类型
acedGetPoint(NULL,"\n_确定标高位置:",pt);//鼠标确定起点
acedGetPoint(NULL,"\n_确定标高位置:",pt1);//鼠标确定起点
acedGetPoint(NULL,"\n_确定文字位置\n:",pt4);//鼠标确定起点
AcGePoint3d pt2(pt,pt,pt);
AcGePoint3d pt3(pt1,pt1,pt1);
double m;
m=fabs(pt2.z-pt3.z);
AcGePoint3d ptInsert(pt4,pt4,pt4);//确定文字位置
AcDbObjectId style = AcDbObjectId::kNull;
char fmtval;
acdbRToS(m,2,3,fmtval);
char js="井深:";
char*str=strcat(js,fmtval);
double height=1;//设置字高
double rotation=0;//设置字体旋转高度
AcDbText *pText = new AcDbText(ptInsert,str, style, height,rotation);


自己的问题自己解决

ivde 发表于 2015-9-30 11:32:19

Unicode 模式下
acedGetPoint(NULL,_T("\n_确定标高位置:"),pt);//

ACHAR str(_T("井深"));

cdinten 发表于 2015-10-8 09:12:20

建议开发全都采用Unicode编码实现,反正也很容易,_T(),L,TEXT等方式都能搞定。
页: [1]
查看完整版本: 文字内容的问题