Tag Info

New answers tagged

2

Your code won't work. You loop the cursor until it finishes. At that point pFeature is Nothing. After that you try to access the OID value of pFeature, which is Nothing. If you only select a single building or only want the first building OID of any selection set don't loop the cursor, just get rid of the cursor loop. Then you should make sure you got ...


1

I think SDE_OBJECT_ID might be data type LONG. Have you tried pFeature.OID.ToString(), or whatever the conversion method in VBA is? Not sure if it might fix the issue. Just an idea.


0

I had a similar issue and I have solved it using devenv.exe instead of msbuild.exe as described in Building ArcMap’s Add-in using command line


2

Below is what I came up with - suggestions for making this better are welcomed: /// <summary> /// Gets the field value from the IObject. Checks for coded /// value domains, subtypes, or just the plain field value. /// </summary> /// <param name="obj">ESRI IObject</param> /// <param ...


1

Use a try catch to fetch error messages from the gp object. try { GP.Execute("Creation", parameters, null); } catch(exception ex) { Messagebox.Show(GP.GetMessages(<severity>)); }


1

Further to Dan's answer on enumerating layers... with the UID.Value of IRasterLayer (see example UIDs here) supplied to the get_layers function you don't need to check later that it is a raster layer you're playing with, however sometimes you need to use the UID for IDataLayer which will return feature layers and raster layers, so to check this use: if ...


3

The easiest way to loop through layers in ArcMap is to use IEnumLayer. You get a reference to that from IMap.Layers. http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001200000482000000 Then check the type and cast each raster layer returned by the enumerator to IRasterLayer. ...


1

What you are identifying in your image is a ToolPalette not a Button or Menu. So use the AddIn Wizard to create your Buttons that you want to see in the ToolPalette then create the ToolPalette and add the buttons by their ID. Below is some demonstration code to get you going. <ESRI.Configuration xmlns="http://schemas.esri.com/Desktop/AddIns" ...


0

After much playing around with the various properties of the IMapTimeDisplay2 interface, I finally found something that worked. Perhaps this works because my dataset is time-enabled by an attribute called "Year" that has integer year values from 2010 to 2100 in 5 year increments, and I'm only interested in rendering one year at a time, so the "start time" ...


1

According to the Help file image is not an attribute of a menu element. In fact I cannot think of any menu on the ArcMap interface that behaves in this manner, i.e. has an image instead of a word, despite being able to change it to an image via the customize mode. So it's not a property you can define in the config file. Now I may be wrong, others can ...


0

Simply get the activeview envelope and CenterAt() the point shape you want var point = (IPoint)myItem.Shape; var envelope = theActiveView.Extent; envelope.CenterAt(point); theActiveView.Extent = envelope; theActiveView.Refresh(); That's it !


0

Because you have classes that only belong to desktop (IGxDialog, ...), Installation of Desktop is a must do. furthurmore you need an ArcGIS Desktop (engine will not be enough) license to initialize your application. You can do some hacking to pack Desktop dlls with your application, but that is a violation of ESRI terms. Esri indicates that if there are ...


0

The event may not be wired by default, I don't think this is the case here. I think you have the wrong property, it should be arg.KeyCode == not arg.ModifierKeys ==, modifiers are shift, alt, Ctrl. I think the OnKeyDown is working but not entering the block because the value is None. if (arg.KeyCode == System.Windows.Forms.Keys.Enter) Then check your ...


1

I believe what you're after is IPolycurve.Generalize. This will turn an arc into a series of straight segments approximating the line. This interface is implemented by both polygon and polyline. Use a simple buffer of a point (ITopologicalOperator.Buffer) for a circle (or create a circular arc circle with IConstructCircularArc.ConstructCircle) cast to ...


1

What you are looking for is the circumcircle of a triangle. The circumcircle of a triangle is the circle that passes through all three vertices of the triangle and is unique. Help Although I think you are not looking for the math behind, here, you can find the math to reach to center and radius of a circumcircle from three points (a triangle). The good ...


1

