马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
下面代码,将选择的INSERT上的所有属性X,Y方向分别移动10个单位。
[C++] 纯文本查看 复制代码 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;
} |