Key-in to select a LineStyle by LineStyle name

Does anyone know how to select all lines in a file by their name using a key-in.?  I found the following for Cells at the link below and it works great.  I'm trying to do the same for  linestyles and the name of the linestyle is "EXOHE" which is a custom linestyle.   I'm using ORD Connect but posted here because it seems more like a MicroStation question.  

https://communities.bentley.com/products/microstation/f/z_-archived-microstation-v8-xm-edition-forum/80860/using-a-keyin-to-select-cells-by-a-name

Parents
  • VBA can be used here. Check the sample code

    Option Explicit
    
    Sub OnLSName(linesname As String)
        Dim esc As ElementScanCriteria
        Dim ee As ElementEnumerator
        Dim ln As LineElement
        
        Set esc = New ElementScanCriteria
        esc.IncludeOnlyVisible
        
        Set ee = ActiveModelReference.Scan(esc)
        ActiveModelReference.UnselectAllElements
        
        Do While ee.MoveNext
            'Debug.Print ee.Current.LineStyle.Name
            
            If (ee.Current.LineStyle.Name = linesname) Then
                ActiveModelReference.SelectElement ee.Current
            End If
        Loop
    End Sub
    
    Sub main()
        OnLSName KeyinArguments
    End Sub
    

    Use the following keyins...
    vba load SelectElms
    vba run main Sketchy 07 V2

    "Sketchy 07 V2" is the linestyle name

    SelectElms.mvba

          

    Answer Verified By: Corey Baird 

Reply
  • VBA can be used here. Check the sample code

    Option Explicit
    
    Sub OnLSName(linesname As String)
        Dim esc As ElementScanCriteria
        Dim ee As ElementEnumerator
        Dim ln As LineElement
        
        Set esc = New ElementScanCriteria
        esc.IncludeOnlyVisible
        
        Set ee = ActiveModelReference.Scan(esc)
        ActiveModelReference.UnselectAllElements
        
        Do While ee.MoveNext
            'Debug.Print ee.Current.LineStyle.Name
            
            If (ee.Current.LineStyle.Name = linesname) Then
                ActiveModelReference.SelectElement ee.Current
            End If
        Loop
    End Sub
    
    Sub main()
        OnLSName KeyinArguments
    End Sub
    

    Use the following keyins...
    vba load SelectElms
    vba run main Sketchy 07 V2

    "Sketchy 07 V2" is the linestyle name

    SelectElms.mvba

          

    Answer Verified By: Corey Baird 

Children
No Data