Skip to main content
Solved

Read all DWGs in a folder and write to GDB with feature classes separated by DWG filename


Hello,

I'm looking to read all DWGs in a folder and convert them to feature classes inside one GDB, with the feature classes named as the DWG filenames. Currently, I've set my reader to read all DWGs in the folder and put as 'Single Merged Feature Type' so that it's a single input port. Then I followed this thread to use the FilenamePartExtractor transformer and set the fme_basename to the dwg file name. After it's run, it only outputs one feature class instead of multiple. See below for my workflow.

 fme cadtogdb 

Please advise on where I'm going wrong!

Best answer by caracadrian

Use Directory and File Pathnames Reader witth the Path Filter Parameter set to .dwg followed by FeatureReader with Format set to DWG, Dataset set to path_windows attribute (or unix) and Accumulation Mode set to Merge Initiator and Result to keep the path_rootname attribute so you can use it in the GDB writer.

Use a geometry filter to separate the feature flow into point (and text), polygon, polyline.

Insert your GDB writer (or use a FeatureWriter) in witch you set Feature Class or Table Name in the text editor to @Value(path_rootname)_points. Duplicate it and set to @Value(path_rootname)_polylines and polygons (or variations of them).

GDB is sensitive to geometry type per table.

View original
Did this help you find an answer to your question?

7 replies

caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • May 6, 2021

Use Directory and File Pathnames Reader witth the Path Filter Parameter set to .dwg followed by FeatureReader with Format set to DWG, Dataset set to path_windows attribute (or unix) and Accumulation Mode set to Merge Initiator and Result to keep the path_rootname attribute so you can use it in the GDB writer.

Use a geometry filter to separate the feature flow into point (and text), polygon, polyline.

Insert your GDB writer (or use a FeatureWriter) in witch you set Feature Class or Table Name in the text editor to @Value(path_rootname)_points. Duplicate it and set to @Value(path_rootname)_polylines and polygons (or variations of them).

GDB is sensitive to geometry type per table.


caracadrian wrote:

Use Directory and File Pathnames Reader witth the Path Filter Parameter set to .dwg followed by FeatureReader with Format set to DWG, Dataset set to path_windows attribute (or unix) and Accumulation Mode set to Merge Initiator and Result to keep the path_rootname attribute so you can use it in the GDB writer.

Use a geometry filter to separate the feature flow into point (and text), polygon, polyline.

Insert your GDB writer (or use a FeatureWriter) in witch you set Feature Class or Table Name in the text editor to @Value(path_rootname)_points. Duplicate it and set to @Value(path_rootname)_polylines and polygons (or variations of them).

GDB is sensitive to geometry type per table.

Thank you, this works great. However with this method the CAD attributes are lost, I'd like to retain autocad_layer for example. Is there a way to do this?


Forum|alt.badge.img+2

@propertiesc​ The pattern you have in your workspace should work. fme_basename should return the DWG file name without the .dwg, so you shouldn't need the FilenamePartExtractor .

To read multiple dwg files, use the Multiple Folder/File browser;


markatsafe wrote:

@propertiesc​ The pattern you have in your workspace should work. fme_basename should return the DWG file name without the .dwg, so you shouldn't need the FilenamePartExtractor .

To read multiple dwg files, use the Multiple Folder/File browser;

Hi Mark, fme_basename shows up with null values for the dwgs, I think this is a known bug, see here - https://community.safe.com/s/question/0D54Q000080hfGV/dwg-and-dgn-reader-not-exposing-fmebasename-and-published-parameter

Hence me looking for a workaround.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • May 10, 2021
propertiesc wrote:

Thank you, this works great. However with this method the CAD attributes are lost, I'd like to retain autocad_layer for example. Is there a way to do this?

Use AttributeExposer.


propertiesc wrote:

Thank you, this works great. However with this method the CAD attributes are lost, I'd like to retain autocad_layer for example. Is there a way to do this?

Ahh beautiful thank you!


Forum|alt.badge.img+2
propertiesc wrote:

Hi Mark, fme_basename shows up with null values for the dwgs, I think this is a known bug, see here - https://community.safe.com/s/question/0D54Q000080hfGV/dwg-and-dgn-reader-not-exposing-fmebasename-and-published-parameter

Hence me looking for a workaround.

@propertiesc​  This should be fixed in FMe 2020.0 and later


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings