기본 콘텐츠로 건너뛰기

라벨이 WBLOCK인 게시물 표시

WBLOCK 예제

현재 열려진 Database를 사용하지 않고. 임의의 Database를 생성하여 블럭을 만들 Entity들을 추가한 후 블럭을 만든다. 이런 방법을 사용하면 현재의 Drawing,에 Entity들을 그리지 않고서도 블럭을 만들기가 가능합니다. void Command_Block() { AcDbDatabase* pDatabase = new AcDbDatabase; AcGePoint3d ptStart; ptStart.x = ptStart.y = ptStart.z = 0; AcGePoint3d ptEnd; ptEnd.x = ptEnd.y = ptEnd.z = 100; AcDbLine* pLine = new AcDbLine(ptStart , ptEnd); AcDbBlockTable *pBlockTable; Acad::ErrorStatus es; es = pDatabase->getBlockTable(pBlockTable, AcDb::kForRead); if (es != Acad::eOk) { ads_alert("Failed to get the block table!"); pBlockTable->close(); return; } AcDbBlockTableRecord *pBlockRec; 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; } AcDbObjectId retId; if(pBlockRec->appendAcDbEntity(retId, pLine) != Acad::eOk) { ads_alert("Can't add entity to the blockTableR...