void
ArxDbgAppEditorReactor::searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds)
{
        // get an iterator over this dictionary
    AcDbDictionaryIterator* dictIter = dict->newIterator();
    ASSERT(dictIter != NULL);

        // walk dictionary and just collect all the entries that are of the
        // given type
    AcDbObject* obj;
    for (; !dictIter->done(); dictIter->next()) {
        if (acdbOpenAcDbObject(obj, dictIter->objectId(), AcDb::kForRead) == Acad::eOk) {
            if (obj->isKindOf(ArxDbgDbDictRecord::desc())) {
                objIds.append(obj->objectId());
            }
            else if (obj->isKindOf(AcDbDictionary::desc())) {
                searchOneDictionary(AcDbDictionary::cast(obj), objIds);
            }

            obj->close();
        }
    }
    delete dictIter;
    dict->close();
}
示例#2
1
// 查找连接点junctionPt关联的分支图元(包含隐形的图元)
static void FindLinesByPoint( const AcGePoint3d& junctionPt, AcDbObjectIdArray& objIds )
{
    AcDbBlockTable* pBlkTbl;
    acdbHostApplicationServices()->workingDatabase()->getSymbolTable( pBlkTbl, AcDb::kForRead );

    AcDbBlockTableRecord* pBlkTblRcd;
    pBlkTbl->getAt( ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForRead );
    pBlkTbl->close();

    AcDbBlockTableRecordIterator* pBlkTblRcdItr;
    pBlkTblRcd->newIterator( pBlkTblRcdItr );

    for ( pBlkTblRcdItr->start(); !pBlkTblRcdItr->done(); pBlkTblRcdItr->step() )
    {
        // 不采用transaction的方法查找LinkedGE,
        // 等价于排除当前正在以write状态编辑的LinkedGE
        // 重要(***)
        AcDbEntity* pEnt = 0;
        if( Acad::eOk != pBlkTblRcdItr->getEntity( pEnt, AcDb::kForRead ) ) continue;

        LinkedGE* pEdge = LinkedGE::cast( pEnt );
        if( pEdge != 0 )
        {
            AcGePoint3d startPt, endPt;
            pEdge->getSEPoint( startPt, endPt );
            if( startPt == junctionPt || endPt == junctionPt )
            {
                objIds.append( pEdge->objectId() );
            }
        }
        pEnt->close();
    }
    delete pBlkTblRcdItr;
    pBlkTblRcd->close();
}
示例#3
0
// 查找采空区的其它边
void FindGasBoundary( const AcDbObjectIdArray& objIds,
                      const AcDbVoidPtrArray& lines,
                      AcGePoint3dArray& spts,
                      AcGePoint3dArray& epts,
                      AcGeDoubleArray& dirs,
                      AcDbIntArray& gas_types,
                      AcDbObjectIdArray& gas_objIds )
{
    // 查找所有的采空区
    AcDbObjectIdArray goaf_objIds;
    FindAllGoafs( goaf_objIds );

    // 将采空区多边形转换成一个1维数组
    AcGePoint3dArray polygons;
    AcDbIntArray polygon_counts;
    BuildGoafPolygonArray( goaf_objIds, polygons, polygon_counts );

    // 标记采空区分支是否与其它采空区有共线边
    AcDbIntArray colinearEdges;
    FindPolygonColinearEdges( polygons, polygon_counts, colinearEdges );

    // 查找所有的工作面
    AcDbVoidPtrArray ws_lines;
    FilterLines( lines, ws_lines, true );

    // 划分采空区多边形(工作面、两帮、开切眼)
    AcDbIntArray parTypes;
    PartitionGoafPolygons( ws_lines, polygons, polygon_counts, parTypes );

    assert( parTypes.length() == polygons.length() );

    // 工作面需要特殊处理
    AcDbIntArray gas_linePos;
    AdjustGoafPolygon(
        lines, polygons, polygon_counts,
        colinearEdges, parTypes,
        spts, epts, dirs,
        gas_types, gas_linePos );

    assert( gas_types.length() == gas_linePos.length() );

    for( int i = 0; i < gas_linePos.length(); i++ )
    {
        int pos = gas_linePos[i];
        if( pos != -1 )
        {
            gas_objIds.append( objIds[pos] );
        }
        else
        {
            gas_objIds.append( AcDbObjectId::kNull );
        }
    }
}
Acad::ErrorStatus
ArxDbgUtils::collectSymbolIds(AcRxClass* symTblClass,
                            AcDbObjectIdArray& objIds, AcDbDatabase* db)
{
	ASSERT(symTblClass != NULL);
	ASSERT(db != NULL);

    Acad::ErrorStatus retCode = Acad::eInvalidInput;

    AcDbSymbolTable* symTbl = openSymbolTable(symTblClass, AcDb::kForRead, db);
    if (symTbl != NULL) {
            // get an iterator over this symbol Table
        AcDbSymbolTableIterator* tblIter;
        if (symTbl->newIterator(tblIter) == Acad::eOk) {
                // walk table and just collect all the objIds
                // of the entries
            if (symTbl->isKindOf(AcDbLayerTable::desc()))
                static_cast<AcDbLayerTableIterator*>(tblIter)->setSkipHidden(false);
            Acad::ErrorStatus es;
            AcDbObjectId tblRecId;
            for (; !tblIter->done(); tblIter->step()) {
                es = tblIter->getRecordId(tblRecId);
                if (es == Acad::eOk)
                    objIds.append(tblRecId);
            }
            delete tblIter;
            retCode = Acad::eOk;
        }
        symTbl->close();
    }
    return retCode;
}
void
ArxDbgUtils::collectVertices(const AcDbPolyFaceMesh* pface, AcDbObjectIdArray& vfaces, AcGePoint3dArray& pts)
{
    AcDbObjectIterator*  vertexIter = pface->vertexIterator();
    if (vertexIter == NULL)
        return;

    AcDbFaceRecord* vface;
    AcDbPolyFaceMeshVertex* pfaceVertex;
    AcDbObject* obj;

        // walk through and seperate vfaces and vertices into two
        // seperate arrays
    Acad::ErrorStatus es;
    for (; !vertexIter->done(); vertexIter->step()) {
        es = acdbOpenObject(obj, vertexIter->objectId(), AcDb::kForRead);
        if (es == Acad::eOk) {
            if ((vface = AcDbFaceRecord::cast(obj)) != NULL)
                vfaces.append(obj->objectId());
            else if ((pfaceVertex = AcDbPolyFaceMeshVertex::cast(obj)) != NULL)
                pts.append(pfaceVertex->position());
            else {
                ASSERT(0);
            }
            obj->close();
        }
        else
            ArxDbgUtils::rxErrorMsg(es);
    }
    delete vertexIter;
}
示例#6
0
	// - MfcArx.syj_mfc command (do not rename)
	static void MfcArxsyj_mfc(void)
	{
		// Add your code for command MfcArx.syj_mfc here
		ads_name ss;
		resbuf rb;
		AcDbObjectIdArray objIds = NULL;
		acedSSGet(NULL,NULL,NULL,NULL,ss);
		long len;
		//取得选择集的长度
		acedSSLength(ss,&len);
		//遍历选择集中的实体,将其打开并修改其颜色为红色
		for (int i =0;i<len;i++)
		{
			ads_name entres;
			AcDbObjectId objId;
			//取得选择集中实体的名称ads_name
			acedSSName(ss,i,entres);
			//取得实体的ObjectId
			acdbGetObjectId(objId,entres);
			objIds.append(objId);
		}
		acedSSFree(ss);
		CDetailShow ds(objIds,NULL,NULL);
		ds.DoModal();

	}
