Some may comment that this is not good drafting practice, but here is a sub I wrote to create a "bad" dwg for another sub I was testing.
Public Sub ColorToEntity()
'This subroutine sets each entities color from ByLayer
'to the color of the layer it's on.
Dim objEntity As AcadEntity
Dim objMS As AcadModelSpace
Dim objPS As AcadPaperSpace
Dim objLayers As AcadLayers
Dim objLayer As AcadLayer
Dim strLayer As String
Set objMS = ThisDrawing.ModelSpace
Set objPS = ThisDrawing.PaperSpace
Set objLayers = ThisDrawing.Layers
'process ents in modelspace
For Each objEntity In objMS
strLayer = objEntity.Layer
Set objLayer = objLayers.Item(strLayer)
objEntity.Color = objLayer.Color
Next objEntity
'process ents in paperspace
For Each objEntity In objPS
strLayer = objEntity.Layer
Set objLayer = objLayers.Item(strLayer)
objEntity.Color = objLayer.Color
Next objEntity
End Sub
Ed
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to
post your code.