Skip to main content

I want to have RGB color out put from Autodesk DWG file. After exposing fme_color attribute the output contains different value. e.g. AutoCAD Color Index(ACI) value 92 and after reading it in FME I get value of (0,0.65,0) . If you look in AutoCAD the value should be (0,165,0)

FME reports colors in RGB in a 0..1 range rather than 0..255. So FME's 0,0.65,0 is actually the same as AutoCAD's 0,165,0 and when writing to AutoCAD it will put in the correct color.

Also, love the username! \\m/

 


FME reports colors in RGB in a 0..1 range rather than 0..255. So FME's 0,0.65,0 is actually the same as AutoCAD's 0,165,0 and when writing to AutoCAD it will put in the correct color.

Also, love the username! \\m/

 

Thanks, @redgeographics so I can multiply this with 255 and get the value


You don’t need to recalculate it yourself, FME will handle it for you, don’t worry about it ;)


Hi @spinaltapping, to further add onto how to do this please find an attached template that uses 2 methods.

  • Use AttributeSplitter to generate the list.
  • Using AttributeManager and Arithmetic equation to calculate RGB

AutoCAD_Color_to_RGB.fmwt


Actually, you do need to calculate the rgb value if you are using a dynamic workflow because format attributes are not written to the writer even if they are selected. If you are creating a shapefile and you want a field to specify color, then you do need to calculate it.

Rahul your workflow is more complicated then it needs to be. You do not need the attribute exposer and you can do the calculation all within one field. You also don't want to convert to int. That would mean you would have rounding issues and not get the exact color correct.

Thank you Rahul by the way for your help!!

I think FME should work on supporting being able to write format attributes even for a dynamic workflow.

 

 


Actually, you do need to calculate the rgb value if you are using a dynamic workflow because format attributes are not written to the writer even if they are selected. If you are creating a shapefile and you want a field to specify color, then you do need to calculate it.

Rahul your workflow is more complicated then it needs to be. You do not need the attribute exposer and you can do the calculation all within one field. You also don't want to convert to int. That would mean you would have rounding issues and not get the exact color correct.

Thank you Rahul by the way for your help!!

I think FME should work on supporting being able to write format attributes even for a dynamic workflow.

 

 

Hi @lucaskaim, Thanks for your feedback here. I'm very curious about your suggestion for writing format attributes. Would you mind expanding on your scenario a bit more? Because it is perhaps a scenario we have not considered.

Traditionally in FME, format attributes are used internally to control how writers of a specific format output features. For example, AutoCAD writer recognizes the "autocad_color" attribute, and uses it to determine the color of the feature it creates. These format attributes often don't have any effect, when writing to a different format. E.g. "autocad_color" attribute would have no effect when the feature carrying it is going out to a Shapefile writer, because Shapefile doesn't support colors.

So, I'm very interested to learn how you'd like to use the color attributes (and other AutoCAD format attributes), once it's written out to shapefile? And more generally, how often do you work in similar scenarios, where: you want to preserve properties of the source data on the output, even if the output format itself doesn't support this type of property (e.g. color in shapefile)


Reply