block-color-by-name.txtbt0-all-kopielsp.txtHi,
Alas this is not possible: DWG_styler cannot help you there...
I also tried all kinds of things until i realised this.
The only way to do this is using autocad itself.
Create a template file from the autocad file.
I do this by using fanout out and read only 1 feature per layer, settings in navigator panel, udsing fme.
Mostly i stuff in also all symbols as blocks and place these on layer 0.
Setting "by layer" and moving symbolblocks to layer 0 i do using lisps. (search internet and adept them to your needs..hail internet!)
Then use the result as a template. (navigator panel => parameters=>"Template File:"
i added 2 lisps i found, for color by layer and move blocks to layer 0.
Hi @mattdionne
you can use autocad_color = 256 to set the ByLayer color (you can create
autocad_color with AttributeCreator or AttributeManager). Would you like the block elements to have ByLayer colors? If yes, this should probably be set when you create your block definitions.
I know a little late to the party but I had no luck with the autocad_color = 256. It simply didn't work. Perhaps I misunderstood the implementation.
I noted the the DWGStyler would allow linestyles to be set "BYLAYER" and presumed there must be a way to pass "BYLAYER" literally for color.
However the following works perfectly.
Using fme_color you can literally set "BYLAYER" and pass this to the AutoCAD writer.
Likewise the following also works. Same structure as above just substitute fme_color for autocad_color
***************************************************************************************************************
Folks just wanted to add it looks like my "solution" is serendipitous rather than authoritative. After running my conversion I found the following warning
So my setting purely by accident and good error catching code by the writer gets the desired result. However something certainly doesn't add up. In my experience no matter what I did autocad_colour=256 did not work. The translated layer was always coming out 7/White. Whatever works I guess.
I know a little late to the party but I had no luck with the autocad_color = 256. It simply didn't work. Perhaps I misunderstood the implementation.
I noted the the DWGStyler would allow linestyles to be set "BYLAYER" and presumed there must be a way to pass "BYLAYER" literally for color.
However the following works perfectly.
Using fme_color you can literally set "BYLAYER" and pass this to the AutoCAD writer.
Likewise the following also works. Same structure as above just substitute fme_color for autocad_color
***************************************************************************************************************
Folks just wanted to add it looks like my "solution" is serendipitous rather than authoritative. After running my conversion I found the following warning
So my setting purely by accident and good error catching code by the writer gets the desired result. However something certainly doesn't add up. In my experience no matter what I did autocad_colour=256 did not work. The translated layer was always coming out 7/White. Whatever works I guess.
@andyew
Lena forgot to tell that using 256 is just to set the layer to ByLayer.
You will need to create a template first and use it in your workbench (navigator panel on the autocad writer).
Else all will default to default color..
You cannot set the layer color and se *** to ByLayer in a single workspace. (uless you want all layers1 single default color...)
You can however create a template using fme and a autocad writer by setting the autocad_color to the desired color , then workspacerunner to call a workspace to set all the layers to by layer.