Edit multiple layers

Discussion in 'AutoCAD' started by milfora, Feb 28, 2005.

  1. milfora

    milfora Guest

    Is there a simple way to duplicate the following AutoLISP commands in VBA. All I want to do is change multiple layer colours on one line, similar to

    -layer color red mx_*,text_*

    In VBA, I have to enter each filter through a separate IF statements

    Dim layer As AcadLayer
    For Each layer In ThisDrawing.Layers
    If StrConv(layer.Name, vbLowerCase) Like "mx_*" Then
    layer.color = acRed
    End If
    If StrConv(layer.Name, vbLowerCase) Like "text*" Then
    layer.color = acRed
    End If
    Next layer

    Is there a shorter method for altering multiple layer properties, using multiple wild card filters?

    Thanks in advance

    AM
     
    milfora, Feb 28, 2005
    #1
  2. milfora

    VBA Guest

    Here's how I would do it ...

    Public Sub ChangeLayerColor()
    Dim oLayer As AcadLayer

    For Each oLayer In ThisDrawing.Layers
    With oLayer
    If UCase(.Name) Like "MX_*" Or UCase(.Name) Like "TEXT*" Then
    oLayer.Color = acRed
    End If
    End With
    Next oLayer
    End Sub
     
    VBA, Feb 28, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.