Change Wall.Layer to new layer

Discussion in 'AutoCAD' started by Andrew Elmore, Jul 30, 2003.

  1. Does anyone have an example of changeing a object ("Wall Style") layer to a
    new layer?

    here is what I have..

    Private Sub AcadDocument_ObjectAdded(ByVal Object As Object)
    Dim Acad04_Wall As AecWall
    Dim strStyleName() As String
    Dim testlayer As AcadLayer

    If TypeOf Object Is AecWall Then

    Set Acad04_Wall = Object
    strStyleName = Split(Acad04_Wall.StyleName, " ", -1,
    vbTextCompare)

    Select Case strStyleName(1)
    Case "Top"
    Select Case Acad04_Wall.Rotation * (180 / 3.14)
    Case 90 To 91
    Call Add_Layers("West-Counter", testlayer)
    Acad04_Wall.Layer = testlayer
    Case 0 To 1
    Call Add_Layers("North-Counter", testlayer)
    Case 270 To 271
    Call Add_Layers("East-Counter", testlayer)
    Case 180 To 181
    Call Add_Layers("South-Counter", testlayer)
    End Select
    Case "Splash"
    Case Else
    End Select

    End If
    End Sub
    Private Sub Add_Layers(strLayerName As String, testlayer As AcadLayer)
    Dim layerColl As AcadLayers
    Set layerColl = ThisDrawing.Layers
    Set testlayer = layerColl.Add(strLayerName)
    End Sub
     
    Andrew Elmore, Jul 30, 2003
    #1
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.