Environment: ArcObjects 10.1
I want to create a button using the conversion tool to convert an ASCII file to a raster dataset and add it into ArcMap.
I have a few questions:
1. Does the OnUpdate method means the ArcMap will update the mxd after I click the button?
2. I get a warning in the references:
Here is the references I used in the codes:
Here is the codes in the OnUpdate method
First I got a warning which tell me should add Geoprocessor in the references. So I add the Geoprocessor namespace in the references.
Then I got a warning in reference:
A reference was created to embedded interop assembly 'c:\Program Files (x86)\ArcGIS\DeveloperKit10.1\DotNet\ESRI.ArcGIS.Carto.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files (x86)\ArcGIS\DeveloperKit10.1\DotNet\ESRI.ArcGIS.ArcMapUI.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
I do know what this warning means and what should I do to solve it.
3. To create a raster dataset from the ASCIIToRaster.out_raster, should I cast it to IRaster2 or using any other way? I thought I should new a raster class, but I haven't found any class which can be new.
4. If there is a warning, the add-in cannot be found in ArcMap customize. Is this right?
I want to create a button using the conversion tool to convert an ASCII file to a raster dataset and add it into ArcMap.
I have a few questions:
1. Does the OnUpdate method means the ArcMap will update the mxd after I click the button?
2. I get a warning in the references:
Here is the references I used in the codes:
Code:
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.ConversionTools;
using ESRI.ArcGIS.DataSourcesRaster;Code:
IMxDocument pMxd = ArcMap.Document;
IMap pMap = pMxd.FocusMap;
ASCIIToRaster DEM = new ASCIIToRaster();
ASCIIToRaster Netful = new ASCIIToRaster();
DEM.in_ascii_file = demfile_path;
Netful.in_ascii_file = netful_path;
IRaster2 dem = DEM.out_raster as IRaster2;
IRaster2 network = Netful.out_raster as IRaster2;
ILayer dem_layer = dem as ILayer;
ILayer network_layer = network as ILayer;
pMap.AddLayer(dem_layer);
pMap.AddLayer(network_layer);Then I got a warning in reference:
A reference was created to embedded interop assembly 'c:\Program Files (x86)\ArcGIS\DeveloperKit10.1\DotNet\ESRI.ArcGIS.Carto.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files (x86)\ArcGIS\DeveloperKit10.1\DotNet\ESRI.ArcGIS.ArcMapUI.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
I do know what this warning means and what should I do to solve it.
3. To create a raster dataset from the ASCIIToRaster.out_raster, should I cast it to IRaster2 or using any other way? I thought I should new a raster class, but I haven't found any class which can be new.
4. If there is a warning, the add-in cannot be found in ArcMap customize. Is this right?