layer from Bylayer to Bycolor

layer from Bylayer to Bycolor

Anonymous
Not applicable
264 Views
2 Replies
Message 1 of 3

layer from Bylayer to Bycolor

Anonymous
Not applicable
how can i set all my layer from Bylayer to Bycolor...?
0 Likes
265 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor
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.

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable
A layer doesn't have a property ByColor, but the color can be set as color
or ByLayer or ByBlock. It doesn't matter which option you like they're all
set/changed the same way:

for each layer in thisdrawing.layers
layer.color=acRed
layer.color=acByBlock
layer.color=acByLayer
next

Regards,
Joeri Tuyn


"LHGO" wrote in message
news:f0e54be.-1@WebX.maYIadrTaRb...
> how can i set all my layer from Bylayer to Bycolor...?
>
>
0 Likes