Scan Criteria

translate.google.it

Hello

in 'attached drawing there are cell with the same name on different levels and different colors

how can I set scan criteria to select only those of a layer?

(cells also tag attached)

scan_cell.dgn

  • Hi,

    Unknown said:
    how can I set scan criteria to select only those of a layer?

    A cell itself (element type cell header) doesn't occupy any level (cell.level = Nothing). It means it's not possible to set Element Scan Criteria to search for a cell at a particular level only. In fact, speaking strictly generally, the "cell level" term is nonsense, because elements inside cells can be in different levels.

    In your specific case, which is a bit ugly because there is a cell inside another cell, internal cell consists from two lines at the same level. So to decide "cell level" you have to check element level inside cell inside cell.

    Quick and dirty example of the code:

    Sub ScanForCells()
        Dim esc As ElementScanCriteria
        Set esc = New ElementScanCriteria
        
        esc.ExcludeAllTypes
        esc.IncludeType msdElementTypeCellHeader
        esc.IncludeOnlyCell "crocetta_ril"
        
        Dim ee As ElementEnumerator
        Set ee = ActiveModelReference.Scan(esc)
        
        Dim counter As Integer
        
        Do While ee.MoveNext
            Dim lvlName As String
            lvlName = GetCellLevelName(ee.Current.AsCellElement)
            
            If (lvlName = "ril_crocette_esterni_no") Then
                counter = counter + 1
            End If
        Loop
        
        MsgBox "Number of cells in level ril_crocette_esterni_no: " + CStr(counter)
        
    End Sub
    
    Private Function GetCellLevelName(cell As CellElement)
        Dim topCellEe As ElementEnumerator
        Set topCellEe = cell.GetSubElements
        topCellEe.MoveNext
        
        Dim subCellEe As ElementEnumerator
        Set subCellEe = topCellEe.Current.AsCellElement.GetSubElements
        subCellEe.MoveNext
        
        GetCellLevelName = subCellEe.Current.Level.Name
    End Function

    With regards,

      Jan

    Answer Verified By: Massimo Callegher 

  • change the subject. I created cell within other cell to have tags attached to the cell, otherwise the tag is connected to the segment of the cell
    There is no other way to link tags to a cell?
    I seek ways and methods to get what I want. your answer is still what I wanted. I have just a bit 'of time I try
    many many thanks
    Massimo Callegher

    Answer Verified By: Massimo Callegher 

  • Unknown said:
    Change the subject

    Then start a new post!

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Massimo Callegher