POST
|
Hi jpgrusling This is an existing BUG. [BUG-000097730: The QueryFilter does not function, and errors are returned for methods that require IQueryFilter parameters, such as IFeatureClass.Search, IFeatureSelection.SelectFeatures, and so on, in external ArcObjects applications that access ArcMap using the IAppROT interface.] And below is the workaround for the issue. Use IObjectFactory.Create to create the QueryFilter object instead of the new keyword to ensure the QueryFilter functions as expected from external applications, as shown in the following code: IQueryFilter pQF = new QueryFilter(); string classID = pQF.GetType().GUID.ToString("B"); /// appRot application space IObjectFactory objectFactory = (IObjectFactory)pAPP; pQF = (IQueryFilter)objectFactory.Create(classID); For more information about this workaround, refer to the document at http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#56eba175-54c1-46b4-801a-fc968e582581.htm. Thanks, Alif
... View more
08-26-2016
09:59 AM
|
0
|
0
|
478
|
POST
|
Hi, This can be achieved. I have created an AddIn, on click of this AddIn the below form opens up. You need to click the browse button, this will open the AddData command of the ArcMap. After which one needs to select the desired feature class, this will display the full path of the selected feature class (Also it will add the feature class to ArcMap) in the text box. Now, The ObjectID of the selected feature class will be populated in the combo box. Below is the code. IDocument d = ArcMap.Document as IDocument;
IUID ud = new UIDClass();
ud.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}";
ICommandItem ci = d.CommandBars.Find(ud);
ci.Execute();
IMxDocument pMxDocument = (IMxDocument)ArcMap.Application.Document;
IMap pMap = pMxDocument.FocusMap;
ILayer pLayer = pMap.get_Layer(0);
ESRI.ArcGIS.Geodatabase.IDataset dataset = (ESRI.ArcGIS.Geodatabase.IDataset)(pLayer); // Explicit Cast
textBox1.Text= (dataset.Workspace.PathName + "\\" + dataset.Name);
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
IWorkspace workspace = workspaceFactory.OpenFromFile(dataset.Workspace.PathName, 0);
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
ITable table = featureWorkspace.OpenTable(dataset.BrowseName);
ICursor cursor = (ICursor)table.Search(null, true);
IRow row = cursor.NextRow();
int field = table.Fields.FindField("OBJECTID");
//clear the combobox
comboBox1.Items.Clear();
//then populate the combo boxes
while (row != null)
{
string strValue = Convert.ToString(row.get_Value(field));
if (comboBox1.Items.Contains(strValue) == false)
comboBox1.Items.Add(strValue);
row = cursor.NextRow();
}
... View more
07-18-2016
10:49 AM
|
0
|
0
|
465
|
POST
|
I am looking for a ArcObjects method or a property where I can show/hide the Symbol of a layer. (see the attached screenshot). Any Help would be appreciated
... View more
02-08-2016
07:35 AM
|
0
|
1
|
2141
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|