I haven't tested this but I don't there would be any problem. I suggest to simply test the code with two MessageBox: public class Tool1 : ESRI.ArcGIS.Desktop.AddIns.Tool { public Tool1() { } protected override void OnUpdate() { Enabled = ArcMap.Application != null; } protected override void OnMouseDown(MouseEventArgs ...


0

From one of my tools: <Button id="ButtonName" class="Button1" message="Does some stuff." caption="My Button" tip="Does some stuff" category="MyAddin" image="Images\Button1.png" /> As you can see the image has an extension and the XML is properly ...


0

This is a snippet from one of my working programs that exports the result to CAD: Dim vGP As ESRI.ArcGIS.Geoprocessing.IGeoProcessor2 = New ESRI.ArcGIS.Geoprocessing.GeoProcessor() Dim Params As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArray() Params.Add(vScratchWS.PathName & "\Grid;" & vScratchWS.PathName & "\ac1") ...


3

I think you are asking for the username of a layer's SDE connection. You need to use IWorkspace and IPropertySet. Something like this: Dim pDataset As IDataset = the feature layer/raster layer you want the user name of Dim pWorkspace As IWorkspace = pDataset.Workspace Dim pPropertySet As IPropertySet = pWorkspace.ConnectionProperties Dim userName As String ...


1

I use interface IFeatureEdit (or IFeatureEdit2). If you use method Split from interface IFeatureEdit, it will splits your feature, you will get 2 features. All of them will be new feature. (I mean 2 new Object IDs). However, if you use interface IFeatureEdit2, with method SplitWithUpdate, it is advance. We can get 2 features, but one is old feature and ...


2

Changing text fields length needs an exclusive schema lock on the dataset. Exclusive schema locks—In contrast to shared schema locks, exclusive schema locks are controlled by the developer or ArcGIS application, such as ArcMap or ArcCatalog. An exclusive lock is used to lock a geodatabase dataset or object from use by others to make the necessary ...


3

Arcobjects has two interfaces to join multiple FeatureClasses and (or) Tables: Query tables (IQueryDef) RelQueryTables The result of your join can be added to the map as a Layer if the result has a geometry column. Make sure to read this Page to check the differences of two and select the one that suites your needs


0

Here is a Python toolbox to create an assortment of perpendicular lines at various places along the line including starts and end points... ftp://lnnr.lummi-nsn.gov/GIS_Scripts/createperpendicularlines.zip


1

To expand on the comment by @Dan Jurgella... Don't forget to check the properties in the System.Globalization.CultureInfo class. There are static properties in that class, DefaultThreadCurrentCultureand DefaultThreadCurrentUICulture, which could help you. Also depending on what you're doing with languages, it probably wouldn't hurt to be familiar with the ...


3

Looks like this is what you are looking for: http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//0048000001s1000000 System.Threading.Thread.CurrentThread.CurrentUICulture


0

I have been down that route and I don't suggest it. When I started to run Arcobjects with Python (almost 2yrs ago), I only knew a little bit of C#, but had what I would consider a modest knowledge of Python. Not a pro, but not a beginner either. Now, I am switching the whole Add-In (3k-ish lines of code) to C# as it will be developed further and it's not ...


1

Ok, I got it to work by going hog-wild with ComReleaser objects. Basically, I scanned through my code, and anytime I found anything that was at all from ArcObjects, I attached a ComReleaser to manage it. Basically, I'm just doing manual memory management. At any rate, it does seem to release the file, so long as EVERYTHING is released (even if it doesn't ...


1

To "go through a designated folder, [and] locate all MXD files within the folder" is relatively easy with Python, and there is a Stack Overflow Q&A that describes some ways: http://stackoverflow.com/questions/3207219/how-to-list-all-files-of-a-directory-in-python However, the rest is much harder because ArcGIS Desktop 9.3 only had access to the ...


0

The problem, it seems, is in the repeated call to ArcMap.Document.FocusMap.FeatureSelection. If I store the focus map as a member variable IMap map upon initializing the extension and retrieve the selection features by calling map.FeatureSelection instead, all seems to work fine and I am able to re-select features "indefinitely". Sadly, I am not able to ...


1

In order to debug ArcMap 10.3 Add-in with VS2013 in .Net 4.5. I had to attach VS2013 to ArcMap.exe process. This is kinda annoying but it is the only way I got it to work for now. I'm still confused on why this is happening. How to attach process Start ArcMap In VS2013, go to menu "DEBUG" -> "Attach to Process" Select "ArcMap.exe" and click on "Attach" ...


0

My solution didn't quite work, but with the help of a friend, we created a solution that does work (mostly). We took the call to CheckStates() and AddItems() out of the Sub New and added the following code: Private Sub OnOpenDocument() '-New CRl AddItems() CheckStates() End Sub AddItems() is a call to a subroutine that adds items to a ...


2

In another, related but slightly different, post I provided an answer that may be of interest for python users trying to wrap their heads around the Esri ArcObjects help docs.. I came from the other side: I already knew ArcObjects long (long long) before I had even heard of python and thanks to posts like these I am able to include some critical ArcObjects ...


0

Try moving these lines above the while statement as they need to be called only once. ISpatialFilter pslt = new SpatialFilterClass(); pslt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; Also set your cursors to be recycling there are performance advantages as discussed here.


0

Ok, so what I wound up doing was very similar to my pseudo code in my question. I was able to programatically create Points at the ends an middle of the selected water main feature... Then use those points to programmatically add the barriers and start flag to the geometric network. The revised pseudo-code of my solution is: User selects water mains User ...


2

Late but here is a suggestion. You can call Trace Geometric Network geoprocessing tool from ArcObjects and you can pass any IFeatureLayer in it as flags or barriers. You should be able to create a point on selected water main using ICurve.QueryPoint and save this point to IFeatureLayer and use it as a flag. If you have some layer in your network which ...


0

You cannot do a 'switch select' with a Search, what you need to use is Select which you can then negate/switch with ISelectionSet.Combine then convert to a cursor using ISelectionSet.Search (cursor must exist first): // your queries as a SelectionSet ISelectionSet pSatisfiesQuery = pFeatureClass.Select(pQueryFilter, ...


1

The first task here is to get the location of the pointer, you can get this from the events OnMouseDown and OnMouseMove, these will return the coordinates in screen coordinates and also map coordinates... depending on whether you want to click the map or zoom where the pointer currently is will decide which one you want to use. To zoom the map it should be ...



Top 50 recent answers are included