找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 414|回复: 2

[ARX函数]:帮忙了!!!

[复制链接]
发表于 2002-11-24 22:39:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
编译通过(为什么运行重视出现对话框‘读写错误“
谢指点)dys-cj@home.ncidi.com...
原程序如下:
  1. [font=courier new]
  2. CString fname=getfilename.file1;
  3.         CString addintional="d:\";
  4.         fname=addintional+fname+".dwg";
  5.         //additional prase
  6.         //

  7.         acutPrintf("fname.....%s\n",fname);
  8.         //end.cj

  9.         AcDbDatabase* pDb;
  10.         AcDbObjectId transId;
  11.         pDb = new AcDbDatabase(Adesk::kFalse);
  12.         pDb->readDwgFile(fname);
  13.     if (pDb->readDwgFile(fname) != Acad::eOk)
  14.         {
  15.         acutPrintf("\nSorry, that draing is probably already open.\n");
  16.         return;
  17.     }
  18.     // Get the Block Table and then the model space record.
  19.     //
  20.     AcDbBlockTable *pBlockTable;
  21.     pDb->getSymbolTable(pBlockTable, AcDb::kForRead);
  22.     AcDbBlockTableRecord *pOtherMsBtr;
  23.     pBlockTable->getAt(ACDB_MODEL_SPACE, pOtherMsBtr, AcDb::kForRead);
  24.     pBlockTable->close();
  25.     // Create an iterator.
  26.     //
  27.     AcDbBlockTableRecordIterator *pIter;
  28.     pOtherMsBtr->newIterator(pIter);
  29.     // Set up an object ID array.
  30.     //
  31.     AcDbObjectIdArray objIdArray;
  32.     // Iterate over the model space BTR. Look specifically
  33.     // for lines and append their object ID to the array.
  34.     //
  35.     for (pIter->start(); !pIter->done(); pIter->step())
  36.         {
  37.         AcDbEntity *pEntity;//AcDbText *pEntitytext;
  38.         pIter->getEntity(pEntity, AcDb::kForRead);
  39.         // Look for only AcDbLine objects and add them to the
  40.         // object ID array.
  41.         //
  42.         if (pEntity->isKindOf(AcDbText::desc()))
  43.                 {
  44.             objIdArray.append(pEntity->objectId());
  45.         }
  46.         //        pEntitytext->close();
  47.                 acutPrintf("111d\n");
  48.         pEntity->close();
  49.     }
  50.     delete pIter;
  51.     pOtherMsBtr->close();
  52.     if (objIdArray.isEmpty())
  53.         {
  54.         //acutPrintf("\nYou must pick a drawing file that contains lines.");
  55.         return;
  56.     }
  57.     // Now get the current database and the object ID for the
  58.     // current database's model space BTR.
  59.     //
  60.     AcDbBlockTable *pThisBlockTable;
  61.     acdbHostApplicationServices()->workingDatabase()
  62.         ->getSymbolTable(pThisBlockTable, AcDb::kForRead);
  63.     AcDbBlockTableRecord *pThisMsBtr;
  64.     pThisBlockTable->getAt(ACDB_MODEL_SPACE, pThisMsBtr, AcDb::kForWrite);
  65.     pThisBlockTable->close();
  66.     AcDbObjectId id = pThisMsBtr->objectId();
  67.     pThisMsBtr->close();
  68.     // Create the long transaction. This will check all the entities
  69.     // out of the external database.
  70.     //
  71.     AcDbIdMapping errorMap;
  72.     acapLongTransactionManagerPtr()->checkOut(transId, objIdArray, id, errorMap);

  73.     // Now modify the color of these entities.
  74.     //
  75.     AcDbObject* pObj;
  76.         //w .by.cj

  77.         //w.by.cj

  78.     if (acdbOpenObject(pObj, transId, AcDb::kForRead) == Acad::eOk)
  79.         {
  80.         AcDbLongTransaction* pLongTrans = AcDbLongTransaction::cast(pObj);
  81.         if (pLongTrans != NULL)
  82.                 {
  83.             // Get a work set iterator.
  84.             //
  85.             AcDbLongTransWorkSetIterator* pWorkSetIter;
  86.             pLongTrans->newWorkSetIterator(pWorkSetIter);

  87.                         //add///cj
  88.                        
  89.                         for (pWorkSetIter->start(); !pWorkSetIter->done(); pWorkSetIter->step())
  90.                         {
  91.                 AcDbText *pEntity;
  92.                 acdbOpenObject(pEntity, pWorkSetIter->objectId(), AcDb::kForWrite);
  93.                 //假如语句       
  94.         if(pEntity->textString()=="yyy"                               
  95.         {
  96. pEntity->setTextString("xxx");
  97.                                 }
  98.                     pEntity->close();
  99.             }
  100.             delete pWorkSetIter;
  101.         }
  102.         pObj->close();
  103.         }
  104.      acapLongTransactionManagerPtr()->checkIn(transId, errorMap);
  105.         pDb->saveAs(fname);
  106.         delete pDb;
  107.         pDb = NULL;
  108.         acutPrintf("ddd,end....%s",fname);
  109. //        acad_free(fname);
  110. }
  111. [/font]
复制代码
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-11-24 22:41:42 | 显示全部楼层

Re: [ARX函数]:帮忙了!!!

最初由 chenji 发布
[B]编译通过(为什么运行重视出现对话框‘读写错误“
谢指点)dys-cj@home.ncidi.com...
原程序如下:
CString fname=getfilename.file1;
        CString addintional="d:\\";
        fname=addintional+fname+".dwg";
        //add... [/B]


你把提示你出错的信息贴上来,通过它可以方便查找。

你用了很多PRINT语句,告诉下,在哪行的PRINT显示后,出现提示错误的。

并说明下,这个程序你要做什么?那个功能完成后出现错误的,提供的信息越多,越方便大家为你看。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2002-11-25 20:09:38 | 显示全部楼层
昨天,我的问题已经自己解决了。。。。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-6-27 07:27 , Processed in 0.373685 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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