|
POST
|
This is done in your Config.esriaddin file (XML) in your Menu >> items. This is not showing the entire XML file but shows you where the 'separation' comes into play. When set to true... the space if in the toolbar, will appear BEFORE the tool. If in a menu, will appear above. <Toolbars> <Toolbar id="CompanyToolsToolbar" caption="Our Company Toolbar ©2012 v11.1" showInitially="true"> <Items> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_SomeMenu" separator="false"/> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_DataCreateMenu" separator="false"/> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_DistancesMenu" separator="false"/> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_ConverterMenu" separator="false"/> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_TableDatasetMenu" separator="false"/> <!--Reference to the custom menu to provide access to the custom multiItem --> <Menu refID="CompanyToolsToolbar_Addin_v10_CoordinatesMenu" separator="false"/> <!--BUTTONS--> <!--Reference to the custom button and tool--> <Button refID="CompanyToolsToolbar_Addin_v10_MapLayoutSpelling" separator="true"/> <!--Reference to the custom button and tool--> <Button refID="CompanyToolsToolbar_Addin_v10_ProjectTracker" separator="true"/> </Items> </Toolbar> </Toolbars> </ArcMap> </AddIn>
... View more
07-17-2012
06:55 AM
|
1
|
0
|
1102
|
|
POST
|
I had written a function which is generic, allowing you to create various fields. Just call the AddFieldtoFeature in your main code block. It does check if the field already exists. Yes, the GP works as well, but I prefer this way... full control. You would just call by: AddFieldtoFeature(pFeaturelayer, "FIELDNAME", esriFieldType.esriFieldTypeString, Nothing, Nothing, 20, Nothing, "ALIAS", Nothing) **This works by passing the appropriate information, any info that is to be left out needs to be NOTHING , "" will not work. Copy the entire code below and place somewhere in the Class. you will have to reference the pMxDoc yourself. (m_Application) Sub AddFieldtoFeature(ByVal FeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer, ByVal FieldName As String, ByVal FieldType As ESRI.ArcGIS.Geodatabase.esriFieldType, ByVal scale As Integer, ByVal Precision As Integer, ByVal Length As Integer, ByVal IsNullable As Boolean, ByVal AliasName As String, ByVal DefaultValue As String)
Dim pMxdoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pApp As ESRI.ArcGIS.Framework.IApplication
pApp = m_application
pMxdoc = m_application.Document
pMap = pMxdoc.FocusMap ' the active map the button was pressed, use Approt if you want to connect to different map
Dim pFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass
pFeatureClass = FeatureLayer.FeatureClass
Dim pField As ESRI.ArcGIS.Geodatabase.IFieldEdit2
pField = New ESRI.ArcGIS.Geodatabase.Field
Dim pCheckField As ESRI.ArcGIS.Geodatabase.IFields
Dim CheckFieldInt As Integer
Try
pCheckField = pFeatureClass.Fields
CheckFieldInt = pCheckField.FindField(FieldName)
If CheckFieldInt = -1 Then
' lets make sure we are OUT OF editing but do this so if all fields are created... we can stay in edit mode:
Dim pID As New ESRI.ArcGIS.esriSystem.UID
pID.Value = "esriEditor.Editor" ' PROG ID
'or the CLSID
'pID.Value = "{F8842F20-BB23-11D0-802B-0000F8037368}"
Dim pEditor As ESRI.ArcGIS.Editor.IEditor
pEditor = pApp.FindExtensionByCLSID(pID)
If pEditor.EditState = ESRI.ArcGIS.Editor.esriEditState.esriStateEditing Then ' if in edit mode...
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
pUID.Value = "{59D2AFD1-9EA2-11D1-9165-0080C718DF97}" 'STOP EDITING, MUST HAVE {}
Dim pCommandBars As ESRI.ArcGIS.Framework.ICommandBars
Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem
pCommandBars = pApp.Document.CommandBars
pCommandItem = pCommandBars.Find(pUID)
pCommandItem.Execute()
'start editing "{59D2AFD0-9EA2-11D1-9165-0080C718DF97}"
System.Threading.Thread.Sleep(100)
End If
pField.Name_2 = FieldName
pField.Type_2 = FieldType
'Select appropriately based on field type selected
If FieldType = esriFieldType.esriFieldTypeDouble Or FieldType = esriFieldType.esriFieldTypeInteger Or FieldType = esriFieldType.esriFieldTypeSmallInteger Then
pField.Scale_2 = scale
pField.Precision_2 = Precision
End If
If FieldType = esriFieldType.esriFieldTypeString Then
pField.Length_2 = Length
End If
If IsNullable <> Nothing Then
pField.IsNullable_2 = IsNullable
End If
If AliasName <> "" Then
pField.AliasName_2 = AliasName
End If
If DefaultValue <> "" Then
pField.DefaultValue_2 = DefaultValue
End If
pFeatureClass.AddField(pField)
End If
Catch ex As Exception
MessageBox.Show("Failed to create field" & vbNewLine & ex.Message & vbNewLine & "Error Details:" & vbNewLine & ex.StackTrace, "Create Feature Field", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
... View more
07-17-2012
06:40 AM
|
0
|
0
|
904
|
|
POST
|
IDataStatistics is one way or One could also simply sort (using decending) the field and grab the first row value.
... View more
07-11-2012
07:07 AM
|
0
|
0
|
1098
|
|
POST
|
As stated above, you can call the GeoProcessor. You could also create a PGD and add it to your build, in code, simply copy from the assembly directory to which ever directory you wish and rename. ' Create a file geodatabase workspace factory. Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory") Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory) ' Create a file geodatabase. Dim workspaceName As IWorkspaceName = workspaceFactory.Create("C:\Data", "California", Nothing, 0)
... View more
07-11-2012
07:04 AM
|
0
|
0
|
1102
|
|
POST
|
Nimesh is correct. The referenced services is 9.31. Noting any of the MapServer Supporting Interfaces within the link (http://geoportal.abudhabi.ae/rest/services) do not contain MOBILE, which it must. ArcServer10 using Mobile/Content is required. (or using ArcGISOnline)
... View more
07-11-2012
06:50 AM
|
0
|
0
|
557
|
|
POST
|
regarding: ArcGIS 10.0 SP3 (Desktop and ArcGIS Explorer 1750) File Menu Performance Patch 01-09-2012 - PATCH ESRI has altered the location of the configuration xml file for the AddinFolderList (using server deployment of addins) For windows 7: The original location was C:\Users\" & Environment.UserName & "\AppData\Local\ESRI\Desktop10.0\AddinFoldersList.xml" The NEW location is: C:\Users\" & Environment.UserName & "\AppData\Roaming\ESRI\Desktop10.0\AddinFoldersList.xml" Exciting when company wide install a patch, and they all loose Server Addins. 😉
... View more
01-12-2012
08:39 AM
|
0
|
0
|
1367
|
|
POST
|
If you happen to be using the VS Express edition, the 10.0 SDK for .net Framework installer only supports VS 2008 (not 2010). That is correct! I did come across reading somewhere that 10.1 would include 2010 express comparability as well.
... View more
11-01-2011
12:10 PM
|
0
|
0
|
1024
|
|
POST
|
You know, you could, make the xml file READ ONLY once your addin has altered it and saved it. When Arc Closes, your new xml file would remain (arc doesn't have a hissy fit over it), and the next open would see the changes. It might work! Just have some code Dim attribute as System.IO.FileAttributes = FileAttributes.ReadOnly
File.SetAttributes("Location\AddinFoldersList.xml", attribute You get the idea.
... View more
10-05-2011
07:32 AM
|
0
|
0
|
1692
|
|
POST
|
The problem is that I want to make these edits from within a custom ArcMap add-in, therefore, Arcmap would be running at the time. ArcObjects gives me the ability to programmatically add a Toolbox, modify toolbars, do pretty much anything with code from within a running ArcMap session. I can't, however, add an add-in folder to the Add-in folder list on the fly. This would be ideal and it is what ESRI is hopefully changing. I'm leaning toward doing something in ArcMap's OnShutdown event to get that XML file written correctly. If you can find a way to modify that options box during a session, you would be set. (modifying the xml will not do, as you know now) its not a bug though, and that is what ESRI would have to change if they want to, give you access to that Options box via objects... They will not be able to change the read and write sequence of the xml file. (as it works logically as is). Not sure how long you want to wait either. I am not sure if you will be able to write onshutdown after arc's embedded xml overwrite takes place... I wrote an exe as its a one time deal, all workstations will always point at one folder on a secure server for all addins. Is there a reason why the adjustments must be made in an addin. (just something to think about). Either way. good luck.
... View more
10-04-2011
07:33 AM
|
0
|
0
|
1692
|
|
POST
|
Step 1 is your problem. Why do you have Arc open when modifying the settings? Of course arc will save to the xml (based on what is in Addin Manager) which would be nothing in this case, hence why your xml modification is gone. You need to give the settings PRIOR so the active session establishes those changes. I mention in my prior post... "I would confirm in Addin Manager >> options that the folder path does indeed exist before closing." meaning, under Customize >> Addin-Manager >> Options >> folders ... you would have noticed it would be empty. This is becuase Arc will ONLY read this xml file during Startup (initialization) The settings must be established prior to opening a session. Just like re-arranging your toolbars, buttons and customization, is saved on Shut down. (to the normal.mxt)... so empty add-in folder options (in the arc session) = will save the default xml string to the AddInFoldersList.xml. Arc does not look at that file DURING an open session, only on start up, and saves the information (contained in that arc session) on shutdown. You could, open arc first, then modify the xml, open ANOTHER arc session, see the changes, close that one down, xml will keep the changes (as it saves them), then close the First Arc (which contains no folder settings), and your xml folder will be over-written with no folder path. (hope that is not confusing) Hope that makes sense. There is no bug, not sure why ESRI would say that. Recap: You should modify the xml as step 1. That is it! Open Arc, you will see the folder in Addin Manager... when you close, it will re-write what you told Arc back to the xml as usual. You should also, just ensure you are up to date with the Build 3200 level (service pack 2) and have the ten patches installed. (up to _34 in regkeys)
... View more
10-04-2011
07:06 AM
|
0
|
0
|
1692
|
|
POST
|
I thought I would reply to reveal the answer to this in case someone was curious. (actually forgot about this question thread) insert the following where your crlf is desired: & # 13 ; & # 10 -you will have to remove all the spaces, unable to visually show without creating a return on the forum (posting) ' Ensure no spaces or using the �??enter�?? key when writing. (This will insert unwanted extra spaces on the same line) ESRI Arc allows a seven line, 77 visible characters per line limit in the extension form. There is no set limit for characters per line (but user must scroll to view past the 77 visible based on the extension form size). Here is a working example. - again, if I post here, you loose the visual characters
... View more
10-03-2011
07:06 AM
|
0
|
0
|
740
|
|
POST
|
Jeffry You can use custom Cursor of any sort using a TOOL addin rather than a button (if that is what you are using), and referencing the embedded .cur file within the config.esriaddinx xml file. <Tool id="Microsoft_ArcMapAddin1_Jeffry_Class" class="Jeffry_Class" message="This is the description" caption="Jeffry" tip="Cursor Tooltip" category="AddInControls" image="Images\Jeffry_Class.png" cursor="Images\JeffryCustomCursor.cur"> Just remember to to have the build action of your cursor : AddInContent, rather than embedding. Within the Class referenced to in the xml file... you can then do a mousedown for example 'OnMouse down
Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseDown(arg)
'Code here on Mouse down
End Sub What is stated above is through ITool, through IToolDef, not Addin method.
'for Cursor - create the cursor
m_Cursor = New System.Windows.Forms.Cursor(Me.GetType.Assembly.GetManifestResourceStream("FocusToolsToolbar.CrosshairCursor.cur"))
If Not m_Cursor Is Nothing Then
mh_Cursor = m_Cursor.Handle
End If
Public ReadOnly Property cursor() As Integer Implements ESRI.ArcGIS.SystemUI.ITool.Cursor
Get
Return mh_Cursor.ToInt32
End Get
End Property
... View more
09-30-2011
09:08 AM
|
1
|
1
|
3401
|
|
POST
|
this is in C# override Tool Cursor method and return Cursors.Cross.Handle.ToInt32(); Can you elaborate on this? How does this work with an Inherits Addin? Property CURSOR can not be declared 'overrides' because it does not override a property in a base class.
... View more
09-30-2011
08:44 AM
|
0
|
0
|
3400
|
|
POST
|
Thank you Griek, this is very helpful and John Hauck's approach makes more sense than pro grammatically determining GUID/ CLSID without validation. I myself will start to use this approach. I had removed the post prior as I wanted to look into this further, but you had beat me to the punch of responding. (So for anyone else reading this) I had briefly posted explaining ways of gathering the GUID clsID through namespace classnames)
... View more
09-30-2011
06:58 AM
|
0
|
0
|
1100
|
|
POST
|
Interesting alternative Grieck I never found a list so I do this: simply write a couple lines of code to GET the CLSID based on any Namespace, Class. For example: AccessWorkspaceFactoryClass Dim objFactory As ESRI.ArcGIS.Framework.IObjectFactory = TryCast(m_application, ESRI.ArcGIS.Framework.IObjectFactory)
Dim AccessWkspFactType As Type = GetType(ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass)
Dim typeClsID As String = AccessWkspFactType.GUID.ToString("B")
Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = DirectCast(objFactory.Create(typeClsID), ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)
... View more
09-29-2011
07:32 AM
|
0
|
0
|
1100
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 09-27-2024 09:04 AM | |
| 1 | 01-06-2016 11:32 AM | |
| 1 | 12-13-2021 10:03 PM | |
| 1 | 07-19-2017 07:31 AM | |
| 1 | 01-18-2016 07:23 AM |
| Online Status |
Offline
|
| Date Last Visited |
4 weeks ago
|