사용자 지정 ArcGIS 모델을 실행해야하는 함수를 만들었습니다. ArcGIS 10.2에서 VB 2010을 사용합니다. 이 기능을 실행해야하는 버튼은 고정 가능한 창에 있습니다.Visual Basic으로 사용자 지정 ArcGIS 모델 실행
Dim model As Geoprocessor = New Geoprocessor()
model.AddToolbox("D:\Chris\Van Hall Larenstein\Ruimtelijke Informatie Technologie\RPS\RPS.tbx")
Dim parameters As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArrayClass()
model.Execute("RPS_TEST", parameters, Nothing)
VB 2010에서는 오류가보고되지 않지만 ArcGIS에서는 작동하지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
편집
이 그것을 할 수있는 방법이 아닌보다Dim pToolHelper As IGPToolCommandHelper2 = New GPToolCommandHelper
'Set the tool you want to invoke.
Dim toolboxPath = "C:\Program Files\ArcGIS\Desktop10.2\ArcToolbox\Toolboxes\Analysis Tools.tbx"
pToolHelper.SetToolByName(toolboxPath, "Buffer")
'Create the messages object to pass to the InvokeModal method.
Dim msgs As IGPMessages
msgs = New GPMessages
'Invoke the tool.
pToolHelper.InvokeModal(0, Nothing, True, msgs)
My.ArcMap.Application.CurrentTool = Nothing
크리스 Driessen
코드가 정상적으로 보입니다. 모델에는 매개 변수가 필요하지 않습니다. –
매개 변수가 필요합니다. 하지만 내 코드에서 매개 변수를 선언하고 싶지 않습니다. ArcGIS (참조 shapefile 및 fieldnames)에서 선언되어야합니다. –