POST
|
Duncan, Thanks SO MUCH Here is the working result: Private Sub Export_to_shp()
Dim GP As IGeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor
With GP
.OverwriteOutput = True
.LogHistory = False
.AddOutputsToMap = False
.TemporaryMapLayers = True
End With
Dim m_pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
m_pMxDoc = My.ArcMap.Document
Dim in_features As String = m_pMxDoc.FocusMap.Layer(2).Name
Dim pVA As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArray
With pVA
.Add(in_features)
.Add("H:\SwiftReach")
End With
GP.Execute("FeatureClassToShapefile", pVA, Nothing)
End Sub If you see anything that could still use some fixing let me know. I am no programmer, but I try my best...
... View more
05-26-2016
09:06 AM
|
1
|
1
|
301
|
POST
|
Duncan, Again thanks for your continued help! I feel like with that last tip i am getting closer for sure! Here is the current state of the code: Private Sub Export_to_shp()
Dim GP As IGeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor
Dim fctofcconversion As ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile = New ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile()
Dim m_pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
m_pMxDoc = My.ArcMap.Document
Dim in_features As IFeatureLayer = m_pMxDoc.FocusMap.Layer(2)
fctofcconversion.Input_Features = in_features
fctofcconversion.Output_Folder = "H:\SwiftReach"
GP.Execute(fctofcconversion, Nothing)
End Sub the problem in this one is in the GP.Execute; error is: Argument not specified for parameter 'pTrackCancel' of "Public Function Execute (Name as String, iValues as ESRI.arcGIS.esriSystem.IVariantArray, pTrackCancel as ESRI.arcGIS.esriSystem.ITrackCancel) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult So i tried to mess with it a little based on the error: Private Sub Export_to_shp()
Dim GP As IGeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor
Dim fctofcconversion As ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile = New ESRI.ArcGIS.Geoprocessing.GeoProcessorResult
Dim m_pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
m_pMxDoc = My.ArcMap.Document
Dim in_features As String = m_pMxDoc.FocusMap.Layer(2).Name
Dim pVA As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArray
With pVA
.Add(in_features)
.Add("H:\SwiftReach")
End With
'fctofcconversion.Input_Features = in_features
'fctofcconversion.Output_Folder = "H:\SwiftReach"
GP.Execute(fctofcconversion, pVA, Nothing)
End Sub In this version the error is still in the gp.execute but specifically on the fctofcconversion variable: Value of type 'ESRI.arcGIS.ConversionTools.FeatureClassToShapefile' cannot be converted to String
... View more
05-26-2016
07:44 AM
|
0
|
3
|
612
|
POST
|
Duncan, Thanks for trying to help me through this... I am not sure i understand what you mean though. Do you mean pass the variables in in a traditional vb.net sense like? Private Sub Export_to_shp() Dim GP As IGeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor 'Declare variables for input Dim in_features As IFeatureLayer Dim out_path As String Dim out_name As String Dim m_pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument m_pMxDoc = My.ArcMap.Document in_features = m_pMxDoc.FocusMap.Layer(2) out_path = "H:\SwiftReach" out_name = "test.shp" GP.FeatureclassToFeatureclass_conversion(in_features, out_path, out_name) End Sub Because when i try that in like in the code above; it blows up at: GP.FeatureclassToFeatureclass_conversion(in_features, out_path, out_name) with the error NullReferenceException was unhandled That is why i started to try to go down the rabbit hole of trying to call the variables through some other more "arcpy" like means. I am beginning to think as Dan had mentioned above that there is too much mixing of styles here maybe? And that this may not work as i'd imagined it... Would be cool though; the arcpy tools are so much more intuitive to me. Any continued ideas would be greatly appreciated!
... View more
05-26-2016
05:35 AM
|
0
|
5
|
612
|
POST
|
Dan and Duncan, thanks for the replys! I was able to access the IGeoProcessor Dim GP As IGeoProcessor = Nothing (works!) My problem is hooking into the active map document and using the layers within the mxd i am working with in the vb.net project. stuff like mxd = arcpy.mapping.MapDocument('CURRENT') in_features = arcpy.mapping.ListLayers(mxd)[0] (stolen from arcpy scripts i found on the internet) my first goal is to get something like this to run: GP.FeatureclassToFeatureclass_conversion(in_features, out_path, out_name) but to have it reference a layer within the mxd i am working for the in_features.
... View more
05-25-2016
12:19 PM
|
0
|
8
|
612
|
POST
|
So is there a way you can use arcpy code from within a vb.net project? Currently have a pretty big custom set of addin's written in vb.net and can't figure out how to do one part of what i want with .net code. In acpy it is easy so i was wondering if i could somehow stick a little arcpy code in the visual studio project?
... View more
05-24-2016
09:26 AM
|
0
|
15
|
3285
|
POST
|
In researching on the internet it seems the vb.net equivalent to vba's ListIndex should be SelectedIndex. However this does not seem to be a property of the combobox in ArcGIS when the combobox is created as an add-in? Anyone find a way around this outside of rebuilding the combobox in a form to gain all the vb.net funcionality? I'd really like to keep it a simple add-in as that is all I need for everything other than this... Any help would be greatly appreciated! thanks, max
... View more
05-31-2013
07:38 AM
|
0
|
1
|
1747
|
POST
|
hello everyone, i am attaching a screenshot that shows a problem we are encountering with the address locator in 10.1. [ATTACH=CONFIG]21678[/ATTACH] while i do understand why technically bread st scores higher; it will still put all addresses in for the 100 block of broad st in a completely different part of the city unless the scoring is set to 96%. if someone could help me to fix this it would be fantastic. and another question: if there is anyway to get the locator to prompt you if it finds two matching possibly correct candidates like 100 n broad st and 100 s broad st for you to manually pick which is correct? right now we just have the preferences set so high it won't match unless the street has the proper predir and sufdir. what would be perfect is if there is some way to ignore the predir and sufdir if there is only one option. for example: 900 markle should produce a match since that address range of markle does not exist with another suffix (the only markle we have is markle st); but 8600 axe factory would not match because there is both a 8600 axe factory dwy and an 8600 axe factory ln in our streets feature class. any help would be greatly appreciated! thanks, max
... View more
02-11-2013
08:18 AM
|
0
|
0
|
459
|
POST
|
I believe so. Using the 32 bit PythonWin is a good idea, may be the easiest way to handle scripts that use personal gdb's. That way you can avoid the confusion about which version of IDLE you are using. success!!!! thanks to your help. installed a 32bit version and 64bit version of pythoinwin on the same box and this script works just like it did in 10.0 on the 32bit version. problem solved; BUT i have a final question for anyone who has the time... what is better about the 64bit version (IE: why not just uninstall the 64bit version and run everything in the 32bit version of pythonwin to avoid confusion)?
... View more
01-28-2013
09:52 AM
|
0
|
0
|
472
|
POST
|
OR if you want to open in in the regular python shell the other option is to open up the 32 bit python.exe in the normal ArcGIS 10.1 folder (I created shortcuts for both 32 bit and 64 bit to my desktop) and once you are in there you can manually open your script with File > Open. thanks for all the info so far! sorry if this is a dumb question but here goes (i am not so well versed in python lingo). when you mention the python shell your referring to idle correct? if so, i use pythonwin instead because that is just what i was taught on and am used to using. would installing the 32bit version of pythonwin(to run along with the 64bit version) on the 10.1 box work for scripts like this?
... View more
01-28-2013
08:32 AM
|
0
|
0
|
472
|
POST
|
Have you installed the 64 bit background processing for your 10.1 version? This is not compatible with personal geodatabases. In this case you have to use the 32 bit python. The 64 bit will not list the personal gdb's. Here's an example:
import arcpy, sys
arcpy.env.workspace = r'G:\Data\Geodatabase\Archive'
print "Running against: {0}\n".format(sys.version)
for ws in arcpy.ListWorkspaces():
print ws
here are the results when ran from 32 bit:
>>> ================================ RESTART ================================
>>>
Running against: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
G:\Data\Geodatabase\Archive\Cedar_County_Switched_1_23_2013.gdb
G:\Data\Geodatabase\Archive\Cedar_County_Switched_1_23_2013.mdb
G:\Data\Geodatabase\Archive\Cedar_Switched_1_23_2013.gdb
G:\Data\Geodatabase\Archive\Cedar_Switched_1_23_2014.mdb
>>>
And here is the exact same script ran on 64 bit:
>>>
Running against: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
G:\Data\Geodatabase\Archive\Cedar_County_Switched_1_23_2013.gdb
G:\Data\Geodatabase\Archive\Cedar_Switched_1_23_2013.gdb
>>>
As you can see it only listed the 2 file gdb's and not the personal gdb's when ran with 64 bit python. that is exactly my problem i think. the new box is 64 bit.... so is there a way around this? you have to be able to talk to access personal geodatabases somehow with the 64 bit version somehow still hopefully??? thanks, max
... View more
01-28-2013
06:26 AM
|
0
|
0
|
472
|
POST
|
so i have been having problems accessing tables in an mdb using arcpy on our server running arcgis10.1. i think i have figured out part of the problem. running this script: import arcpy arcpy.env.workspace = "\\\\STSHURON\\data\\gis_work\\data_maint\\Monthly_Update\\" wrkspc = arcpy.ListWorkspaces() for workspace in wrkspc: print workspace running the identical script (above) our 10.1 machine lists none of the mdb files in the directory as workspaces. on our 10.0 box all the mdb's in the directory are listed. all the other files that could be listed as workspaces in the directory (other directories, excel files, etc.) are listed when the script is run on either box; the only difference seems to be the access databases don't show up with the script on the 10.1 box. any ideas as to why that is? thanks! max
... View more
01-28-2013
05:34 AM
|
0
|
8
|
575
|
POST
|
Kevin, awesome! that is exactly what i was looking for, thanks so much. max
... View more
01-03-2013
06:54 AM
|
0
|
0
|
2413
|
POST
|
You can set the combobox's text property to "Select storm". Once something is selected, that text will not show up again. probably a dumb question but: where would/how i access the text property of the combobox? i would know how to do it if i made the combobox in the designer but this one is an add-in and i am unfamiliar with how to access it's properties. thanks, max
... View more
01-03-2013
06:00 AM
|
0
|
0
|
2413
|
POST
|
so i have a add-in combobox and would like it to have the text "select storm" in the (currently blank) dropdown when the combo box is displayed. is this possible? thanks! max
... View more
01-03-2013
04:53 AM
|
0
|
12
|
34388
|
Title | Kudos | Posted |
---|---|---|
1 | 05-26-2016 09:06 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|