Removing / Changing the Layer of Seqends

Discussion in 'AutoCAD' started by Chris Shoemaker, Mar 15, 2005.

  1. well i've got a routine that goes through and sets all entities in block
    defintions to layer 0, however it doesn't seem to change seqends in the
    blocks too, leaving some otherwise unused layers unpurgable. Any idea how to
    change the layer of these seqends at the same time as the entities so unused
    layers can be purged?

    -Chris

    --------------------------------------------------------------

    Private Sub cleanblocks()

    Dim objBlock As AcadBlock
    Dim objEnt As AcadEntity
    Dim objLayer As AcadLayer
    Dim layerlocked As Boolean
    Dim layername As String

    On Error Resume Next

    'For every block definition in drawing
    For Each objBlock In ThisDrawing.Blocks

    'Make sure the block def isn't an xref or layout
    If (objBlock.IsLayout = False) And (objBlock.IsXRef = False) Then

    'For every entity in block defintion
    For Each objEnt In objBlock

    ' Check if object layer is locked, if true set flag and unlock
    layername = objEnt.Layer
    Set objLayer = ThisDrawing.Layers(layername)
    If objLayer.Lock = True Then
    layerlocked = True
    objLayer.Lock = False
    Else
    layerlocked = False
    End If

    ' If box is checked, set all block entities color to bylayer
    If Blocks_Color_ByLayer.Value = True Then
    objEnt.color = acByLayer
    End If

    ' If box is checked, set all block entities linetype to bylayer
    If Blocks_Linetype_ByLayer.Value = True Then
    objEnt.Linetype = "ByLayer"
    End If

    ' If box is checked, set all block entities lineweight to
    bylayer
    If Blocks_Lineweight_ByLayer.Value = True Then
    objEnt.Lineweight = acLnWtByLayer
    End If

    ' If box is checked, set all block entities layer to 0
    If Blocks_Force_Layer0.Value = True Then
    objEnt.Layer = "0"
    End If

    ' If block was on locked layer, relock layer
    If layerlocked = True Then
    objLayer.Lock = True
    End If

    Next objEnt

    End If

    Next objBlock

    ' uncheck all the buttons
    Blocks_Color_ByLayer.Value = False
    Blocks_Linetype_ByLayer.Value = False
    Blocks_Lineweight_ByLayer.Value = False
    Blocks_Force_Layer0.Value = False
    Blocks_Delete_Text.Value = False

    End Sub
     
    Chris Shoemaker, Mar 15, 2005
    #1
  2. Chris Shoemaker

    Jeff Mishler Guest

    See the solution posted by KG in response to the similar question posted on
    Mar. 1, 2004 by Brent. The Title of the thread is "Removing / Changing the
    Layer of Seqends"
     
    Jeff Mishler, Mar 15, 2005
    #2
  3. hmm, my news reader can't seem to find posts further back then sept of 2004,
    any idea where i could find that information? Thanks :)

    -Chris
     
    Chris Shoemaker, Mar 15, 2005
    #3
  4. oops, nevermind...just realized i don't know how to use my client. Thanks
    :)

    -Chris
     
    Chris Shoemaker, Mar 15, 2005
    #4
  5. Actually, i still can't seem to find that post :-(

    -Chris
     
    Chris Shoemaker, Mar 16, 2005
    #5
  6. Chris Shoemaker

    Jeff Mishler Guest

    Jeff Mishler, Mar 16, 2005
    #6
  7. Chris Shoemaker, Mar 16, 2005
    #7
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.