明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 797|回复: 3

文字内容的问题

[复制链接]
发表于 2015-9-24 12:18 | 显示全部楼层 |阅读模式
  1. ads_point pt;  //定义点起点类型
  2. ads_point pt1;  //定义点起点类型
  3. ads_point pt4;  //定义点起点类型
  4. acedGetPoint(NULL,"\n_确定标高位置:",pt);//鼠标确定起点
  5. acedGetPoint(NULL,"\n_确定标高位置:",pt1);//鼠标确定起点
  6. acedGetPoint(NULL,"\n_确定文字位置:",pt4);//鼠标确定起点
  7. AcGePoint3d pt2(pt[X],pt[Y],pt[Z]);
  8. AcGePoint3d pt3(pt1[X],pt1[Y],pt1[Z]);
  9. double m;
  10. m=fabs(pt2.z-pt3.z);
  11. char fmtval[12];
  12. acdbRToS(m,2,2,fmtval);
  13. acutPrintf("\n结果形式为%4s\n",fmtval);
  14. const char*text=("井深:%s米",fmtval);
  15. AcGePoint3d ptInsert(pt4[X],pt4[Y],pt4[Z]);//确定文字位置
  16. AcDbObjectId style = AcDbObjectId::kNull;
  17. double height=3;//设置字高
  18. double rotation=0;//设置字体旋转高度
  19. AcDbText *pText = new AcDbText(ptInsert,text, style, height,rotation);
复制代码
在这句const char*text=("井深:%s米",fmtval);  出的结果只有数字没有文字。如何解决。谢谢
 楼主| 发表于 2015-9-30 08:27 | 显示全部楼层
  1. ads_point pt;        //定义点起点类型
  2. ads_point pt1;        //定义点起点类型
  3. ads_point pt4;        //定义点起点类型
  4. acedGetPoint(NULL,"\n_确定标高位置:",pt);//鼠标确定起点
  5. acedGetPoint(NULL,"\n_确定标高位置:",pt1);//鼠标确定起点
  6. acedGetPoint(NULL,"\n_确定文字位置\n:",pt4);//鼠标确定起点
  7. AcGePoint3d pt2(pt[X],pt[Y],pt[Z]);
  8. AcGePoint3d pt3(pt1[X],pt1[Y],pt1[Z]);
  9. double m;
  10. m=fabs(pt2.z-pt3.z);
  11. AcGePoint3d ptInsert(pt4[X],pt4[Y],pt4[Z]);//确定文字位置
  12. AcDbObjectId style = AcDbObjectId::kNull;
  13. char fmtval[30];
  14. acdbRToS(m,2,3,fmtval);
  15. char js[30]="井深:";
  16. char*str=strcat(js,fmtval);
  17. double height=1;//设置字高
  18. double rotation=0;//设置字体旋转高度
  19. AcDbText *pText = new AcDbText(ptInsert,str, style, height,rotation);


复制代码
自己的问题自己解决
发表于 2015-9-30 11:32 | 显示全部楼层
Unicode 模式下
acedGetPoint(NULL,_T("\n_确定标高位置:"),pt);//

ACHAR str(_T("井深"));
发表于 2015-10-8 09:12 | 显示全部楼层
建议开发全都采用Unicode编码实现,反正也很容易,_T(),L,TEXT等方式都能搞定。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-15 15:06 , Processed in 0.961561 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表