- 积分
- 56
- 明经币
- 个
- 注册时间
- 2011-10-13
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
#include "StdAfx.h"
#include "StdArx.h"
#include "dbents.h"
//-----------------------------------------------------------------------------
// This is command 'CREATLINE, by [2011-10-17], ,
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)
|
|