本文整理汇总了C++中AcDbObjectId类的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObjectId类的具体用法?C++ AcDbObjectId怎么用?C++ AcDbObjectId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AcDbObjectId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDataObjectFromExtDict
// 从图元的扩展词典中查找数据对象
static void GetDataObjectFromExtDict( AcDbObjectIdArray& dbObjIds )
{
AcDbObjectIdArray allObjIds;
ArxDataTool::GetEntsByType( _T( "MineGE" ), allObjIds, true );
// 判断是否数据对象DataObject
// 且类型名称==type
if( allObjIds.isEmpty() ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = allObjIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;
MineGE* pGE = MineGE::cast( pObj );
if( pGE == 0 ) continue;
AcDbObjectId dbObjId = pGE->getDataObject();
if( !dbObjId.isNull() )
{
dbObjIds.append( dbObjId );
}
}
actrTransactionManager->endTransaction();
}
示例2: DrawMText
void DrawMText( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, const CString& str, double height, AcDbMText::AttachmentPoint ap, const CString& style )
{
//acutPrintf(_T("\n绘制前--文字颜色:%d"), mode->subEntityTraits().color());
AcDbMText mt;
// //AcDbObjectId style; // 文字样式
AcDbObjectId fontId = GetTextStyle(style);
if(!fontId.isNull())
{
acutPrintf(_T("\n设置样式为罗马字体"));
mt.setTextStyle(fontId);
}
mt.setLocation( pt );
mt.setTextHeight( height );
mt.setAttachment( ap );
mt.setRotation( angle );
mt.setContents( str );
// 经过测试发现,AcDbMText调用worldDraw的同时会修改mode的一些属性
mt.setColorIndex( mode->subEntityTraits().color() );
mt.worldDraw( mode );
//acutPrintf(_T("\n绘制后--文字颜色:%d"), mode->subEntityTraits().color());
}
示例3: _T
void DrawCmd::DrawLocalFan()
{
AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
if( objId.isNull() ) return;
if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;
AcDbObjectIdArray objIds;
DrawHelper::GetTagGEById2( objId, _T( "LocalFan" ), objIds );
if( !objIds.isEmpty() )
{
AfxMessageBox( _T( "该掘进工作面已设置了局部通风机!" ) );
return;
}
AcGePoint3d pt;
if( !ArxUtilHelper::PromptPt( _T( "\n请指定局扇的插入点坐标:" ), pt ) ) return;
Fan* pFan = new LocalFan( pt, 0 ); // 目前假设局扇的角度为0(实际绘图中局扇是没有方向的)
if( pFan == 0 ) return;
pFan->setRelatedGE( objId ); // 关联巷道
// 初始化并提交到数据库
if( !ArxUtilHelper::PostToModelSpace( pFan ) ) delete pFan;
}
示例4: acutPrintf
void
AsdkWblockReactor::otherWblock(AcDbDatabase* pDestDb,
AcDbIdMapping& idMap,
AcDbDatabase* pSrcDb)
{
AcDbBlockTable *pDestBlockTable;
AcDbBlockTableRecord *pDestBTR;
pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
pDestBlockTable->getAt(ACDB_MODEL_SPACE,
pDestBTR, AcDb::kForRead);
pDestBlockTable->close();
// Now pDestBTR is pointing to pSrcDb database's Model
// Space not to the destination database's Model Space!
// The code above is not correct!
// END CODE APPEARING IN SDK DOCUMENT.
acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
AcDbBlockTable *pSrcBlockTable;
AcDbObjectId srcModelSpaceId;
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
srcModelSpaceId.asOldId());
}
示例5: _T
void DrawCmd::DrawJoint()
{
AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道、或掘进工作面:" ) );
if( objId.isNull() ) return;
if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
{
actrTransactionManager->abortTransaction();
return;
}
LinkedGE* pEdge = LinkedGE::cast( pObj );
if( pEdge == 0 )
{
actrTransactionManager->abortTransaction();
return;
}
actrTransactionManager->endTransaction();
AcGePoint3d spt,ept;
pEdge->getSEPoint(spt,ept);
AcGePoint3d pt;
if( !PromptInsertPt( objId, pt ) ) return;
double angle;
if( !GetClosePtAndAngle( objId, pt, angle ) ) return;
SplitByPoint(objId,spt,ept,pt);
CreatJoint( objId, pt, angle );
}
示例6: _T
void WindStationDockBarChildDlg::OnBnClickedAirSelBtn()
{
// 拾取按钮
//BeginEditorCommand();
AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道: " ) );
//CompleteEditorCommand();
if( !objId.isNull() )
{
//MessageBox(_T("拾取成功"));
int pos = m_objIds.find( objId );
if( pos != -1 )
{
//滚动条自动滚动该行,并选中
m_list.EnsureVisible( pos, FALSE );
m_list.SetItemState( pos, LVIS_SELECTED, LVIS_SELECTED );
// 取消选中
//m_list.SetItemState(pos, NULL, NULL);
}
}
else
{
MessageBox( _T( "拾取失败" ) );
}
}
示例7: caclStartPoint
AcDbObjectId DoubleLine::draw()
{
//计算始端的2个坐标
AcGePoint3d m_leftStartPt, m_leftEndPt;
AcGePoint3d m_rightStartPt, m_rightEndPt;
caclStartPoint( m_leftStartPt, m_rightStartPt );
//计算末端的2个坐标
caclEndPoint( m_leftEndPt, m_rightEndPt );
//绘制2条直线
AcDbObjectId line1 = ArxDrawHelper::DrawLine( m_leftStartPt, m_leftEndPt );
AcDbObjectId line2 = ArxDrawHelper::DrawLine( m_rightStartPt, m_rightEndPt );
//构造group
AcDbObjectIdArray objIds;
objIds.append( line1 );
objIds.append( line2 );
//构造临时的组名
CString name;
name.Format( _T( "巷道%d" ), count++ );
AcDbObjectId groupId = ArxGroupHelper::CreateGroup( name, objIds );
if( !groupId.isNull() )
{
ArxGroupHelper::ConvertToAnonymousGroup( groupId );
}
return groupId;
}
示例8: regPropertyDataNames
void BlockDraw::explodeBlock( AcGeVoidPointerArray& ents )
{
// 填充属性数据
AcStringArray names;
regPropertyDataNames( names );
if( names.isEmpty() )
{
acutPrintf( _T( "\n没有注册要提取的字段..." ) );
return;
}
if( names.length() != m_attValues.length() )
{
acutPrintf( _T( "\n注册的属性数据与读取的数据个数不相等!" ) );
return;
}
AcDbObjectId blkId = GetBlockDefinitionByName( m_blockName );
if( blkId.isNull() )
{
acutPrintf( _T( "\n未知的块定义:%s" ), m_blockName );
return;
}
// 计算变换矩阵
AcGeMatrix3d blkXform = GetBlockTransformMatrix( blkId, m_insertPt, m_angle, m_scale );
// 分解块定义
BlockToEntity( blkId, blkXform, names, m_attValues, ents );
}
示例9: acutPrintf
void DrawCmd::DrawChimney( void )
{
acutPrintf( _T( "\n绘制风筒测试..." ) );
AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
if( objId.isNull() ) return;
if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;
AcDbObjectIdArray objIds;
DrawHelper::GetTagGEById2( objId, _T( "Chimney" ), objIds );
if( !objIds.isEmpty() )
{
AfxMessageBox( _T( "该掘进工作面已设置了风筒!" ) );
return;
}
AcGePoint3dArray pts;
PolyLineJig jig;
if( !jig.doJig( pts ) ) return;
int len = pts.length();
acutPrintf( _T( "\n点个数:%d" ), len );
if( len < 2 ) return;
Chimney* pChimney = new Chimney();
pChimney->setRelatedGE( objId ); // 关联的图元必须是掘进工作面
for( int i = 0; i < len; i++ ) pChimney->addControlPoint( pts[i] );
// 初始化并提交到数据库
if( !ArxUtilHelper::PostToModelSpace( pChimney ) ) delete pChimney;
}
示例10: while
Acad::ErrorStatus
ArxDbgPersistentObjReactor::dxfInFields(AcDbDxfFiler* filer)
{
Acad::ErrorStatus es;
if (((es = AcDbObject::dxfInFields(filer)) != Acad::eOk) ||
(filer->atSubclassData(this->desc()->name()) != Adesk::kTrue))
return filer->filerStatus();
resbuf rb;
m_attachedToObjs.setLogicalLength(0);
while ((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk)) {
if (rb.restype == AcDb::kDxfSoftPointerId) {
AcDbObjectId tmpId;
tmpId.setFromOldId(rb.resval.rlong);
if (tmpId.isNull() == false)
m_attachedToObjs.append(tmpId);
}
else {
filer->pushBackItem();
es = Acad::eEndOfFile;
}
}
if (es != Acad::eEndOfFile)
return Acad::eInvalidResBuf;
return filer->filerStatus();
}
示例11: while
Acad::ErrorStatus
ArxDbgDbAdeskLogoStyle::dxfInFields(AcDbDxfFiler* filer)
{
Acad::ErrorStatus es;
if (((es = ArxDbgDbDictRecord::dxfInFields(filer)) != Acad::eOk) ||
(filer->atSubclassData(this->desc()->name()) != Adesk::kTrue))
return filer->filerStatus();
resbuf rb;
while ((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk)) {
if (rb.restype == kDxfSolidFill) {
bool doSolidFill = (rb.resval.rint == 0) ? false : true;
setSolidFill(doSolidFill);
}
else if (rb.restype == kDxfLabel)
setLabel(rb.resval.rstring); // NOTE: normally have to free string from resbuf... not in this case, DXF Filer does
else if (rb.restype == kDxfTextStyle) {
AcDbObjectId tmpId;
tmpId.setFromOldId(rb.resval.rlong);
setTextStyleId(tmpId);
}
else {
filer->pushBackItem();
es = Acad::eEndOfFile;
}
}
if (es != Acad::eEndOfFile)
return Acad::eInvalidResBuf;
return filer->filerStatus();
}
示例12:
ArxDictTool2* ArxDictTool2::GetDictTool( const CString& dictName )
{
AcDbObjectId dictId = ArxDictTool::GetDict( dictName );
if( dictId.isNull() )
return 0;
else
return new ArxDictTool2( dictId );
}
示例13: _T
void UIHelper::DisplayData()
{
// 显示图元的属性数据
AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个图元:" ) );
if( objId.isNull() ) return;
PropertyDataDlgHelper::DisplayPropertyDataDlg( objId );
}
示例14: AsdkSelectionFilterUI_SubentSel
// ----- AsdkSelectionFilterUI.SubentSel command (do not rename)
static void AsdkSelectionFilterUI_SubentSel(void)
{
// we have to allow duplicates; otherwise, the xref would be selectable
// only once (because the main entity is the one that counts).
setAllowDuplicateSelection(curDoc(), true);
ads_name sset, eName;
AcDbObjectId id;
// "_:n" gives us nested entities
//
if (RTNORM == acedSSGet("_:n", NULL, NULL, NULL, sset))
{
acutPrintf("\n");
long len = 0;
acedSSLength(sset, &len);
for (long i = 0; i < len; i++)// For each entity in sset
{
resbuf *rb = NULL;
// We use ssnamex() here, because the regular ssname()
// would give only the main entity (the xref)
//
if (RTNORM == acedSSNameX(&rb, sset, i))//Get the sub entity
{
resbuf *rbWalk = rb;
while (NULL != rbWalk)
{
if (RTENAME == rbWalk->restype)
{
eName[0] = rbWalk->resval.rlname[0];
eName[1] = rbWalk->resval.rlname[1];
if(Acad::eOk == acdbGetObjectId(id, eName))
{
acutPrintf("Entity %d: <%x>", i, id.asOldId());
AcDbEntity *pEnt;
if (Acad::eOk == acdbOpenObject(pEnt, id, AcDb::kForRead))
{
acutPrintf("(%s)\n", pEnt->isA()->name());
pEnt->close();
}
else
acutPrintf("\nCouldn't open object");
}
rbWalk = NULL; //force quit out of loop
}
else
rbWalk = rbWalk->rbnext;
}
acutRelRb(rb);
}
}
acedSSFree(sset);
}
setAllowDuplicateSelection(curDoc(), false);
}
示例15: acdbOpenAcDbObject
void
AsdkWblockReactor::otherWblock(AcDbDatabase* pDestDb,
AcDbIdMapping& idMap,
AcDbDatabase* pSrcDb)
{
// To find the destination Model Space, you must look
// it up in the ID map:
AcDbBlockTable *pSrcBlockTable;
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
AcDbObjectId srcModelSpaceId;
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
AcDbIdPair idPair;
idPair.setKey(srcModelSpaceId);
idMap.compute(idPair);
AcDbBlockTableRecord *pDestBTR;
acdbOpenAcDbObject((AcDbObject*&)pDestBTR,
idPair.value(), AcDb::kForRead, Adesk::kTrue);
// END CODE APPEARING IN SDK DOCUMENT.
acutPrintf("\nCorrect destination BTR's ObjectId is:\t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
// Incorrect way done here so that the wrong value can be
// compared to the correct value
//
AcDbBlockTable *pDestBlockTable;
pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
pDestBlockTable->getAt(ACDB_MODEL_SPACE,
pDestBTR, AcDb::kForRead);
pDestBlockTable->close();
acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
// source database Model Space BTR's ObjectId is shown to
// demonstrate that this is what the incorrect method gets
//
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
srcModelSpaceId.asOldId());
}