ObjectArx学习笔记-获取某一图层上所有直线
2014-05-28 09:06
183 查看
//----------------------------------------------------------------------------- //----- acrxEntryPoint.h //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include "dbsymtb.h" //----------------------------------------------------------------------------- #define szRDS _RXST("qxzy") //----------------------------------------------------------------------------- //----- ObjectARX EntryPoint class CGetEntsOnLayerApp : public AcRxArxApp { public: CGetEntsOnLayerApp () : AcRxArxApp () {} virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) { // TODO: Load dependencies here // You *must* call On_kInitAppMsg here AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ; // TODO: Add your initialization code here return (retCode) ; } virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) { // TODO: Add your code here // You *must* call On_kUnloadAppMsg here AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ; // TODO: Unload dependencies here return (retCode) ; } virtual void RegisterServerComponents () { } public: // - qxzyGetEntsOnLayer._GetEntsOnLayer command (do not rename) static void qxzyGetEntsOnLayer_GetEntsOnLayer(void) { // Add your code for command qxzyGetEntsOnLayer._GetEntsOnLayer here AcDbLayerTable *pLayerTbl; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLayerTbl,AcDb::kForRead); if(!pLayerTbl->has(_T("测试"))) { acutPrintf(_T("\n当前图形中未包含\"测试\"图层!")); pLayerTbl->close(); return; } AcDbObjectId layerId; pLayerTbl->getAt(_T("测试"),layerId); pLayerTbl->close(); AcDbBlockTable *pBlkTbl; acdbHostApplicationServices()->workingDatabase() ->getBlockTable(pBlkTbl, AcDb::kForRead); AcDbBlockTableRecord *pBlkTblRcd; pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForRead); pBlkTbl->close(); AcDbBlockTableRecordIterator *pltr; pBlkTblRcd->newIterator(pltr); AcDbEntity *pEnt; for(pltr->start();!pltr->done();pltr->step()) { pltr->getEntity(pEnt, AcDb::kForWrite); if(pEnt->layerId() == layerId) { //whether it's a line AcDbLine *pLine = AcDbLine::cast(pEnt); if(pLine != NULL); { pLine->setColorIndex(1); } } pEnt->close(); } delete pltr; pBlkTblRcd->close(); } } ; //----------------------------------------------------------------------------- IMPLEMENT_ARX_ENTRYPOINT(CGetEntsOnLayerApp) ACED_ARXCOMMAND_ENTRY_AUTO(CGetEntsOnLayerApp, qxzyGetEntsOnLayer, _GetEntsOnLayer, GetEntsOnLayer, ACRX_CMD_TRANSPARENT, NULL)
相关文章推荐
- ObjectArx学习笔记-导入导出图层列表
- objectARX获取当前图层所有文字样式
- sencha touch权威指南---学习笔记5-经纬度获取计算直线距离
- ObjectARX 获取指定一个图层中的所有实体
- Java File类学习笔记1:运用FileNameFilter类,获得某一目录下所有指定扩展名的文件
- C#学习笔记(21)——C#获取文件夹下的所有文件的文件名
- Qt学习笔记,获取给定目录下面的所有文件名,及其path
- objectARX 获取指定图层上所有实体ID
- 网络编程学习笔记(获取所有网络接口)
- ObjectARX学习笔记之直线(1)
- 安卓学习笔记---如何保存数据到SharePreference里面,获取所有sp文件以及删除文件
- Qt学习笔记,获取给定目录下面的所有文件名,及其path
- WinApi学习笔记-获取光驱中的信息
- AE学习笔记(三)——ArcScene下设置图层BaseHeight
- 获取所有图层中选择的feature
- 孙鑫VC++视频学习笔记之8: MFC中指针的获取
- 学习笔记(JSJ-servlet获取请求头信息)
- ADF学习笔记之客户端获取组件对象
- 【ext js 学习笔记】获取后台返回的自定义错误信息
- ExtJs学习笔记(7)_获取GridPanel选中行的详细信息 (转)