Why is this layer properties method not working?

Why is this layer properties method not working?

Anonymous
Not applicable
394 Views
1 Reply
Message 1 of 2

Why is this layer properties method not working?

Anonymous
Not applicable
I have this rather lengthy method. But even thiugh I can debug it and see that it is setting the colours, I am finding that the layer table has no changes made.

[code]
' The the layer properties correctly
Public Sub SetupLayerProperties()
Dim oLayer As AcadLayer

' Ensure our line types are loaded
Call LoadLineType("DASHED", "acadiso.lin")
Call LoadLineType("DASHDOT", "acadiso.lin")
Call LoadLineType("DASHED2", "acadiso.lin")
Call LoadLineType("PHANTOM", "acadiso.lin")
Call LoadLineType("CENTER", "acadiso.lin")

For Each oLayer In ThisDrawing.Layers
With oLayer
' Must be line weight default
.Lineweight = acLnWtByLwDefault

' Handle colours and styles (bit length I am afraid)
If (.Name Like "A*") Then
.TrueColor.ColorIndex = acWhite

ElseIf (.Name = "BOSTG") Then
.TrueColor.ColorIndex = acWhite

ElseIf (.Name = "KRUIN") Then
.TrueColor.ColorIndex = acCyan

ElseIf (.Name = "SWHPB") Then
.TrueColor.ColorIndex = acRed

ElseIf (.Name = "SARO") Then
.TrueColor.ColorIndex = acRed

ElseIf (.Name Like "*VESL") Then
.TrueColor.ColorIndex = acMagenta
.Linetype = "DASHED"

ElseIf (.Name Like "*NVOG") Then
.TrueColor.ColorIndex = acRed
.Linetype = "DASHDOT"

ElseIf (.Name Like "*MVTB") Then
.TrueColor.ColorIndex = acCyan
.Linetype = "DASHED2"

ElseIf (.Name Like "*MVTO") Then
.TrueColor.ColorIndex = acMagenta
.Linetype = "DASHED"

ElseIf (.Name Like "*NVCS*") Then
.TrueColor.ColorIndex = acGreen
If (.Name Like "*NVCS") Then
.Linetype = "CENTER"
End If

ElseIf (.Name = "TOBUI") Then
.TrueColor.ColorIndex = acGreen
.Linetype = "PHANTOM"

ElseIf (.Name Like "*MVRH*") Then
.TrueColor.ColorIndex = 31
If (.Name Like "*MVRH") Then
.Linetype = "DASHDOT"
End If

ElseIf (.Name = "NVBMR") Then
.TrueColor.ColorIndex = acGreen

ElseIf (.Name = "VEL") Then
.TrueColor.ColorIndex = acMagenta

ElseIf (.Name = "VEBM") Then
.TrueColor.ColorIndex = acMagenta

ElseIf (.Name Like "*MVDW*") Then
.TrueColor.ColorIndex = acBlue

ElseIf (.Name Like "*SBM") Then
.TrueColor.ColorIndex = acGreen

ElseIf (.Name Like "*MVRHIS") Then
.TrueColor.ColorIndex = 52

ElseIf (.Name Like "*MIS") Then
.TrueColor.ColorIndex = 61

ElseIf (.Name = "MVTA") Then
.TrueColor.ColorIndex = acRed

ElseIf (.Name = "BOGEB") Then
.TrueColor.ColorIndex = acRed

ElseIf (.Name = "BOBA") Then
.TrueColor.ColorIndex = 141

ElseIf (.Name = "HL") Then
.TrueColor.ColorIndex = 11

ElseIf (.Name = "MVBRK") Then
.TrueColor.ColorIndex = 2

ElseIf (.Name = "MVGR") Then
.TrueColor.ColorIndex = 181

ElseIf (.Name = "MVHEK") Then
.TrueColor.ColorIndex = 191

End If

' We might have to do an override here for "deleted" layers
' Do we want to change their colour?
If (.Name Like "D*") Then
.LayerOn = False
End If

End With
Next

End Sub
[/code]
0 Likes
395 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
I had to use .color instead of .TrueColor.ColorIndex

Works fine now.
0 Likes