3

I built a workspace in FME Desktop 2017 for re-projecting DWG files between different coordinate systems and I need to automate the writer output folder and filename of the dwg in FME desktop.

I need to compose automatically the writer output path using: 'reader input path/myfolder/reader filename.dwg'

Is there anyway to do this in FME Desktop?

6

OK, this is quite simple - less than five minutes, which I know because I created a movie demonstrating it:

https://www.screencast.com/t/zdnVYkVGnJEv

To give the steps in more detail here...

1) The source filename information comes from the source dataset parameter (say SourceDataset_ACAD) in the Navigator window

2) Put down a FileNamePartExtractor transformer to break down that source dataset parameter into its component parts, eg dirpath and filename

3) For MyFolder (which I assume the user gets to enter) create a new published/user parameter that lets the user enter a filename.

4) Go to the Navigator window and look for Dataset Fanout for the ACAD output. Turn it on and set the fanout expression to be:

@Value(dirpath)\$(MyFolder)\@Value(filename)

5. Run the translation. Enter a MyFolder value. If the data was originally C:\FMEData2016\Data\Transportation\Roads.dwg, and MyFolder is called "Mark", then the output will be C:\FMEData2016\Data\Transportation\Mark\Roads.dwg

Another thing you could do (for example) is use the TimeStamper transformer to create a timestamp and incorporate that into the file/path name of the output. That way each output is timestamped in its name. Lots of possibilities.

  • 1
    Worked like a charm! – Shefqet LULJA Jun 23 '17 at 8:28
  • what about going one level up from source path? From C:\FMEData2016\Data\Transportation\Roads.dwg to C:\FMEData2016\Data\Roads.dwg – Shefqet LULJA Jun 23 '17 at 12:56
  • To go up one path would need a level stripping off the existing path. In the Fanout editor you'd need to use a regular expression or other string function to search for - and strip off - the last part surrounded by \ characters. For example this: @ReplaceRegEx(@Value(_dirpath),[^\]+\\?$,"")\@Value(_filename) would just move the file up a level. If you still wanted the MyFolder part, try this: @ReplaceRegEx(@Value(_dirpath),[^\]+\\?$,"")\@Value(_filename) - which will strip the last level and replace it with the MyFolder automatically. – Mark Ireland Jun 23 '17 at 14:35
  • btw - the regex part I got from here: stackoverflow.com/questions/11259471/… - if you have a S/O account, why not go vote it up as a thank you! – Mark Ireland Jun 23 '17 at 14:42
  • OK, that second regex should be: @ReplaceRegEx(@Value(_dirpath),[^]+\\?$,$(MyFolder))\@Value(_fil‌​ename) – Mark Ireland Jun 23 '17 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.