컴퓨터 지식 네트워크 - 컴퓨터 프로그래밍 - ARX 삽입 블록의 코드에 대하여

ARX 삽입 블록의 코드에 대하여

직접 해결하셨습니다

그렇습니다.

void CAddBlock::OnOK()

{

CDialog::OnOK();

//삽입할 블록 이름 가져오기

CString 블록 이름

m_listctrl.GetLBText(m_listctrl.GetCurSel( ) ,blockname);

//blockname = "CHART-20";

//정의되었는지 확인

AcDbDatabase *pCurDb = acdbHostApplicationServices ()->workingDatabase();

AcDbBlockTable *pBlkTable;

AcDbObjectId blockId;

pCurDb->getBlockTable(pBlkTable, AcDb::kForRead); /p>

if(!pBlkTable->has(블록 이름))

{

pBlkTable->close();

AcDbDatabase *pDwg = 새로운 AcDbDatabase ( Adesk::kFalse) ;

char dir[MAX_PATH];

GetModuleFileName(NULL,dir,MAX_PATH);

dir[CString(dir) ).ReverseFind ('\')]='\0';

//AfxMessageBox(CString(dir)+"\\survingpack\\"+blockname+".dwg");

pDwg->readDwgFile (CString(dir)+"\\survingpack\\"+blockname+".dwg") ;

Acad::ErrorStatus es = pCurDb->insert(blockId, 블록 이름, pDwg); //, Adesk::kFalse) ; //

pDwg 삭제

if ( es != Acad::eOk )

{

acutPrintf ("\n삽입 블록 오류.") ;

return;

}

}

else

p>

pBlkTable->getAt(blockname, blockId)

BeginEditorCommand();

//ShowWindow(SW_HIDE);

ads_point pt= {0,0,0};

int rc=acedGetPoint(NULL,"\n삽입 지점 선택:",pt);

if (rc==RTCAN ||rc ==RTNONE)

{

acutPrintf("\n*삽입 작업이 취소되었습니다*");

CancelEditorCommand();

return;

}

CompleteEditorCommand();

//----삽입점, 회전 각도, 배율 등을 설정합니다.

AcDbBlock참조

*pBlkRef =new AcDbBlockReference(AcGePoint3d(pt[0],pt[1],pt[2]),blockId)

//pBlkRef->setBlockTableRecord (blockId); >pBlkRef->setScaleFactors(AcGeScale3d(m_scale,m_scale,1));

//pBlkRef->setPosition(AcGePoint3d(pt[0],pt[1],pt[2])); /p>

pBlkRef->setRotation (m_angle);

pBlkRef->setLayer(NULL); //레이어 설정

//모델 공간 블록 테이블 레코드 가져오기< / p>

AcDbBlockTable *pBlockTable

acdbHostApplicationServices()->workingDatabase()->getBlockTable (pBlockTable, AcDb::kForRead)

AcDbBlockTableRecord *pBlockTableRecord; >

p>

pBlockTable->getAt (ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite)

pBlockTable->close ()

pBlockTableRecord->appendAcDbEntity( pBlkRef);

//속성 가져오기

AcDbBlockTableRecord *pBlkDefRecord;

acdbOpenObject(pBlkDefRecord, blockId, AcDb::kForRead)

if(pBlkDefRecord ->hasAttributeDefinitions())

{

//AcDbObjectIterator* pBlkIterator = pBlkRef->attributeIterator() //수정

AcDbBlockTableRecordIterator * pIterator;

pBlkDefRecord->newIterator(pIterator);

for(pIterator->start(); !pIterator->done();pIterator->step())

p>

{

AcDbEntity *pEnt;

pIterator->getEntity(pEnt, AcDb::kForRead);

AcDbAttributeDefinition *pAttDef = AcDbAttributeDefinition: :cast(pEnt );

if(pAttDef != NULL && !pAttDef->isConstant())

{

AcDbAttribute* pAtt = new AcDbAttribute( );

pAtt->setPropertiesFrom(pAttDef);

pAtt->setInvisible( pAttDef->isInvisible() );

pAtt->setHorizontalMode(pAttDef->horizontalMode());

pAtt-> setVerticalMode(pAttDef->verticalMode());

/* AcGePoint3d basePt = pAttDef->position();

basePt[0]+=pt[0];

basePt[1]+=pt[1];

basePt[2]+=pt[2];

pAtt->setPosition(basePt);

p> p>

*/

AcGePoint3d basePt = pAttDef->alignmentPoint();

basePt[0]+=pt[0];

basePt [1]+=pt[1];

basePt[2]+=pt[2];

pAtt->setAlignmentPoint(basePt);

pAtt->setHeight(pAttDef->height());

pAtt->setTextStyle(pAttDef->textStyle());

pAtt->setTag(pAttDef-> tag( ));

pAtt->setTextString(m_attrib);

pAtt->setFieldLength(25)

pBlkRef->appendAttribute(pAtt);

pAtt->setFieldLength(25); p>

pAtt->close();

pEnt->close();

}

}

delete pIterator;

}//end if pBlkDefRecord->hasAttributeDefinitions

pBlkDefRecord->close();

pBlockTableRecord->close();

pBlkRef->close();

}

上篇: 산업증권 주식 거래 소프트웨어가 파일을 확인하지 못했습니다. 下篇: 신뢰는 종이 한 장과 같다
관련 내용