|
- void Command采用MoveAttr()
- {
- ads采用name ename;
-
- ads采用point pt;
-
- if (RTNORM != acedEntSel(采用T("\nSelect Blockreference : "), ename, pt))
- {
- return;
- }
-
- AcDbObjectId objectId;
-
- acdbGetObjectId(objectId, ename);
-
- AcDbBlockReference* pBlockRef;
-
- if (acdbOpenObject(pBlockRef, objectId, AcDb::kForRead) != Acad::eOk)
- {
- acutPrintf(采用T("\nThis is not a Blockreference."));
-
- return;
- }
-
- AcDbObjectIterator *pIterator = pBlockRef->attributeIterator();
-
- for (pIterator->start(); !pIterator->done(); pIterator->step())
- {
- AcDbAttribute *pAttribute;
-
- if (acdbOpenObject(pAttribute, pIterator->objectId(), AcDb::kForWrite) == Acad::eOk)
- {
- AcGeMatrix3d transMatrix;
-
- AcGeVector3d moveVector(10, 10, 0);
-
- transMatrix.setTranslation(moveVector);
-
- pAttribute->transformBy(transMatrix);
-
- pAttribute->close();
- }
- }
-
- pBlockRef->close();
- delete pIterator;
- return;
- }
复制代码 |
|