How to read a CAD file (DWG for example)?

451
3
04-22-2019 02:34 PM
FayuLai
New Contributor II

I was trying to read a CAD feature class from a DWG file but could not find any Pro APIs related to it.  Any help will be greatly appreciated!

0 Kudos
3 Replies
UmaHarano
Esri Regular Contributor

Hi

Here is a code snippet to add a feature class in a CAD DWG file -

string url = @"E:\Data\CAD\Charlottesville\N1W1.dwg\Polyline";  //FeatureClass of a cad dwg file
Uri uri = new Uri(url);
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map));

Thanks

Uma

0 Kudos
FayuLai
New Contributor II

Hi Uma,

Thank you very much for your help. Is it possible to a CAD file without add it to Map control?

Best regards,

Fayu

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Fayu

Do you mean Pro’s Map Control? Yes, should be no problem. 

Thanks

Uma

0 Kudos