View Full Version : change layer without changing color
windowsxp5
2004-08-29, 09:19 PM
is this possible"multiple layers changing in to one layer without changing color in one selection".(example; in my dwg there are 10 layers, all colored by layer. i want to change those object to one layer but i want to keep the same color)
thanks in advance
Mike.Perry
2004-08-29, 09:29 PM
Hi
If the Objects on the 10 Layers have their Colour defined Bylayer then no, as Bylayer is Bylayer so to speak.
You could force the Colours of the Objects on the 10 Layers, but I don't think you want to do that (personally I wouldn't recommend it).
Have a good one, Mike
windowsxp5
2004-08-30, 04:21 PM
Thank u for Ur interest to reply..
this drawing is a survey drawing.. and this dwg has 100s of layers..
i just want to make this one as a base drawing....in hard copy color represent the object, so no need the color by layer.....i hope some lisp can do this.. i badly need this..
mjfarrell
2004-08-30, 04:34 PM
You indicate this is a Survey drawing,
then what you want can be done within MAP
if you are using Land Desktop through a
property alteration query.
If you do not have Land or MAP, .ignore this suggestion
Ed Jobe
2004-08-30, 04:54 PM
Given that you understand the consequences of what you want to do, as Mike warned, I have a vba macro I wrote that changes an entity's color from ByLayer to the color of the layer it's on. You could then move them to a single layer. I wrote this just to test another macro that changes colored ents to ByLayer, but it will do what you want. Warning - this simply processes all entities in ms and ps.
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
Mike.Perry
2004-08-30, 05:47 PM
Hi
Another possibility to go with Ed's AutoCAD solution...
You say this drawing is to be used as a "base drawing", by that do you mean a background drawing (like a background map for example)?
If yes, have you thought of using the drawing file as an Xref, then with the correct use of VISRETAIN you could easily achieve the Colors you're after (granted you would still be left with a lot of Layers, but it does have the advantage of not altering the original drawing file).
For a little info on VISRETAIN please refer to the following threads...
Layer properties are lost when the attached Xref files are reloaded
Layers keep having plot turned off
+
If using as an Xref is a possibility then something like the following may also help -
Xrefs to color 9 (http://new.cadalyst.com/code/tips/CodeSearch_Detail.cfm?ID=1888) - from CADalyst "Get The Code"
Have a good one, Mike
windowsxp5
2004-09-05, 08:36 PM
i tried eljobe's macro using vbarun, vbamanager then i add a module..but its doesn't work with me ..can i get more info to run this macro? i think i did something wrong,,is this same as VBA?
Mike.Perry
2004-09-05, 09:24 PM
Hi
Check out the following Submission # EX001199 by Ed Jobe on the AUGI Exchange Page -
AUGI Exchange Search Page (http://www.augi.com/exchange/search.asp?page=415)
It's a step-by-step for us (me) non VBA people -
<snip>
These tips for using vba include: Instructions for adding a vba macro (for users not familiar with vba); Create a lisp wrapper for your macro; Adding references; Working with ObjectDbx
</snip>
If that doesn't help, I'm sure Ed will be along to offer some guidance & help.
Have a good one, Mike
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.