明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2635|回复: 4

求教用ARX实现CAD屏幕上文本文字的输出

[复制链接]
发表于 2004-3-30 17:42:00 | 显示全部楼层 |阅读模式
各位大哥:


                 谁能告诉我如何用ARX实现CAD屏幕上文本文字的输出,就象调用CAD命令mtext一样的


效果,是用acedTextBox()方法吗?能举个例子吗?


         小弟这里先谢谢了!!!!
 楼主| 发表于 2004-3-31 09:29:00 | 显示全部楼层
求求各位指点一下吧!!!!
发表于 2004-4-5 08:37:00 | 显示全部楼层
AcDbTextStyleTable *pTextTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextTbl, AcDb::kForWrite);
AcDbObjectId recId;
pTextTbl->getAt("仿宋_GB2312",recId);
pTextTbl->close();
pText->setTextStyle(recId);
/////////////////////////////////////////////////////////////
pText->setHeight(3.0);
pText->setWidthFactor(0.7);
pText->setPosition(pt);
//pText->setHorizontalMode(AcDb::kTextMid);//设置文本对齐方式
pText->setTextString(GetWeather(sName[n]));
AcDbObjectId textId;
addToModelSpace(textId,pText);//写应力数 Acad::ErrorStatus addToModelSpace(AcDbObjectId &objId, AcDbEntity* pEntity)
{
Acad::ErrorStatus es = Acad::eOk;
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pSpaceRecord; acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead); pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord,
AcDb::kForWrite); pSpaceRecord->appendAcDbEntity(objId, pEntity); pBlockTable->close();
pEntity->close();
pSpaceRecord->close();
return es;
}
 楼主| 发表于 2004-4-5 08:42:00 | 显示全部楼层
小弟这里先谢谢了!!!!!
 楼主| 发表于 2004-4-5 16:17:00 | 显示全部楼层
按照楼上的指点,写出如下的代码,可屏幕输出却是??????!,我觉得可能还是没有 没有应用中文字体,那么应该如何改呢,错误在哪?请继续指点!!!! void settextstyle(AcDbText *pText) //参数为AcDbText *&pText也一样
{
AcGePoint3d startpoint(500,500,0);
AcDbTextStyleTable *pTextTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextTbl, AcDb::kForWrite);
AcDbObjectId recId;
pTextTbl->getAt("仿宋_GB2312",recId);
pTextTbl->close();
pText->setTextStyle(recId);
pText->setHeight(3.0);
pText->setWidthFactor(0.7);
pText->setPosition(startpoint);
pText->setHorizontalMode(AcDb::kTextMid);//设置文本对齐方式
pText->setTextString("这是一个测试!");
} void drawtext()
{
AcDbText* ptextout=new AcDbText();
settextstyle(ptextout);
AcDbBlockTable *pblocktable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pblocktable,AcDb::kForWrite);
AcDbBlockTableRecord *pblockrecord;
pblocktable->getAt(ACDB_MODEL_SPACE,pblockrecord,AcDb::kForWrite);
pblocktable->close();
AcDbObjectId id;
pblockrecord->appendAcDbEntity(id,ptextout);
pblockrecord->close();
ptextout->close();
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 02:43 , Processed in 0.175476 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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