示例#7
0
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;
}
void
ArxDbgUiTdcObjReactorsBase::OnObjAttach() 
{
    CString newHandle, str;
    AcDbObjectId objId;

        // see if specified handle is valid
    m_ebHandle.GetWindowText(newHandle);
    if (ArxDbgUtils::handleStrToObjId(acdbHostApplicationServices()->workingDatabase(),
					newHandle, objId, false) != Acad::eOk) {
        str.Format(_T("\"%s\" is not a valid handle."), newHandle);
        ArxDbgUtils::alertBox(str);
        m_ebHandle.SetSel(0, -1); // reset to select all
        m_ebHandle.SetFocus();
        return;
    }

	AcDbObjectIdArray newObjIds;
	newObjIds.append(objId);

	attachObjReactors(newObjIds);

    m_ebHandle.SetWindowText(_T(""));    // reset edit box to be empty for new handle

	displayObjList();
}
示例#9
0
// 从图元的扩展词典中查找数据对象
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();
}
示例#10
0
	static void YCROYCRO_CG_AddRegion() 
	{
		ads_name ss; 
		int rt = acedSSGet(NULL, NULL, NULL, NULL, ss);
		AcDbObjectIdArray objIds; 
		if (rt == RTNORM) 
		{ 
			long length; 
			acedSSLength(ss, &length);
			for (int i = 0; i < length; i++) 
			{ 
				ads_name ent; 
				acedSSName(ss, i, ent); 
				AcDbObjectId objId; 
				acdbGetObjectId(objId, ent); 
				objIds.append(objId); 
			} 
		} 
		acedSSFree(ss);
		AcDbObjectIdArray regionIds;
		regionIds = CCreateEnt::CreateRegion(objIds); 
		int number = regionIds.length(); 
		if (number > 0) 
		{ 
			acutPrintf(_T("\n已经创建%d个面域!"), number); 
		} 
		else 
		{ 
			acutPrintf(_T("\n创建0个面域!")); 
		} 
	}
