TA的每日心情![](source/plugin/dsu_paulsign/img/emot/kx.gif) | 开心 昨天 15:13 |
---|
签到天数: 153 天 [LV.7]常住居民III
管理员
中国膜结构网www.mjgou.com
- 积分
- 2147483647
![QQ](static/image/common/qq_big.gif)
|
- AcDbObjectId GetTextstyleId(CString sTextstylename)
- {
- AcDbTextStyleTable *pTable;
- AcDbObjectId textstyleId = AcDbObjectId::kNull;
- Acad::ErrorStatus es = Acad::eOk;
- if ((es = acdbHostApplicationServices()->workingDatabase()->getTextStyleTable(pTable, AcDb::kForRead)) == Acad::eOk){
- if ((es =pTable->getAt(sTextstylename, textstyleId, Adesk::kFalse)) != Acad::eOk){
- textstyleId =AcDbObjectId::kNull;
- }
- pTable->close();
- }
- return textstyleId;
- }
- double GetTextWidth(CString sText, CString sTextStyle, double dTextHeight)
- {
- AcDbObjectId idTextStyle = GetTextstyleId(sTextStyle);
- AcGiTextStyle giTextStyle;
- fromAcDbTextStyle(giTextStyle, idTextStyle);
- giTextStyle.setTextSize(dTextHeight);
- AcGePoint2d ptExt = giTextStyle.extents(sText.GetBuffer(), Adesk::kFalse, sText.GetLength(), Adesk::kFalse);
- return ptExt.x;
- }
- OR
- double GetTextWidth(AcDbObjectId idText)
- {
- ads_point ptLowerLeft, ptUpperRight;
- ads_name ent;
- struct resbuf * textent;
- acdbGetAdsName(ent, idText);
- textent = acdbEntGet(ent);
- acedTextBox(textent, ptLowerLeft, ptUpperRight);
- //acutPrintf("\nHeight: %.2f, Width: %.2f", ptUpperRight - ptLowerLeft, ptUpperRight - ptLowerLeft);
- return ptUpperRight - ptLowerLeft;
- }
复制代码 |
|