ObjectARX, AutoCAD. Среда программирования библиотеки C++




Высвечивание Вложенных Блочных Ссылок - часть 3


acutPrintf("\nSelect an insert");

Acad::ErrorStatus es = Acad::eOk;

AcDbEntity *ent = NULL;

AcDbEntity *ent2 = NULL;

AcDbBlockReference *blRef = NULL;

AcDbObjectId objectId, blRefId;

ads_name ename, sset;

for (;;) {

switch (acedSSGet(NULL, NULL, NULL, NULL, sset)) {

case RTNORM:

{

struct resbuf *rb;

if (acedSSNameX(&rb, sset, 0) != RTNORM) {

acutPrintf("\n acedSSNameX failed");

acedSSFree(sset);

return;

}

int sel_method;

ads_name subname;

short marker;

AcGePoint3d pickpnt;

AcGeVector3d pickvec;

if (!extractEntityInfo(rb,

sel_method,

ename,

subname,

marker,

pickpnt,

 pickvec)) {

acutPrintf("\nextractEntityInfo failed");

acedSSFree(sset);

return;

}

acedSSFree(sset);

assert(marker != 0);

if (marker == 0) {

acutPrintf("\nmarker == 0");

return;

}

// Get the insert first.

//

AOK(acdbGetObjectId(blRefId, ename));

AOK(acdbOpenAcDbEntity(ent, blRefId,

AcDb::kForRead));

assert(ent != NULL);

blRef = AcDbBlockReference::cast(ent);

if (blRef == NULL) {

acutPrintf("\nNot an insert.");

AOK(ent->close());

continue;

}

struct resbuf *insStack;

ads_point pickpoint;

ads_matrix adsmat;

pickpoint[0] = pickpnt[0];

pickpoint[1] = pickpnt[1];

pickpoint[2] = pickpnt[2];

// Now get details on the entity that was

// selected.

//

if (acedNEntSelP(NULL, ename, pickpoint, TRUE,

adsmat, &insStack) != RTNORM)

{

acutPrintf("\nFailure in acedNEntSelP");

return;

}

assert(insStack != NULL);

AOK(acdbGetObjectId(objectId, ename));

AOK(acdbOpenAcDbEntity(ent2, objectId,

AcDb::kForRead));

assert(ent2 != NULL);

// Make an array of AcDbObjectIds from the

// insertStack. Don’t use the "smart array"

// AcDbObjectIdArray class, because the

// getSubentPathsAtGsMarker() function expects argument

// eight to be of type AcDbObjectId*. Just

// make room for approximately 100 IDs in the array.

//

AcDbObjectId *idArray = new AcDbObjectId[100];

int count = 0;




Содержание  Назад  Вперед