void
ArxDbgUiTdcPersistentReactors::getAttachedEntities(AcDbObjectIdArray& objIds)
{
	AcDbVoidPtrArray dbPtrs;
	ArxDbgUtils::getAllDatabases(dbPtrs);

	AcDbObjectId prId;
	ArxDbgPersistentEntReactor* peReactor;
	Acad::ErrorStatus es;
	AcDbObjectIdArray tmpIds;

	int len = dbPtrs.length();
	for (int i=0; i<len; i++) {
		prId = getPersistentEntReactor(static_cast<AcDbDatabase*>(dbPtrs[i]), false);

		es = acdbOpenObject(peReactor, prId, AcDb::kForRead);
		if (es == Acad::eOk) {
			tmpIds.setLogicalLength(0);	// reusing array for each database

			peReactor->getAttachedToObjs(tmpIds);
			peReactor->close();

			objIds.append(tmpIds);
		}
	}
}
示例#12
0
int getAllSymbolRecordsIds(AcRxClass* pTableClass, AcDbObjectIdArray & idaAll)
{
	CLogger::Print(_T("*Call: getAllSymbolRecordsIds()"));
	Acad::ErrorStatus es;
	idaAll.setLogicalLength(0);

	AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
	AcDbSymbolTable* pSymbolTable = NULL;

	if (AcRx::kEqual == pTableClass->comparedTo(AcDbBlockTable::desc())) {
		CLogger::Print(_T("> This is BlockTable!"));
		es = pDb->getBlockTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) {
		CLogger::Print(_T("> This is LayerTable!"));
		es = pDb->getLayerTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLinetypeTable::desc())) {
		CLogger::Print(_T("> This is LinetypeTable!"));
		es = pDb->getLinetypeTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbTextStyleTable::desc())) {
		CLogger::Print(_T("> This is TextStyleTable!"));
		es = pDb->getTextStyleTable(pSymbolTable, AcDb::kForRead);
	}
	else {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - This kind of SymbolTable is not supported!"));
		return -1;
	}

	if (Acad::eOk != es) {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() -  Fail to get SymbolTable!"));
		return -1;
	}
	
	//------------
	// Get the SymbolTable's iterator.
	AcDbSymbolTableIterator* pSymbolTableIter = NULL;
	es = pSymbolTable->newIterator(pSymbolTableIter);
	pSymbolTable->close();
	if (Acad::eOk != es) {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get the SymbolTable's iterator!"));
		return -1;
	}

	//------------
	// Steps through the SymbolTable's records. 
	// Then get the SymbolTableRecord's ObjectID.
	for (; !pSymbolTableIter->done(); pSymbolTableIter->step()) {
		AcDbObjectId idObj = AcDbObjectId::kNull;
		if (Acad::eOk == pSymbolTableIter->getRecordId(idObj))
			idaAll.append(idObj);
	}

	delete pSymbolTableIter;
	CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Count: %02d"), idaAll.length());
	return idaAll.length();
}
static void FindWindStationHosts( const AcDbObjectIdArray& objIds, AcDbObjectIdArray& hosts )
{
    FWSHelper fws;
    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        hosts.append( fws.doFWS( objIds[i] ) );
    }
}
void
ArxDbgDbAdeskLogo::getCloneReferences(AcDb::DeepCloneType type,
								AcDbObjectIdArray& refIds,
								AcDbIntArray& refTypes) const
{
		// these types should have been filtered out.  NOTE that kDcObjects
		// is usually ambiguous and has been mapped to kDcBlock or kDcCopy.
	ASSERT((type != AcDb::kDcExplode) &&
		   (type != AcDb::kDcInsert) &&
		   (type != AcDb::kDcInsertCopy) &&
		   (type != AcDb::kDcSymTableMerge) &&
		   (type != AcDb::kDcXrefBind) &&
		   (type != AcDb::kDcXrefInsert) &&
		   (type != AcDb::kDcObjects));

	if (type == AcDb::kDcCopy) {
		refIds.append(m_arbitraryRefEnt);
		refTypes.append(kClone);	// you could set this to kNoClone and both would point to the same one.
	}
	else if (type == AcDb::kDcBlock) {
		refIds.append(m_arbitraryRefEnt);
		refTypes.append(kClone);

			// LongTransactions (RefEdit) will not allow our object to be checked
			// out from a block definition unless its accompanying style def is
			// also in the check out set (which it won't be by default).  So, we
			// have to tell ::deepClone() to fake like it cloned the style definition
			// so it will pass LongTransaction's checkOut validation.
		refIds.append(m_logoStyleId);
		refTypes.append(kFakeClone);
	}
	else if (type == AcDb::kDcWblock) {
		refIds.append(m_arbitraryRefEnt);
		refTypes.append(kClone);
	}
	else if (type == AcDb::kDcWblkObjects) {
		refIds.append(m_arbitraryRefEnt);
		refTypes.append(kClone);
	}
	else {
		ASSERT(0);	// which context did we not account for?
	}
}
Acad::ErrorStatus
ArxDbgUtils::cloneObjects(AcDbDatabase* db, const AcDbObjectId& entToClone,
                        const AcDbObjectId& ownerBlockId, bool debugSpeak)
{
	ASSERT(db != NULL);

    AcDbObjectIdArray objIdList;
    objIdList.append(entToClone);

    return cloneObjects(db, objIdList, ownerBlockId, debugSpeak);
}
void
ArxDbgUiTdcWblockClone::divideCloneSet(const AcDbObjectIdArray& cloneSet,
                            AcDbObjectIdArray& nonEntSet,
                            AcDbObjectIdArray& okToCloneSet)
{
    Acad::ErrorStatus es;
    AcDbObject* obj;

    int len = cloneSet.length();
    for (int i=0; i<len; i++) {
        es = acdbOpenAcDbObject(obj, cloneSet[i], AcDb::kForRead);
        if (es == Acad::eOk) {
            if (obj->isKindOf(AcDbEntity::desc()))
                okToCloneSet.append(obj->objectId());
            else
                nonEntSet.append(obj->objectId());

            obj->close();
        }
    }
}
示例#17
0
void ArxDictTool2::getAllEntries( AcDbObjectIdArray& objIds )
{
    AcDbDictionary* pDict = GetDictObject( m_dictId );
    if( pDict == 0 ) return;

    AcDbDictionaryIterator* pIter = pDict->newIterator();
    for ( ; !pIter->done(); pIter->next() )
    {
        objIds.append( pIter->objectId() );
    }
    delete pIter;
    pDict->close();
}
示例#18
0
void DrawCmd::UpdateAllWindStationData()
{
    // 查找所有的测风站
    // 将所在宿主上的面积、风速、风量数据读取到测风站中
    AcDbObjectIdArray objIds;
    DrawHelper::FindMineGEs( _T( "WindStation" ), objIds );
    if( objIds.isEmpty() ) return;

    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    AcDbObjectIdArray geObjIds;
    int len = objIds.length();
    bool ret = true;
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForRead ) )
        {
            ret = false;
            break;
        }

        TagGE* pTag = TagGE::cast( pObj );
        if( pTag == 0 )
        {
            ret = false;
            break;
        }

        geObjIds.append( pTag->getRelatedGE() );
    }

    actrTransactionManager->endTransaction();

    if( !ret )
    {
        geObjIds.removeAll();
    }
    else
    {
        //assert(objIds.length() == geObjIds.length());
        int len = objIds.length();
        for( int i = 0; i < len; i++ )
        {
            ReadWriteData( geObjIds[i], _T( "断面面积" ), objIds[i], _T( "测试断面面积" ) );
            ReadWriteData( geObjIds[i], _T( "风速" ), objIds[i], _T( "测试风速" ) );
            ReadWriteData( geObjIds[i], _T( "风量" ), objIds[i], _T( "测试风量" ) );
        }
    }
}
void frgExtractTopologicalEntsFromLinesAlgm::_search_related_segs(AcDbObjectIdArray &ids, const AcGeLineSeg2d &seg)
{
	double tolerance = rlTolerance::equal_point();
	if (seg.length() < 2 * tolerance)
		return;

	// - 构造反选矩形
	// -- 计算四个点
	AcGePoint2d p1, p2, p3, p4;

	AcGeVector2d dir = seg.direction();
	AcGeVector2d offset = dir;
	offset.rotateBy(rlPi / 2.0);

	p1 = seg.startPoint(); p1.transformBy(-offset * tolerance);
	p2 = seg.endPoint(); p2.transformBy(-offset * tolerance);
	p3 = seg.endPoint(); p3.transformBy(offset * tolerance);
	p4 = seg.startPoint(); p4.transformBy(offset * tolerance);

	// -- 构造矩形
	ads_point _p1, _p2, _p3, _p4;
	_p1[0] = p1.x; _p1[1] = p1.y, _p1[2] = 0;
	_p2[0] = p2.x; _p2[1] = p2.y, _p2[2] = 0;
	_p3[0] = p3.x; _p3[1] = p3.y, _p3[2] = 0;
	_p4[0] = p4.x; _p4[1] = p4.y, _p4[2] = 0;
	resbuf *rect = acutBuildList(RTPOINT, _p1, RTPOINT, _p2, RTPOINT, _p3, RTPOINT, _p4, RTNONE);

	// - 交叉查询
	ads_name ss;
	int ret = acedSSGet(_T("CP"), rect, NULL, _filter, ss);
	acutRelRb(rect);
	if (ret != RTNORM)
		return;

	// - 获取查询结果
	long len = 0;
	acedSSLength(ss, &len);
	for (int i = 0; i < len; i++)
	{
		ads_name name;
		acedSSName(ss, i, name);

		AcDbObjectId id;
		if (acdbGetObjectId(id, name) == Acad::eOk)
			ids.append(id);
	}
	acedSSFree(ss);
}
示例#20
0
static void FindPointSource_Impl( const AcGePoint3dArray& polygons, const AcDbIntArray& polygon_counts, POINT_SOURCE_TYPE type, AcDbObjectIdArray& objIds, AcGePoint3dArray& pts )
{
    AcDbObjectIdArray all_objIds;
    AcGePoint3dArray all_pts;
    BuildObjectIdAndPointArray( type, all_objIds, all_pts );

    // 排除不在采空区内的源汇
    for( int i = 0; i < all_pts.length(); i++ )
    {
        if( IsPointInGoafPolygon( polygons, polygon_counts, all_pts[i] ) )
        {
            objIds.append( all_objIds[i] );
            pts.append( all_pts[i] );
        }
    }
}
void
ArxDbgUiTdcObjReactorsBase::OnObjDetachSelected() 
{
	AcDbObjectIdArray selObjIds;

    int count = m_lbObjList.GetSelCount();
    if (count > 0) {
        int* intArray = new int[count];
        if (m_lbObjList.GetSelItems(count, intArray) != LB_ERR) {
            for (int i=0; i<count; i++) {
                selObjIds.append(m_objsAttached[intArray[i]]);
            }
        }
        delete [] intArray;
	}

	detachSelectedObjs(selObjIds);
	displayObjList();
}
示例#22
0
// 查找所有只关联一条直线的点坐标对应的分支以及方向
void FindInletBoundary( const AcDbObjectIdArray& objIds,
                        const AcDbVoidPtrArray& lines,
                        AcGePoint3dArray& inlet_spts,
                        AcGePoint3dArray& inlet_epts,
                        AcGeDoubleArray& inlet_dirs,
                        AcDbObjectIdArray& inlet_objIds )
{
    // 查找所有的点
    AcGePoint3dArray pts;
    GetNodePoints( lines, pts );
    if( pts.isEmpty() ) return;

    for( int i = 0; i < pts.length(); i++ )
    {
        // 查找点关联的双线
        AcDbIntArray linePos;
        FindLinesByPoint( lines, pts[i], linePos );

        if( linePos.length() != 1 ) continue;

        // 获取双线的始末点坐标
        int pos = linePos[0];
        DoubleLine* pLine = ( DoubleLine* )lines[pos];
        AcGePoint3d spt, ept;
        pLine->getSEPoint( spt, ept );

        // 判断当前点是始点还是末点
        AcGePoint3d line_spt, line_ept;
        if( spt == pts[i] )
        {
            pLine->getStartPoints( line_spt, line_ept );
        }
        else
        {
            pLine->getEndPoints( line_spt, line_ept );
        }

        inlet_spts.append( line_spt );
        inlet_epts.append( line_ept );
        inlet_dirs.append( pLine->getAngle() );
        inlet_objIds.append( objIds[pos] );
    }
}
void
ArxDbgUiTdcCloneSet::OnRemove()
{
	AcDbObjectIdArray selObjIds;

    int count = m_lbObjList.GetSelCount();
    if (count > 0) {
        int* intArray = new int[count];
        if (m_lbObjList.GetSelItems(count, intArray) != LB_ERR) {
            for (int i=0; i<count; i++) {
                selObjIds.append(m_objIds[intArray[i]]);
            }
        }
        delete [] intArray;
	}

	m_cloneSet.removeObjects(selObjIds);
	displayObjList();
}
示例#24
0
AcDbObjectIdArray Additional_Class::ObjectXdataFilter( CString XdataName, CString Xdata )
{
	//// 遍历所有图层符合规则的实体返回ID列表
	AcDbObjectIdArray resID;

	//AcDbObjectIdArray tempIDList;

	AcDbBlockTable *pBlockTable = NULL;
	acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
	////this->Open_BlockTable(pBlockTable, NREADMODE);
	AcDbBlockTableRecord *pBlockTableRecord = NULL;
	pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);

	//AcDbObjectIterator pltr;
	AcDbBlockTableRecordIterator * pltr2;
	pBlockTableRecord->newIterator(pltr2);
	////pBlockTable->newIterator(pltr);
	AcDbEntity * pEnt;
	CString tempStrEnt;
	for (pltr2->start(); !pltr2->done(); pltr2->step())
	{
		//pltr2.getEntity()
		if(Acad::eOk == pltr2->getEntity(pEnt, AcDb::kForRead, false))
		{
			pEnt->close();
			tempStrEnt = Get_Xdata(pEnt->id(), XdataName);
			if (tempStrEnt == Xdata)
			{
				resID.append(pEnt->id());
			}
		}
		//pEnt->close();
	}
	pEnt->close();
	pBlockTable->close();
	pBlockTableRecord->close();


	delete pltr2;
	return resID;
}
示例#25
0
	static void YCROYCRO_CG_AddHatch() 
	{
		ads_name ss;
		int rt = acedSSGet(NULL,NULL, NULL, NULL, ss);
		AcDbObjectIdArray objIds;
		if (rt == RTNORM)
		{
			long length;
			acedSSLength(ss, &length);
			for (int i = 0; i < length; i++)
			{
				ads_name ent;
				acedSSName(ss, i, ent);
				AcDbObjectId objId;
				acdbGetObjectId(objId, ent);
				objIds.append(objId);
			}
		}
		acedSSFree(ss);
		CCreateEnt::CreateHatch(objIds, _T("SOLID"), true);
	}
