明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2286|回复: 2

求助 小弟新手请大虾指点 谢谢!

[复制链接]
发表于 2011-10-19 18:49:27 | 显示全部楼层 |阅读模式

#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)

发表于 2011-10-20 16:58:55 | 显示全部楼层
//获得块表的指针
AcDbBlockTableRecord *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
   ->getBlockTable(pBlockTable,AcDb::kForRead);

应该是 getSymbolTalble(pBlockTable,AcDb::kForRead)
发表于 2011-11-10 09:43:43 | 显示全部楼层
错误在这里:
//获得块表的指针
AcDbBlockTableRecord *pBlockTable;
这里你应该是定义块表指针,所以应该是AcDbBlockTable *pBlockTable;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 11:03 , Processed in 0.148633 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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