Skip to main content

Hi,

 

I think I already know the answer that this is not possible, but thought it wouldn't hurt to ask a question here.

 

I am using a FeatureWriter to write data to a DWG file (RealDWG writer) and specified a template where I customized some layers to have the representation I need. However in some cases I need to write features to new layers that won't be in the template and I cannot find any way to pre-set the layer color. The writer has a setting for default layer colors, but it cannot be specified by an attribute or conditional; it just accepts a parameter, which is not useful at all for this type of exercise. I can get close to what I need (since I am using a template) by changing the color etc. for default layers since I'm already controlling specifics via the template DWG, but that only works if I have one style; this breaks down once I have more than 1 layer style. Am I just out of luck on this?

 

Similarly I cannot find a setting to specify the color of a hatch. The DWGStyler colors the boundary linework but not the hatch itself. I was hoping I could at least specify certain object colors directly (instead of the default ByLayer, which I would rather not do and continue controling the layer color instead, but....see first question above!). Similarly again, I cannot seem to find a way to color solids independent of layer color (to get around the issue in question #1). Am I also out of luck on both of these? Thanks in advance for any help on this.

For setting layer color I have not found a solution yet. FME can read autocad_layer_color from dwg but doesn't let you set it via attribute.

 

To specify the color of a hatch (or any other type of autocad entity, including mesh and solid) you can just create an autocad_color (or autocad_original_color) attribute vie AttributeCreator/Manager after the DWGStyler.

autocad_colorOR, for hatch, line, text, set the color via DWGStyler (it colors the hatch for me)hatch color


For setting layer color I have not found a solution yet. FME can read autocad_layer_color from dwg but doesn't let you set it via attribute.

 

To specify the color of a hatch (or any other type of autocad entity, including mesh and solid) you can just create an autocad_color (or autocad_original_color) attribute vie AttributeCreator/Manager after the DWGStyler.

autocad_colorOR, for hatch, line, text, set the color via DWGStyler (it colors the hatch for me)hatch color

Thanks @caracadrian​ , actually it seems like the DWGstyler is enough to color fill the hatches. I had it set to MPolygon with Pattern and that's something that has a separate color setting in Autocad (and you cannot actually color it from FME it seems). So for the time being I just switched the object type and all is good.

 

Too bad about setting up layers. They're technically not a feature so you cannot "create" them via FME...you can just create object features and assign layers as a property of sorts. A template can get you pretty close, but it leaves a lot of gaps in the workflow if you're trying to tidy up everything. I am not a fan of setting objects ByColor. Like...I hate it :D


Thanks @caracadrian​ , actually it seems like the DWGstyler is enough to color fill the hatches. I had it set to MPolygon with Pattern and that's something that has a separate color setting in Autocad (and you cannot actually color it from FME it seems). So for the time being I just switched the object type and all is good.

 

Too bad about setting up layers. They're technically not a feature so you cannot "create" them via FME...you can just create object features and assign layers as a property of sorts. A template can get you pretty close, but it leaves a lot of gaps in the workflow if you're trying to tidy up everything. I am not a fan of setting objects ByColor. Like...I hate it :D

Layers in Autocad are created by FME via feature attributes. So if you set 2 features to the same layer but different layer styles you either get an overwrite or an error.

I am a fan of bylayer coloring and styling so it doesn't bother me that much.


Thanks @caracadrian​ , actually it seems like the DWGstyler is enough to color fill the hatches. I had it set to MPolygon with Pattern and that's something that has a separate color setting in Autocad (and you cannot actually color it from FME it seems). So for the time being I just switched the object type and all is good.

 

Too bad about setting up layers. They're technically not a feature so you cannot "create" them via FME...you can just create object features and assign layers as a property of sorts. A template can get you pretty close, but it leaves a lot of gaps in the workflow if you're trying to tidy up everything. I am not a fan of setting objects ByColor. Like...I hate it :D

I'm a fan of ByLayer as well, that's why I don't like having to set color by object via the Styler. My preference would be to create the layer and assign the color to the layer as well, but that doesn't seem possible (not for more than 1 layer since there is only one setting in the writer that controls ALL new layer colors). Again, unless I'm missing something.


I think I found a hack. One can create a disposable DWG template on the fly by routing a feature to a writer set to the desired color (so one writer for each unique layer color needed). It can be "tidy-ed" up by using a workspace runner as well, but here's a crude proof of concept. Then you can use the disposable template and write features by layer name, which would have already been created with the appropriate color in the template. Color would not be assigned so features would then be set "ByLayer".

LayerHack1LayerHack2


Reply