Skip to main content
Solved

Is it possible to use a filepath stored in attribute information for the writer output location?

  • January 3, 2023
  • 4 replies
  • 30 views

Forum|alt.badge.img

Hi everyone,

 

I am creating a model to make it quicker to convert DWG files to SHP. They have the same format but there are several hundred files in various folders. The DWG files get updated from time to time, so the tool will be used often which is why I would like to set it so I only have to input the DWG file and the rest is automated.

 

For example:

 

C:\\CAD\\A\\1\\points.dwg

C:\\CAD\\A\\2\\points.dwg

C:\\CAD\\A\\3\\points.dwg

C:\\CAD\\B\\1\\points.dwg

C:\\CAD\\B\\2\\points.dwg

Etc....

 

I need to write it to the GIS folders which are very similar

C:\\GIS\\A\\1\\points.shp

C:\\GIS\\A\\2\\points.shp

C:\\GIS\\A\\3\\points.shp

C:\\GIS\\B\\1\\points.shp

C:\\GIS\\B\\2\\points.shp

Etc....

 

I have used FilenamePartExtractor to get the filepath of the DWG and then used StringReplacer to replace "C:\\CAD\\A\\1\\" with "C:\\GIS\\A\\1\\". Is there a way I can use this value to specify the output location?

 

It has worked to specify a filename, but no luck with filepath so far.

 

Thanks in advance!

 

Best answer by stefanh

This should be possible. Do you use a ESRI-Shapefile writer or a FeatureWriter? In the SHP-writer it is not possible to refer to an attribute for the folder. In de FeatureWriter, selecting ESRI-shapefile, it is possible to refer to an attribute. This might solve your problem.

 

If not can you please attach the workspace you have so far and some files.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • 38 replies
  • Best Answer
  • January 3, 2023

This should be possible. Do you use a ESRI-Shapefile writer or a FeatureWriter? In the SHP-writer it is not possible to refer to an attribute for the folder. In de FeatureWriter, selecting ESRI-shapefile, it is possible to refer to an attribute. This might solve your problem.

 

If not can you please attach the workspace you have so far and some files.


pimc
Contributor
Forum|alt.badge.img+8
  • Contributor
  • 16 replies
  • January 3, 2023

Hi @kewhew​ ,

 

In the Writer Parameters in your navigator you can reference attributes that you then can use to fanout on folder-level.

 

Use the Fanout Dataset Parameter with the attribute that contains the wanted pathAn example using the folder attribute I've created using an AttributeCreator. Of course in your case, you can use the path you've created using the FilenamePartExtractor.

Sample ResultHope this helps!

 


Forum|alt.badge.img
  • Author
  • 4 replies
  • January 3, 2023

This should be possible. Do you use a ESRI-Shapefile writer or a FeatureWriter? In the SHP-writer it is not possible to refer to an attribute for the folder. In de FeatureWriter, selecting ESRI-shapefile, it is possible to refer to an attribute. This might solve your problem.

 

If not can you please attach the workspace you have so far and some files.

Thank you so much @stefanh​ this worked perfectly! :)

 


Forum|alt.badge.img
  • Author
  • 4 replies
  • January 3, 2023

Hi @kewhew​ ,

 

In the Writer Parameters in your navigator you can reference attributes that you then can use to fanout on folder-level.

 

Use the Fanout Dataset Parameter with the attribute that contains the wanted pathAn example using the folder attribute I've created using an AttributeCreator. Of course in your case, you can use the path you've created using the FilenamePartExtractor.

Sample ResultHope this helps!

 

Hi @pimc​ 

 

Thank you so much for helping me out! I tried the solution provided by @stefanh​ and it worked like a charm, I should also try your method, I'm sure it might work better in some other situations. :)