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




Вставлять блок с атрибутами в рисунок - часть 3


// We have a non-constant attribute definition,

// so build an attribute entity.

//

AcDbAttribute *pAtt = new AcDbAttribute();

pAtt->setPropertiesFrom(pAttdef);

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

// Translate the attribute by block reference.

// To be really correct, the entire block

// reference transform should be applied here.

//

basePoint = pAttdef->position();

basePoint += pBlkRef->position().asVector();

pAtt->setPosition(basePoint);

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

pAtt->setRotation(pAttdef->rotation());

pAtt->setTag("Tag");

pAtt->setFieldLength(25);

char *pStr = pAttdef->tag();

pAtt->setTag(pStr);

free(pStr);

pAtt->setFieldLength(pAttdef->fieldLength());

// The database column value should be displayed.

// INSERT prompts for this.

//

pAtt->setTextString("Assigned Attribute Value");

AcDbObjectId attId;

pBlkRef->appendAttribute(attId, pAtt);

pAtt->close();

}

pEnt->close(); // use pEnt... pAttdef might be NULL

}

delete pIterator;

pBlockDef->close();

pBlkRef->close();

}




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