这段代码哪里有问题,为什么不能显示!!!!!!!!!!
int i;AcDbObjectId lineId;<BR> AcDbObjectId ptId;
<BR> AcGePoint3d Pt;
AcDb3dPolyline *pLine = new AcDb3dPolyline();
AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,<BR> AcDb::kForWrite);<BR> pBlockTable->close();
<BR> for(i=1;i<=10;i++)<BR> {<BR> Pt.x=i;<BR> Pt.y=i*rand();<BR> Pt.z=0.0;<BR> AcDb3dPolylineVertex *pV=new AcDb3dPolylineVertex(Pt);<BR> pLine->appendVertex(ptId,pV);<BR> }<BR> pBlockTableRecord->appendAcDbEntity(lineId, pLine); <BR> pBlockTableRecord->close();<BR> pLine->close();<BR>
回复
参考:void getUcsToWcsMatrix(AcGeMatrix3d& m, AcDbDatabase* db)<BR> {<BR> ASSERT(db != NULL);
if (!acdbUcsMatrix(m, db)) {<BR> m.setToIdentity();<BR> ASSERT(0);<BR> }<BR> }
void ucsToWcs(AcGePoint3dArray& ptArray)<BR> {<BR> AcDbDatabase* db = acdbHostApplicationServices()->workingDatabase();<BR> ASSERT(db != NULL);
AcGeMatrix3d m;<BR> getUcsToWcsMatrix(m, db);
int len = ptArray.length();<BR> for (int i=0; i<len; i++)<BR> ptArray = m * ptArray;<BR> }
// ----- asdktest._test command (do not rename)<BR> static void asdktest_test(void)<BR> {<BR> // Add your code for command asdktest._test here<BR> int i;
AcDbObjectId lineId;<BR> AcDbObjectId ptId;<BR> AcGePoint3d Pt;
AcDb3dPolyline *pLine;
AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);<BR> pBlockTable->close();
AcGeMatrix3d ucsToWcsMat;
acdbUcsMatrix(ucsToWcsMat);
AcGePoint3dArray vertices;
for(i=1;i<=10;i++)<BR> {<BR> Pt.x=i;<BR> Pt.y=i;<BR> Pt.z=0.0;<BR> vertices.append(Pt);<BR> }
pLine = new AcDb3dPolyline(AcDb::k3dSimplePoly, vertices);<BR> pLine->setDatabaseDefaults();<BR> <BR> pBlockTableRecord->appendAcDbEntity(lineId, pLine); <BR> pBlockTableRecord->close();<BR> pLine->close();<BR>}
成功了,非常感谢!
页:
[1]