明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1422|回复: 2

这段代码哪里有问题,为什么不能显示!!!!!!!!!!

[复制链接]
发表于 2004-10-7 16:33:00 | 显示全部楼层 |阅读模式
int i; AcDbObjectId lineId;
AcDbObjectId ptId;
AcGePoint3d Pt; AcDb3dPolyline *pLine = new AcDb3dPolyline(); AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead); AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
for(i=1;i<=10;i++)
{
Pt.x=i;
Pt.y=i*rand();
Pt.z=0.0;
AcDb3dPolylineVertex *pV=new AcDb3dPolylineVertex(Pt);
pLine->appendVertex(ptId,pV);
}
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTableRecord->close();
pLine->close();
发表于 2004-10-7 19:07:00 | 显示全部楼层

回复

参考: void getUcsToWcsMatrix(AcGeMatrix3d& m, AcDbDatabase* db)
{
ASSERT(db != NULL); if (!acdbUcsMatrix(m, db)) {
m.setToIdentity();
ASSERT(0);
}
} void ucsToWcs(AcGePoint3dArray& ptArray)
{
AcDbDatabase* db = acdbHostApplicationServices()->workingDatabase();
ASSERT(db != NULL); AcGeMatrix3d m;
getUcsToWcsMatrix(m, db); int len = ptArray.length();
for (int i=0; i<len; i++)
ptArray = m * ptArray;
} // ----- asdktest._test command (do not rename)
static void asdktest_test(void)
{
// Add your code for command asdktest._test here
int i; AcDbObjectId lineId;
AcDbObjectId ptId;
AcGePoint3d Pt; AcDb3dPolyline *pLine; AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead); AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);
pBlockTable->close(); AcGeMatrix3d ucsToWcsMat; acdbUcsMatrix(ucsToWcsMat); AcGePoint3dArray vertices; for(i=1;i<=10;i++)
{
Pt.x=i;
Pt.y=i;
Pt.z=0.0;
vertices.append(Pt);
} pLine = new AcDb3dPolyline(AcDb::k3dSimplePoly, vertices);
pLine->setDatabaseDefaults();

pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTableRecord->close();
pLine->close();
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2004-10-8 08:54:00 | 显示全部楼层
成功了,非常感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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