本文整理汇总了C++中AcDbEntity::transformBy方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::transformBy方法的具体用法?C++ AcDbEntity::transformBy怎么用?C++ AcDbEntity::transformBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::transformBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CmdException
void Jig3d::apply() throw(CmdException)
{
m_xform = m_xformTemp*m_xform;
AcDbEntity* pE;
if (acdbOpenObject(pE,m_int.m_idEntity,AcDb::kForWrite)==Acad::eOk)
{
Acad::ErrorStatus es;
if ((es=pE->transformBy(m_xform))!=Acad::eOk)
throw CmdException(es,"Transformation cannot be applied to object");
pE->close();
}
}
示例2:
void ArxEntityHelper::TransformEntities2( const AcDbObjectIdArray& objIds, const AcGeMatrix3d& xform )
{
if( objIds.isEmpty() ) return;
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
AcDbEntity* pEnt;
if( Acad::eOk == acdbOpenAcDbEntity( pEnt, objIds[i], AcDb::kForWrite ) )
{
pEnt->transformBy( xform );
pEnt->close();
}
}
}
示例3: iter
Acad::ErrorStatus
ArxDbgUtils::cloneAndXformObjects(AcDbDatabase* db, const AcDbObjectIdArray& entsToClone,
const AcDbObjectId& ownerBlockId,
const AcGeMatrix3d& xformMat, bool debugSpeak)
{
ASSERT(db != NULL);
AcDbIdMapping idMap;
Acad::ErrorStatus es = db->deepCloneObjects(
const_cast<AcDbObjectIdArray&>(entsToClone),
const_cast<AcDbObjectId&>(ownerBlockId), idMap);
if (es != Acad::eOk) {
ArxDbgUtils::rxErrorMsg(es);
return es;
}
AcDbEntity* clonedEnt;
AcDbIdPair idPair;
AcDbIdMappingIter iter(idMap);
for (iter.start(); !iter.done(); iter.next()) {
if (!iter.getMap(idPair))
return Acad::eInvalidInput;
if (idPair.isCloned()) {
es = acdbOpenAcDbEntity(clonedEnt, idPair.value(), AcDb::kForWrite);
if (es == Acad::eOk) {
if (idPair.isPrimary()) {
if (debugSpeak)
acutPrintf(_T("\nCloned And Transformed: %s"), ArxDbgUtils::objToClassStr(clonedEnt));
clonedEnt->transformBy(xformMat);
}
else if (debugSpeak)
acutPrintf(_T("\nCloned: %s"), ArxDbgUtils::objToClassStr(clonedEnt));
clonedEnt->close();
}
else
ArxDbgUtils::rxErrorMsg(es);
}
}
return Acad::eOk;
}
示例4: TransformEntities
void ArxEntityHelper::TransformEntities( const AcDbObjectIdArray& objIds, const AcGeMatrix3d& xform )
{
if( objIds.isEmpty() ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForWrite ) ) continue;
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( pEnt == 0 ) continue;
pEnt->transformBy( xform );
}
actrTransactionManager->endTransaction();
}
示例5: BlockToEntity
static void BlockToEntity( const AcDbObjectId& blkId, const AcGeMatrix3d& blkXform,
const AcStringArray& names, const AcStringArray& attValues,
AcGeVoidPointerArray& ents )
{
// 将块定义分解成独立的图元
// 将属性替换成多行文字
AcTransaction* pTrans = actrTransactionManager->startTransaction();
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, blkId, AcDb::kForRead ) )
{
actrTransactionManager->abortTransaction();
return;
}
AcDbBlockTableRecord* pBTR = AcDbBlockTableRecord::cast( pObj );
// BUG:不能调用hasAttributeDefinitions()方法
// 调用之后,如果没有在块编辑器中对块进行修改,
// 那么进行移动、夹点编辑等操作,没有动态显示效果
//if(!pBTR->hasAttributeDefinitions())
//{
// // 没有属性定义
// acutPrintf(_T("\n没有属性定义"));
// actrTransactionManager->abortTransaction();
// return;
//}
AcDbBlockTableRecordIterator* pIterator;
if( Acad::eOk != pBTR->newIterator( pIterator ) )
{
actrTransactionManager->abortTransaction();
return;
}
// 遍历块中的图元,查找AcDbAttributeDefinition
for( pIterator->start( true ); !pIterator->done(); pIterator->step( true ) )
{
AcDbObjectId objId;
if( Acad::eOk != pIterator->getEntityId( objId ) ) continue;
if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) ) continue;
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( !pEnt->isKindOf( AcDbAttributeDefinition::desc() ) )
{
AcDbEntity* pClone = AcDbEntity::cast( pEnt->clone() );
pClone->transformBy( blkXform );
// 添加到实体集合
ents.append( pClone );
}
else
{
AcDbAttributeDefinition* pAttDef = AcDbAttributeDefinition::cast( pEnt );
pAttDef->convertIntoMTextAttributeDefinition( Adesk::kTrue );
// 获取标签名称
ACHAR* pTag = pAttDef->tag();
int pos = names.find( pTag );
if( pos != -1 )
{
// 获取多行文本对象
AcDbMText* pMText = pAttDef->getMTextAttributeDefinition();
pMText->transformBy( blkXform );
pMText->setContents( attValues[pos].kACharPtr() );
// 添加到实体集合
ents.append( pMText );
}
acutDelString( pTag );
}
}
delete pIterator;
actrTransactionManager->endTransaction();
}