示例#26
0
// 根据类型名称查找
static void FilterDataObject( const AcDbObjectIdArray& dbObjIds, const CString& type, AcDbObjectIdArray& objIds )
{
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = dbObjIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, dbObjIds[i], AcDb::kForRead ) ) continue;

        DataObject* pDO = DataObject::cast( pObj );
        if( pDO == 0 ) continue;

        if( type == pDO->getType() )
        {
            objIds.append( dbObjIds[i] );
        }
    }
    actrTransactionManager->endTransaction();
}
示例#27
0
static void GetTagGEById2_Helper( const CString& geType, const AcDbObjectIdArray& allObjIds, AcDbObjectIdArray& objIds )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
    if( pClass == 0 ) 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;

        if( pObj->isKindOf( pClass ) )
        {
            objIds.append( allObjIds[i] );
        }
    }
    actrTransactionManager->endTransaction();
}
示例#28
0
void DrawHelper::ShowHostGE( const AcDbObjectId& objId, unsigned short colorIndex )
{
    // 获取标签图元关联的宿主
    AcDbObjectId host;
    if( !GetHostGE( objId, host ) ) return;

    AcDbObjectIdArray objIds;
    objIds.append( host );

    // 记录宿主图元的原颜色
    AcArray<Adesk::UInt16> colors;
    if( !ArxEntityHelper::GetEntitiesColor( objIds, colors ) ) return;

    // 用黄色高亮显示宿主图元
    ArxEntityHelper::SetEntitiesColor( objIds, colorIndex );

    // 中断
    ArxUtilHelper::Pause();

    // 恢复宿主的原有颜色
    ArxEntityHelper::SetEntitiesColor2( objIds, colors );
}
示例#29
0
static void GetModelGEById_Helper( const AcDbObjectId& objId, const AcDbObjectIdArray& modelObjIds, AcDbObjectIdArray& objIds )
{
    if( modelObjIds.isEmpty() ) return;

    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = modelObjIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, modelObjIds[i], AcDb::kForRead ) ) continue;

        ModelGE* pModel = ModelGE::cast( pObj );
        if( pModel == 0 ) continue;

        if( pModel->getDataObject() == objId )
        {
            objIds.append( modelObjIds[i] );
        }
    }
    actrTransactionManager->endTransaction();
}
示例#30
0
// 获取词典下的所有
static void GetDataObjectFromDict( const CString& dictName, AcDbObjectIdArray& dbObjIds )
{
    AcDbObjectIdArray allObjIds;
    ArxDictTool2* pDict = ArxDictTool2::GetDictTool( dictName );
    pDict->getAllEntries( allObjIds );
    delete pDict;

    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;

        if( pObj->isKindOf( DataObject::desc() ) )
        {
            dbObjIds.append( allObjIds[i] );
        }
    }
    actrTransactionManager->endTransaction();
}