- UID
- 70878
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-8-8
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
最近做了一个遍历acdbTextStyleTable的程序,在遍历后在命令行输出时候为什么输出的数据的精度不能按照autoCAD的系统精度输出呢??请各位帮忙看看问题在哪里!谢谢!!
代码如下:
-----------------------------------------
- [FONT=courier new]
- void cmdStyle::ListRecord()
- {
- struct resbuf rb;
- int rt;
-
- int iLunit, iLuPrec, iAunit, iAuPrec;
-
- rt = acedGetVar("LUNITS", &rb);
- if(rt != RTNORM)
- return;
- else
- {
- if(rb.restype == RTSHORT)
- iLunit = rb.resval.rint;
- else
- return;//error
- }
-
- rt = acedGetVar("LUPREC", &rb);
- if(rt != RTNORM)
- return;
- else
- {
- if(rb.restype == RTSHORT)
- iLuPrec = rb.resval.rint;
- else
- return;//error
- }
-
- rt = acedGetVar("AUNITS", &rb);
- if(rt != RTNORM)
- return;
- else
- {
- if(rb.restype == RTSHORT)
- iAunit = rb.resval.rint;
- else
- return;//error
- }
-
- rt = acedGetVar("AUPREC", &rb);
- if(rt != RTNORM)
- return;
- else
- {
- if(rb.restype == RTSHORT)
- iAuPrec = rb.resval.rint;
- else
- return;//error
- }
- AcDbTextStyleTable *pStyleTable;
- if (m_pDb->getSymbolTable(pStyleTable, AcDb::kForRead) != Acad::eOk)
- {
- pStyleTable->close();
- m_state = sEnd;
- return;
- }
- else
- {
- Acad::ErrorStatus es;
- AcDbTextStyleTableIterator *pTsIter;
- es = pStyleTable->newIterator(pTsIter);
- if (es != Acad::eOk)
- {
- pStyleTable->close();
- m_state = sEnd;
- return;
- }
- while (!pTsIter->done())
- {
- AcDbTextStyleTableRecord *pRecord = NULL;
- if (pTsIter->getRecord(pRecord, AcDb::kForRead) != Acad::eOk)
- {
- pRecord->close();
- pStyleTable->close();
- m_state = sEnd;
- return;
- }
- else
- {
- char *RecordName=NULL;
- pRecord->getName(RecordName);
- acutPrintf("\n\n样式名: '%s' ", RecordName);
- char* pTypeface=NULL;
- Adesk::Boolean bold;
- Adesk::Boolean italic;
- int charset;
- int pitchAndFamily;
- if (pRecord->font(pTypeface, bold, italic, charset, pitchAndFamily) == Acad::eOk)
- {
- if(*pTypeface != NULL)//如果是个TrueType字体样式
- {
- acutPrintf(" 字体: %s",pTypeface);
- }
- else//SHX字体样式
- {
- char *fileName =NULL;
- if (pRecord->fileName(fileName) == Acad::eOk)
- {
- acutPrintf(" 字体文件: %s", fileName);
- }
- char *bigFontFileName;
- if (pRecord->bigFontFileName(bigFontFileName) == Acad::eOk)
- {
- acutPrintf(", %s", bigFontFileName);
- }
- }
- }
- char Soutput[64];
- double textSize;
- textSize= pRecord->textSize();
- acdbRToS(textSize, iLunit, iLuPrec, Soutput);
- acutPrintf("\n 高度: %s",Soutput);
- double xScale;
- xScale = pRecord->xScale();
- acdbRToS(xScale, iLunit, iLuPrec, Soutput);
- acutPrintf(" 宽度比例: %s", Soutput);
- double obliquingAngle;
- obliquingAngle = pRecord->obliquingAngle();
- acdbAngToS(obliquingAngle, iAunit, iAuPrec, Soutput);
- acutPrintf(" 倾斜角度: %s", Soutput);
- Adesk::Boolean isVertical= pRecord->isVertical();
- if(isVertical)
- acedPrompt("\n 生成方式: 垂直");
- else
- acedPrompt("\n 生成方式: 常规");
- pRecord->close();
- }
- pTsIter->step();
- }
-
- }
- pStyleTable->close();
- m_state = sEnd;
- return;
- }
- [/FONT]
复制代码 |
|