天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 80|回复: 0

cad另存为2004dwg

[复制链接]

该用户从未签到

主题

0

回帖

2912

积分

管理员

积分
2912
发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
static void  Command3(void)
{
        // Add your code for command ZHPCDC.TEST here
        Acad::ErrorStatus es;
        CString strTargetFileFullPath = TEXT("D:\\test.dwg");

        //create the new file
        AcDbDatabase *pNewDb = new AcDbDatabase(true, false);
        es = pNewDb->saveAs(strTargetFileFullPath);
        delete pNewDb;

        // get the targetDb, sourceDb and tempDb
        AcDbDatabase *pTargetDb = new AcDbDatabase(false);
        pTargetDb->readDwgFile(strTargetFileFullPath);
        AcDbDatabase *pSourceDb = acdbHostApplicationServices()->workingDatabase();
        AcDbDatabase *pTempDb = new AcDbDatabase(true, true);
        es = pSourceDb->wblock(pTempDb);
        // get the entities that need clone
        AcDbObjectIdArray idsNeedClone;
        AcDbBlockTable *pBlkTbl = NULL;
        pTempDb->getBlockTable(pBlkTbl, AcDb::kForRead);
        AcDbBlockTableRecord *pBlkTblRcd = NULL;
        pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForWrite);
        pBlkTbl->close();
        AcDbBlockTableRecordIterator *it = NULL;
        pBlkTblRcd->newIterator(it);
        for (it->start(); !it->done(); it->step())
        {
                AcDbObjectId id;
                if (Acad::eOk != it->getEntityId(id)) continue;
                idsNeedClone.append(id);
        }
        delete it;
        pBlkTblRcd->close();


        // clone from tempDb to targetDb
        pTempDb->wblock(pTargetDb, idsNeedClone, AcGePoint3d::kOrigin, AcDb::kDrcReplace);

        //redraw the entities in targetDb and saveas
         RedrawAllEntitys(pTargetDb);
        es = pTargetDb->closeInput(true);
        es = acdbSaveAs2004(pTargetDb, strTargetFileFullPath);

        delete pTargetDb;
        delete pTempDb;
}

 

 

 

 

cad另存为2004dwg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

GMT+8, 2024-11-1 12:37 , Processed in 0.145958 second(s), 28 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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