CAD+开发小结+交互+选择集+深度拷贝AcDbObjectId中指向的实体集+读取其他DWG文件

    xiaoxiao2026-08-25  0

    深度拷贝将数组中的实体ID指向的实体拷贝至blockId为ID的块中 AcDbIdMapping         adimIdMap; AcApDocument* pDoc = acDocManager->curDocument(); acDocManager->lockDocument(pDoc, AcAp::kWrite);//锁定当前文档 acdbHostApplicationServices()->workingDatabase()->deepCloneObjects(ptarr, blockId, adimIdMap);//克隆当前选中的实体到块中

    acDocManager->unlockDocument(pDoc);//解锁文档

    //同样用于拷贝AcDbObjectIdArray 中的实体对象到owner指向的实体中。

    Acad::ErrorStatus wblockCloneObjects( AcDbObjectIdArray& objectIds, AcDbObjectId& owner, AcDbIdMapping& idMap, AcDb::DuplicateRecordCloning drc, bool deferXlation = false ); Parameters Parameters  Description  AcDbObjectIdArray& objectIds  Input array of objects to be deep cloned  AcDbObjectId& owner  Input object ID of object to be the owner of the clones  AcDbIdMapping& idMap  Returns array of AcDbIdPair objects to be used for translating object ID relationships  AcDb::DuplicateRecordCloning drc  Input action for duplicate records  bool deferXlation = false  Input Boolean indicating whether or not ID translation should be done 

    CAD中,需要用户与界面进行交互时,无需用MFC的方法将界面可见性设置为False,直接以以下形式进行。

    BeginEditorCommand

    交互操作,如acedssget();

    CompleteEditorCommand   //完成交互

    CancelEditorCommand//取消交互

    acedSSGet获取选择集 ads_ssadd添加一个实体至一个选择集中 acedSSSetFirst 执行命令之前的选择集,先选择后执行命令。

    //读取其他DWG文件并导入数据库

    //AcDbDatabase(bool buildDefaultDrawing = true, bool noDocument = false) 

    //buildDefaultDrawing: 是否创建一个新的图形库,也就是是否包含数据库的初始内容。noDocument新建图形数据库是否与当前文档相关联。

    //noDocument: 指出新建的图形数据库是否与当前文档相关联。

    //一般来说,后台创建一个空白数据库在其中绘图,参数一般设置为true、false;

    //若是读取已经存在的DWG文件,参数设置为false,false;

    AcDbDatabase* pSourceDwg = new AcDbDatabase(false);        Acad::ErrorStatus es = pSourceDwg->readDwgFile(fileName, _SH_DENYNO); pSourceDwg->saveAs(fileName);
    转载请注明原文地址: https://ju.6miu.com/read-1311554.html
    最新回复(0)