获取和修改摘要信息
static void zffObjectARX_MyCommand14(void)
{
// Add your code for command zffObjectARX._MyCommand14 here
ACHAR* fileName;
AcDbDatabase* pDb;
AcDbObjectId transId;
struct resbuf* filename;
filename=acutNewRb(RTSTR);
acedGetFileD(_T("请选择要检出的图"),NULL,_T("dwg"),0,filename);
pDb=new AcDbDatabase(Adesk::kFalse);
fileName=filename->resval.rstring;
pDb->readDwgFile(fileName);
AcDbBlockTable *pBlk=NULL;
AcDbBlockTableRecord *pBlkRcd=NULL;
pDb->getSymbolTable(pBlk,AcDb::kForRead);
pBlk->getAt(ACDB_MODEL_SPACE,pBlkRcd,AcDb::kForRead);
pBlk->close();
AcDbObjectIdArray objIds;
AcDbBlockTableRecordIterator* it=NULL;
pBlkRcd->newIterator(it);
pBlkRcd->close();
AcDbEntity* pEnt=NULL;
for (it->start();!it->done();it->step())
{
it->getEntity(pEnt,AcDb::kForRead);
if (pEnt->isKindOf(AcDbCircle::desc()))
{
objIds.append(pEnt->objectId());
}
}
pEnt->close();
delete it;
AcDbBlockTable* pBlkCur=NULL;
AcDbBlockTableRecord* pBlkRcdCur=NULL;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlkCur,AcDb::kForRead);
pBlkCur->getAt(ACDB_MODEL_SPACE,pBlkRcdCur,AcDb::kForWrite);
pBlkCur->close();
AcDbObjectId objIdCur=pBlkRcdCur->objectId();
pBlkRcdCur->close();
AcDbIdMapping p;
acapLongTransactionManagerPtr()->checkOut(transId,objIds,objIdCur,p);
//AcDbObject* pObj=NULL;
AcDbLongTransaction* pLongTrans;
if (acdbOpenObject(pLongTrans,transId,AcDb::kForWrite)==Acad::eOk)
{
//AcDbLongTransaction* pLongTrans=AcDbLongTransaction::cast(pObj);
AcDbLongTransWorkSetIterator* pItor=NULL;
pLongTrans->newWorkSetIterator(pItor);
int index;
acedGetInt(_T("\n输入要改变的颜色值:"),&index);
for (pItor->start();!pItor->done();pItor->step())
{
AcDbEntity* pEnt1=NULL;
acdbOpenObject(pEnt1,pItor->objectId(),AcDb::kForWrite);
pEnt1->setColorIndex(index);
pEnt1->close();
}
delete pItor;
ACHAR str[20]={0};
acedGetString(0,_T("\n观察实体的改变,按回车结束!"),str);
pLongTrans->close();
}
acapLongTransactionManagerPtr()->checkIn(transId,p);
pDb->saveAs(fileName);
acutRelRb(filename);
delete pDb;
pDb=NULL;
}
更多文章
-
用AcedGrRead()函数实现一拖多
实现代码:#include "StdAfx.h"#include "StdArx.h"#include "..\..\Common\我的类\Arc.h"#include <acedads.h>#include "..\..\Common\Entity\LineUtil.h"#include <geassign.h>#include <dbents.h>#include "..\..\Common\Others\ConvertUtil.h"#in
-
改变多段线区直
代码:#include "StdAfx.h"#include "StdArx.h"#include <dbpl.h>#include "..\..\Common\Others\ConvertUtil.h"#include <geassign.h>#include "..\..\Common\Entity\ArcUtil.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <afxwin.h&
-
获取任意路径Dwg文件内所有块在控件中显示并能选择插入当前模型空间
主对话框CPP内代码:#include "StdAfx.h"#include "resource.h"#include "BlockDialog.h"#include "..\..\Common\我的类\file.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <dbents.h>#include <dbmain.h>#include "..\..\Chapter11
-
多段线动态切割闭合区域
#include "StdAfx.h"#include "StdArx.h"#include <dbpl.h>#include "..\..\Common\Others\ConvertUtil.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <dbents.h>#include <dbregion.h>#include "..\..\Common\Entity\RegionUtil.h"
-
自创实体类从AcDbCurve派生,实现一些类方法并动态绘制
MyCurve.cpp:#include "StdAfx.h"#include "MyCurve.h"#include "actrans.h"#include "aced.h"//-----------------------------------------------------------------------------Adesk::UInt32 CMyCurve::kCurrentVersionNumber =1 ;//----------------------------------------