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!
Hi
Here is a code snippet to add a feature class in a CAD DWG file -
<SPAN class="keyword token">string</SPAN> url <SPAN class="operator token">=</SPAN> <SPAN class="string token">@"E:\Data\CAD\Charlottesville\N1W1.dwg\Polyline"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//FeatureClass of a cad dwg file</SPAN> Uri uri <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>url<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">await</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> LayerFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateLayer</SPAN><SPAN class="punctuation token">(</SPAN>uri<SPAN class="punctuation token">,</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks
Uma
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
Hi Fayu
Do you mean Pro’s Map Control? Yes, should be no problem.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.