POST
|
Thanks for the help Duncan. The problem was some of the parameters were not set. Now for the next step. I am trying to get a progress bar to run while the geoprocessing task is running. I have not been able to get them to run at the same time. I have code if that will help.
... View more
01-21-2011
08:01 AM
|
0
|
0
|
300
|
POST
|
bxe6736, Is this your real name? The only thing I spotted with your code snippet is the line: Dim GP As Geoprocessor = New Geoprocessor() I think should be: Dim GP As IGeoprocessor = New Geoprocessor() If this does not fix your problem it would help us if you uploaded the toolbox, does the model have parameters for example as you are supplying none? Duncan Ok Duncan fixed half of the problem. Thanks for the heads up on the IGeoProcessor tip. Now I am getting another error on the gp.execute line: Error HRESULT E_FAIL has been returned from a call to a COM component. Here is the new code that I am using:
Dim GP As IGeoProcessor
GP = New GeoProcessor
GP.AddToolbox("C:\Documents and Settings\bxe6736\Application Data\ESRI\ArcToolbox\My Toolboxes\Toolbox.tbx")
''''Run Model 1
'' Model 1 Inputs
parameters.Add("\\Corcosaps02a\cig-eng_nt\User\PUBLIC\Public Awareness\IRTH\ISAT.mdb\ControlPointsSNG")
parameters.Add("\\Corcosaps02a\cig-eng_nt\User\PUBLIC\Public Awareness\IRTH\ISAT.mdb\ControlPointsTGP")
parameters.Add("\\Corcosaps02a\cig-eng_nt\User\PUBLIC\Public Awareness\IRTH\ISAT.mdb\tblStaticAddsTGP")
parameters.Add("\\Corcosaps02a\cig-eng_nt\User\PUBLIC\Public Awareness\IRTH\ISAT.mdb\tblStaticAddsSNG")
parameters.Add("\\Corcosaps02a\cig-eng_nt\User\PUBLIC\Public Awareness\IRTH\ISAT.mdb\ControlPointsAbandoned")
'' Model 1 Outputs
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsAbandoned_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\tblStaticAddsTGP_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\tblStaticAddsSNG_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsSNG_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsTGP_Copy.shp")
GP.Execute("Model3", parameters, Nothing)
parameters = Nothing
MsgBox("Model 1 Complete", MsgBoxStyle.OkOnly, "")
''''Run Model 2
'' Model 2 Inputs
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsAbandoned_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\tblStaticAddsTGP_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\tblStaticAddsSNG_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsSNG_Copy.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\ControlPointsTGP_Copy.shp")
'' Model 2 Outputs
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\Aban_OneCall_CL.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\TGP_ADD.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\TGP_CL.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\SNG_CL.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\SNG_ADD.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\TGP_OneCall_CL.shp")
parameters.Add("C:\Documents and Settings\bxe6736\Desktop\New Folder\Centerline(Local)\SNG_OneCall_CL.shp")
GP.Execute("Centerline", parameters, Nothing)
parameters = Nothing
MsgBox("Model 2 Complete", MsgBoxStyle.OkOnly, "") Any Suggestions?? Brent
... View more
01-13-2011
07:56 AM
|
0
|
0
|
300
|
POST
|
I am fairly new to the VB.NET world. I am getting an error when I try to call a model via VB.NET code. Below is the code that I am using: Try
Dim GP As Geoprocessor = New Geoprocessor()
GP.AddToolbox("C:\Documents and Settings\bxe6736\Application Data\ESRI\ArcToolbox\My Toolboxes\Centerline(Local).tbx")
GP.Execute("Centerline", Nothing, Nothing)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "")
End Try It falls into the error on the gp.execute command. I have attached the error that I am getting. I have checked the folder that I am writing the data to and it doesn't seem to be a permissions problem.
... View more
01-11-2011
03:58 AM
|
0
|
4
|
2422
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|