TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- static void WblockIds() {
- resbuf *rb = acutNewRb(RTSTR);
- if (acedGetFileD(L"Export file", nullptr, L"dwg", 32, rb) != RTNORM)
- return;
- AcString filename = rb->resval.rstring; acutRelRb(rb);
- ads采用name ss;
- if (acedSSGet(nullptr, nullptr, nullptr, nullptr, ss) != RTNORM)
- return;
- Adesk::Int32 nSel = 0;
- acedSSLength(ss, &nSel);
- if (nSel == 0) { acedSSFree(ss); return; }
- AcDbObjectIdArray ids; ids.setPhysicalLength(nSel);
- for (int i = 0; i < nSel; i++) {
- ads采用name en; acedSSName(ss, i, en);
- AcDbObjectId id;
- if (acdbGetObjectId(id, en) == Acad::eOk) ids.append(id);
- }
- acedSSFree(ss);
- Acad::ErrorStatus es;
- AcDbDatabase *pOutputDb = new AcDbDatabase(false);
- es = pOutputDb->readDwgFile(filename, AcDbDatabase::OpenMode::kTryForReadShare);
- AcDbObjectId idModelSpace =
- AcDbSymbolUtilities::servicesPtr()->blockModelSpaceId(pOutputDb);
- AcDbIdMapping idMap;
- es = acdbCurDwg()->wblockCloneObjects(ids, idModelSpace, idMap, AcDb::DuplicateRecordCloning::kDrcReplace);
- pOutputDb->closeInput(true);
- es = pOutputDb->saveAs(filename);
- delete pOutputDb;
- }
复制代码 |
|