Question

Is it possible to add items to the FMW script?

  • 3 October 2018
  • 5 replies
  • 2 views

I have an FMW script that includes an AttributeCreator transformer. I want to include 500 additional attribute creator transformers. It would be tedious to create them in the workbench. Instead, I would like to create them with a little Python script and then splice the generated code into the FMW script. Is there any documentation on how to manipulate the FMW text file?


5 replies

Userlevel 3
Badge +13

Hi @gidolangen There is no documentation for this because we strongly discourage editing a workspace in a text editor. We will not help you if you corrupt your workspace in this way. However, there is likely a better solution than editing a workspace in a text editor or adding 500 AttributeCreators in Workbench. Can you give us more information about your problem?

Ultimately, I want to create a seed file for AutoCAD. This seed file will be used in an FME workbench to create DWG that have layer names (the Layer property) whose symbology is defined by ByLayer values. I can create everything with an FME workbench where I am using an AttributeCreator transformer to define the AutoCAD layer name. As I said: Everythin works; I just have 500 unique layers to create. Is there an automated way to create the seed file; or the values for it?

Userlevel 3
Badge +13

I'd explore making an Excel or CSV file with the 500 unique layer names, read those in with an Excel or CSV reader, and use those values to populate what you would have done with an attribute creator. If you post up your workspace we can provide more hints if needed.

Badge +3

Hi @gidolangen,

I would not go set 500 attributes, best to use a template dwg. (and even if you do, you nowadays can import attributes in to the attributecreator, so u you can use a csv or excel etc. to import them)

I have done this by creating the layer names based on the object_klasse.

A separate workbench creates an AutoCAD template dwg. With all the layers for all the objects, as well as all the symbology (blocks). 1 item per layer with all the layer properties set.

Fanout layer name. Here is a pic of the template dwg. (you see al the symbols stacked at origin)

I did this because (up till now afaik ) you can not control the color property by layer using dwg styler or by directly setting AutoCAD format-properties. (mind you, I built this one end 2016, transformers are upgraded but I have not tested whether one can set color by layer property in current version)

(color always revert to layer 0 color, which is standard red.).

I use a start up lisp to set color by layer etc. (I have not managed to control that part using fme)

createseedfile.fmwFinally, I decided to create the input layer names i a shape file, read the features, and create the layers for the DWG seed file that way. The drawback is that the ByLayer properties still had to be changed in an interactive session in AuitoCAD. The question would be how do you provide the color definition if the autocad_color value is already used to provide the key value "ByLayer"?

Reply