明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2588|回复: 2

[ARX]派生于AcDbObject的定制类实体加入到对象字典的问题??

[复制链接]
发表于 2005-1-10 00:06:00 | 显示全部楼层 |阅读模式
我自己写了一个类要加入字典中,但调不通,请高手指点。。。 下面是代码: // ScaleClass.h: interface for the CScaleClass class.
//
////////////////////////////////////////////////////////////////////// #if !defined(AFX_SCALECLASS_H__EA5D03B9_CC89_40B1_8BB4_48EB14A3EF04__INCLUDED_)
#define AFX_SCALECLASS_H__EA5D03B9_CC89_40B1_8BB4_48EB14A3EF04__INCLUDED_ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000 class CScaleClass : public AcDbObject
{
public:
void setvScale(double vs);
void sethScale(double hs);
void getvScale(double hv);
void gethScale(double hs);
double vScale;
double hScale;
CScaleClass();
virtual ~CScaleClass(); }; #endif // !defined(AFX_SCALECLASS_H__EA5D03B9_CC89_40B1_8BB4_48EB14A3EF04__INCLUDED_)
// ScaleClass.cpp: implementation of the CScaleClass class.
//
////////////////////////////////////////////////////////////////////// #include "stdafx.h"
#include "resource.h"
#include "ScaleClass.h" #ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif //////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////////////////////////////////// CScaleClass::CScaleClass()
{
CScaleClass::rxInit();
} CScaleClass::~CScaleClass()
{ } void CScaleClass::gethScale(double hs)
{
hs=hScale;
return;
} void CScaleClass::getvScale(double hv)
{
hv=vScale;
return;
} void CScaleClass::sethScale(double hs)
{
hScale=hs;
return;
} void CScaleClass::setvScale(double vs)
{
vScale=vs;
return;
}
下面是加入程序 void GeoMapFun::createDictionary(double hs, double vs)
{
AcDbDictionary *pNamedobj;
acdbHostApplicationServices()->workingDatabase()->
getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite); // Check to see if the dictionary we want to create is
// already present. If not, create it and add
// it to the named object dictionary.
//
AcDbDictionary *pDict;
if (pNamedobj->getAt("SCALE_DICT", (AcDbObject*&) pDict,
AcDb::kForWrite) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
AcDbObjectId DictId;
pNamedobj->setAt("ASDK_DICT", pDict, DictId);
}
pNamedobj->close();
if (pDict) { // Create new objects to add to the new dictionary,
// add them, then close them.
//
CScaleClass *pObj1 = new CScaleClass();
pObj1->sethScale(hs);
pObj1->setvScale(vs);
AcDbObjectId rId1;
pDict->setAt("OBJ1", pObj1, rId1);
pObj1->close();
pDict->close();
} } void GeoMapFun::iterateDictionary(double hs, double vs)
{
AcDbDictionary *pNamedobj;
acdbHostApplicationServices()->workingDatabase()
->getNamedObjectsDictionary(pNamedobj, AcDb::kForRead); // Get a pointer to the ASDK_DICT dictionary.
//
AcDbDictionary *pDict;
pNamedobj->getAt("SCALE_DICT", (AcDbObject*&)pDict,
AcDb::kForRead);
pNamedobj->close(); // Get an iterator for the ASDK_DICT dictionary.
//
AcDbDictionaryIterator* pDictIter= pDict->newIterator();
CScaleClass *pMyCl;

for (; !pDictIter->done(); pDictIter->next()) { // Get the current record, open it for read, and
// print its data.
//
pDictIter->getObject((AcDbObject*&)pMyCl,
AcDb::kForRead);
pMyCl->gethScale(hs);
pMyCl->getvScale(vs);
pMyCl->close();
acutPrintf("\nintval is: %d", hs);
}
delete pDictIter;
pDict->close(); } 请高手指点,谢谢!!
发表于 2009-12-15 17:20:00 | 显示全部楼层

我也出现了相同的问题,请问是怎么解决的呢?

发表于 2010-9-17 15:13:00 | 显示全部楼层
顶起,希望在4楼。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-29 04:21 , Processed in 0.183473 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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