求教用ARX实现CAD屏幕上文本文字的输出
各位大哥:谁能告诉我如何用ARX实现CAD屏幕上文本文字的输出,就象调用CAD命令mtext一样的
效果,是用acedTextBox()方法吗?能举个例子吗?
小弟这里先谢谢了!!!! 求求各位指点一下吧!!!! AcDbTextStyleTable *pTextTbl;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextTbl, AcDb::kForWrite);<BR> AcDbObjectId recId;<BR> pTextTbl->getAt("仿宋_GB2312",recId); <BR> pTextTbl->close();<BR> pText->setTextStyle(recId);<BR> ///////////////////////////////////////////////////////////// <BR> pText->setHeight(3.0);<BR> pText->setWidthFactor(0.7);<BR> pText->setPosition(pt);<BR> //pText->setHorizontalMode(AcDb::kTextMid);//设置文本对齐方式<BR> pText->setTextString(GetWeather(sName));<BR> AcDbObjectId textId;<BR> addToModelSpace(textId,pText);//写应力数
Acad::ErrorStatus addToModelSpace(AcDbObjectId &objId, AcDbEntity* pEntity)<BR>{<BR> Acad::ErrorStatus es = Acad::eOk;<BR> AcDbBlockTable *pBlockTable;<BR> AcDbBlockTableRecord *pSpaceRecord;
acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord,<BR> AcDb::kForWrite);
pSpaceRecord->appendAcDbEntity(objId, pEntity);
pBlockTable->close();<BR> pEntity->close();<BR> pSpaceRecord->close();<BR> return es;<BR>} 小弟这里先谢谢了!!!!! 按照楼上的指点,写出如下的代码,可屏幕输出却是??????!,我觉得可能还是没有
没有应用中文字体,那么应该如何改呢,错误在哪?请继续指点!!!!
void settextstyle(AcDbText *pText) //参数为AcDbText *&pText也一样<BR>{<BR> AcGePoint3d startpoint(500,500,0);<BR> AcDbTextStyleTable *pTextTbl;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextTbl, AcDb::kForWrite);<BR> AcDbObjectId recId;<BR> pTextTbl->getAt("仿宋_GB2312",recId); <BR> pTextTbl->close();<BR> pText->setTextStyle(recId);<BR> pText->setHeight(3.0);<BR> pText->setWidthFactor(0.7);<BR> pText->setPosition(startpoint);<BR> pText->setHorizontalMode(AcDb::kTextMid);//设置文本对齐方式<BR> pText->setTextString("这是一个测试!");<BR>}
void drawtext()<BR>{ <BR> AcDbText* ptextout=new AcDbText();<BR> settextstyle(ptextout);<BR> AcDbBlockTable *pblocktable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pblocktable,AcDb::kForWrite);<BR> AcDbBlockTableRecord *pblockrecord;<BR> pblocktable->getAt(ACDB_MODEL_SPACE,pblockrecord,AcDb::kForWrite);<BR> pblocktable->close();<BR> AcDbObjectId id;<BR> pblockrecord->appendAcDbEntity(id,ptextout);<BR> pblockrecord->close();<BR> ptextout->close();<BR>}
页:
[1]