Skip to main content

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!

 

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.


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!

 


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! :)

 


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. :)


Reply