求助 小弟新手请大虾指点 谢谢!
#include "StdAfx.h"
#include "StdArx.h"
#include "dbents.h"
//-----------------------------------------------------------------------------
// This is command 'CREATLINE, by, ,
void lgqBASICCreatLine()
{
#ifdef OARXWIZDEBUG
acutPrintf ("\nOARXWIZDEBUG - lgqBASICCreatLine() called.");
#endif // OARXWIZDEBUG
// TODO: Implement the command
//在内存上创建一个新的AcDbLine对象
AcGePoint3d ptStart(0,0,0);
AcGePoint3d ptEnd(100,100,0);
AcDbLine *pLine=new AcDbLine(ptStart,ptEnd);
//获得块表的指针
AcDbBlockTableRecord *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getBlockTable(pBlockTable,AcDb::kForRead);
//获得指向特定的块表的指针
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,
AcDb::kForWrite);
//将AcDbLine类的对象添加到块表记录中
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId,pLine);
//关闭图形数据库的各种对象
pBlockTable->close();
pBlockTableRecord->close();
pLine->close();
}
错误提示:
-------------------Configuration: CreatLineCommands - Win32 Debug--------------------
Compiling...
CreatLineCommands.cpp
G:\objectarx\CreatLine\CreatLineCommands.cpp(23) : error C2664: 'enum Acad::ErrorStatus __thiscall AcDbDatabase::getBlockTable(class AcDbSymbolTable *& ,enum AcDb::OpenMode)' : cannot convert parameter 1 from 'class AcDbBlockTableRecord *' to 'class
AcDbSymbolTable *& '
A reference that is not to 'const' cannot be bound to a non-lvalue
G:\objectarx\CreatLine\CreatLineCommands.cpp(26) : error C2039: 'getAt' : is not a member of 'AcDbBlockTableRecord'
e:\k030.arx.plus\inc\dbsymtb.h(635) : see declaration of 'AcDbBlockTableRecord'
Error executing cl.exe.
CreatLineCommands.exe - 2 error(s), 0 warning(s)
//获得块表的指针
AcDbBlockTableRecord *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getBlockTable(pBlockTable,AcDb::kForRead);
应该是 getSymbolTalble(pBlockTable,AcDb::kForRead) 错误在这里:
//获得块表的指针
AcDbBlockTableRecord *pBlockTable;
这里你应该是定义块表指针,所以应该是AcDbBlockTable *pBlockTable;
页:
[1]