샘플 코드
#include BOOL purePaperSpace() { struct resbuf res; int tilemode, cvport; ads_getvar("tilemode", &res); tilemode = res.resval.rint; ads_getvar("cvport", &res); cvport = res.resval.rint; if(tilemode == 0 && cvport == 1) return TRUE; else return FALSE; } // Helper to posts an entity to the database Adesk::Boolean PostToDb(AcDbEntity* pEnt, AcDbObjectId& objId) { AcDbBlockTable *pBlockTable; Acad::ErrorStatus es; es = acdbCurDwg()->getBlockTable(pBlockTable, AcDb::kForRead); if (es != Acad::eOk) { ads_alert("Failed to get the block table!"); pBlockTable->close(); return Adesk::kFalse; } AcDbBlockTableRecord *pBlockRec; if(purePaperSpace()) es = pBlockTable->getAt(ACDB_PAPER_SPACE, pBlockRec, AcDb::kForWrite); else es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec, AcDb::kForWrite); if (es != Acad::eOk) { ads_alert("Failed to get the block table record!"); pBlockRec->close(); return Adesk::kFalse; } if(pBlockRec->appendAcDbEntity(objId, pEnt) != Acad::eOk){ ads_alert("Can't add entity to the blockTableRecord!"); pBlockRec->close(); return Adesk::kFalse; } es = pBlockTable->close(); assert(es == Acad::eOk); es = pBlockRec->close(); assert(es == Acad::eOk); return Adesk::kTrue; }
댓글
댓글 쓰기